How to create bot and generate its token?
How to register product and get riot api key?
Python version must be 3.9 or newer
use python3 --version
to check your python version (python --version
on windows)
git clone https://github.com/MBronko/discord_bot
cd discord_bot
python3 -m venv venv
source venv/bin/activate
python3 -m pip install -r requirements.txt
python -m venv venv
.\venv\Scripts\activate
python -m pip install -r requirements.txt
python3 main.py # with venv activated
# or
venv/bin/python3 main.py # with venv deactivated
python main.py # with venv activated
# or
venv\Scripts\python main.py # with venv deactivated
Create SERVICE_NAME.service file in "/etc/systemd/system/" directory
(you will later address the service by the filename used here)
Inside the file put following configuration
[Unit]
Description=My Discord Bot
After=multi-user.target
Conflicts=getty@tty1.service
[Service]
Type=simple
WorkingDirectory=BOT_DIRECTORY
ExecStart=BOT_DIRECTORY/venv/bin/python3 BOT_DIRECTORY/main.py
StandardInput=tty-force
[Install]
WantedBy=multi-user.target
replace BOT_DIRECTORY with absolute path to your bot
i.e. /home/bronko/discord_bot
then run command
sudo systemctl daemon-reload
finally you can use following commands
sudo systemctl status SERVICE_NAME
sudo systemctl enable SERVICE_NAME
sudo systemctl disable SERVICE_NAME
sudo systemctl start SERVICE_NAME
sudo systemctl stop SERVICE_NAME