-
Notifications
You must be signed in to change notification settings - Fork 6
Installation
FWidm edited this page May 22, 2022
·
8 revisions
The recommended setup is using docker:
- Install docker & docker-compose
- Clone the repository
- Go to the
instance
folder and copyconfig.example.py
and paste it asconfig.py
in the same folder. - Open
config.py
, create a token as described in https://www.writebots.com/discord-bot-token/ and enter it:
...
# expected format: `token = 'supersecrettoken'`
token = 'supersecrettoken'
...
- Run
docker-compose up
(you can detach via-d
argument) - Verify that the docker container is running via
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
63198779dcf7 poediscordbot_bot "pypy3 main.py" 7 minutes ago Up 6 minutes pobdiscord
- Finished, your bot should be online and ready to go. Feel free to checkout the config file and adapt it to your needs. Afterwards you will have to rebuild with
docker-compose up --build
.
- Simply view log content:
> docker exec -it pobdiscord cat discord_pob.log
2019-12-03 - 17:37:40 discord_pob INFO Starting pob discord bot...
2019-12-03 - 17:37:43 discord_pob INFO Logged in: uname=pob-discord, id=418777295713730570
- Follow the logs with
docker exec -it pobdiscord tail -f discord_pob.log
- Copy logs with
docker cp pobdiscord:/app/discord_pob.log discord_pob.log
- Install Python 3.7+ & Pip3 (
python3.7 -m pip install -r requirements.txt
) - go to the bot directory and install requirements:
pip3 install -r requirements.txt
- see step 3. & 4. above
python3.7 main.py
- bot should start up
Optional use of supervisord
- install via package manager
- add custom entry
sudo vi /etc/supervisor/conf.d/discord-pob.conf
, for me it was:
[program:discord-pob]
command=python3.7 main.py
directory=/home/anon/poediscordbot/
priority=900
user=anon
autostart=true
autorestart=true
- supervisorctl reread
- supervisorctl update
- Log is in the application directory under
discord_pob.log
Make sure you put the config.py
file in the instance folder, the folder should look like this:
$ ll poediscordbot/instance/
total 20
drwxr-xr-x 3 pi pi 4096 May 22 11:05 ./
drwxr-xr-x 8 pi pi 4096 May 22 12:10 ../
-rw-r--r-- 1 pi pi 1237 May 22 10:50 config.example.py
-rw-r--r-- 1 pi pi 1294 May 22 10:52 config.py
drwxr-xr-x 2 pi pi 4096 May 22 11:05 __pycache__/
Make sure to rebuild the docker container docker-compose up --build
or docker-compose down
followed by docker-compose up