A Python-based Discord bot for PalWorld server administration via RCON.
This is an experimental project for a PalWorld remote console via Discord chat bot. Control and monitor your Pal World Servers remotely using this Discord Bot.
See Gallery below to view some of the features the bot provides.
This project requires Python 3.11+. This is a pain point for Linux users, as Ubuntu Jammy (we have not checked other distros) currently only officially supports 3.10. We've included instructions for users who are on Ubuntu in the following section.
We initially wanted to use Richard Neumann's RCON client implementation, but since Palworld's RCON server doesn't follow specifications properly, said library wasn't working for Palworld. We have currently switched to tama's implementation, which is technically for Minecraft, but is working for us. One caveat (based on issue #6) being that it makes assumptions about encoding, which causes packet read errors when players have non-latin characters in their IGN (not an issue for Minecraft which only allows latin characters).
- (Windows) Download Python and SET IT TO PATH DURING INSTALLATION.
- Note: If you install using a package manager like Chocolatey, this will be done for you automatically
- Instructions for Linux can be found in the following sub-section
- Clone this repository
- Create a file
config.toml
at the root of the project, using the providedconfig_example.toml
as a guide- For Discord bot token, see the following section for instructions for setting up your own Discord bot
- For IP address, use the public IP of your game server if the Discord bot is not on the same machine; otherwise
localhost
is fine - For port and password, see the RCON server set-up section below
- (UNIX-like) Use
setup.sh
to set up your virtual environment- Note: Script files require permissions; e.g.:
chmod +x setup.sh start.sh
- If you're on Windows, running the
start.bat
file will automatically set up your virtual environment!
- Note: Script files require permissions; e.g.:
- Use
start.bat
/start.sh
to run the Discord Bot!- Log files are saved to
/logs
and rotated at midnight. - Log files are automatically excluded from git
- Log files are saved to
Credits: Adapted from an article Rehan Haider
This is only a temporary measure until Ubuntu officially adds support for Python 3.11+.
- Update your system:
sudo apt update && sudo apt upgrade -y
- Add deadsnakes as third party repository:
sudo add-apt-repository ppa:deadsnakes/ppa
- Fetch package list:
sudo apt update
- Install Python 3.11
sudo apt install python3.11
- Re-install the Python interface for APT
sudo apt remove --purge python3-apt
sudo apt autoclean
sudo apt install python3-apt
- Manually install distutils:
sudo apt install python3.11-distutils
- Manually install pip
cd
to a temporary location- Download the installation script:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
- Run the installation script:
sudo python3.11 get-pip.py
- Manually install venv:
sudo apt install python3.11-venv
nano setup.sh
andnano start.sh
to replace all instances ofpython3
withpython3.11
We don't provide release versions, nor package the contents of this repository,
so you can update to the latest version by simply performing git pull
.
-
Create your Discord Bot using the Discord Developer Portal
-
Click on New Application at the top right of the web page.
- Insert a Name and click
Create
and click on your new Application.
- Insert a Name and click
-
Click on the
Bot
Section of the Discord Application: -
Copy your discord bot token and put it into the
config.toml
that you've created. -
Ensure your discord bot has these settings appropriately marked.
-
Invite the Discord Bot with the following scopes: bot & applications.commands
Tip
Use a Discord Permissions Calculator to make your life easier!
Important
Do note that the slash commands may take up to an hour to propagate for ALL servers the bot is on.
- Open the Palworld configuration file using the appropriate path
- The following are relative paths to Steam/SteamCMD's install directory:
- Windows:
steamapps/common/PalServer/Pal/Saved/Config/WindowsServer/PalWorldSettings.ini
- Linux:
steamapps/common/PalServer/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini
- Windows:
- The following are relative paths to Steam/SteamCMD's install directory:
- Scroll all the way to the right of the second line
- Set the RCON port using the
RCONPort
variable- e.g.
RCONPort=255575
- e.g.
- Turn on RCON:
RCONEnabled=True
- Set the administrator password for toggling admin mode (this also doubles as the RCON password)
- e.g.
AdminPassword="insertpasswordhere"
- e.g.
- Modify firewall rules for the RCON port
- e.g.
sudo ufw allow 255575/tcp
- MAKE SURE YOU'RE AWARE OF THE SECURITY RISKS OF DOING SO
- e.g.
- Port-forward the RCON port
- Refer to your router's instructions for more details