Hardware (minimum):
Note
Depending on the used plugins for this bot and the size of your TeamSpeak server (amount of channels, clients, etc.), you might need more CPU cores and/or memory.
- 1 CPU Core
- 128 MB Memory
Software:
- Install the software requirements from above (e.g.
sudo apt install git python3 python3-venv
) - Clone this repository using Git:
git clone https://github.com/Sebi94nbg/teamspeak3-python-bot.git
- Switch into the project directory:
cd teamspeak3-python-bot/
- List available versions:
git tag
- Switch to the latest version:
git checkout <version>
- Create your own config file:
cp config.example.ini config.ini
- Adjust the config file:
vim config.ini
(see configuration for further information)
Instead of setting up the above Python virtual env, you can also skip the steps 4 and 5 and instead install the dependencies globally. However, this is not recommended as you could run other Python projects on the same system, which require then a different version of specific dependencies.
First of all, you should set up a Python virtual environment and install the dependencies:
python3 -m venv venv
source venv/bin/activate
pip3 install wheel
pip3 install -r requirements.txt
Then, simply start the bot:
./main.py
You will not see any output, but when you check the logs/
directory, you should see some log files. The bot should be also connected to your TeamSpeak server. Right now, it's just not doing anything as no plugin is configured yet.
You can stop the bot by aborting the above command using the key combination Ctrl
+C
.
If you want to run it like this, simply run the following command to put the process into the background:
./main.py &
This way you ensure, that the bot automatically starts when your system boots and that it automatically restarts, when it crashed due to whatever reason.
The following instructions were tested on Linux Debian 11 (Bullseye).
- Create a Linux user:
useradd tsbot
- Install the
teamspeak-bot.service
file from this repository:cp teamspeak-bot.service /etc/systemd/system/
- Ensure, that the permissions are correct:
sudo chown root:root /etc/systemd/system/teamspeak-bot.service
sudo chmod 0777 /etc/systemd/system/teamspeak-bot.service
- Adjust the following systemd unit options, if necessary:
User
: The user, under which your bot should run (see step 1).Group
: The group, under which your bot should run (see step 1).After
: Add your TeamSpeak server systemd unit, when it is running on the same server as systemd unit.WorkingDirectory
: The installation directory of your bot.ExecStart
: The installation directory of the Python virtual environment.
- Reload systemd:
sudo systemctl daemon-reload
- Enable the systemd unit:
sudo systemctl enable teamspeak-bot.service
- Start the systemd unit:
sudo systemctl start teamspeak-bot.service
Further commands:
- Stop bot:
systemctl stop teamspeak-bot.service
- Restart bot:
systemctl restart teamspeak-bot.service
Next, checkout the configuration, if you haven't yet.