So, to install this project:
git clone https://github.com/orenlab/pytmbot.git
cd ./pytmbot
python -m venv .venv
source ~/pytmbot/.venv/bin/activate
pip install -r setup_req.txt
python3 ./setup_bot.py
And follow the wizard’s instructions.
This wizard will generate the necessary configuration file for you:
Files | Assignment |
---|---|
.pytmbotenv | To store bot settings, including tokens, allowed user ID and paths to the Docker and Podman socket |
You can leave the steps with the default settings by simply pressing “Enter”.
To launch a Docker container:
0.0.9
, 0.1.1
, latest
:sudo docker run -d -m 100M \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /root/.pytmbotenv:/opt/pytmbot/.pytmbotenv:ro \
--env TZ="Asia/Yekaterinburg" \
--restart=always \
--name=pytmbot \
--pid=host \
--security-opt=no-new-privileges \
orenlab/pytmbot:latest \
/venv/bin/python3 app/main.py --log-level=DEBUG --mode=prod
alpine-dev
tag:sudo docker run -d -m 100M \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /root/.pytmbotenv:/opt/pytmbot/.pytmbotenv:ro \
--env TZ="Asia/Yekaterinburg" \
--restart=always \
--name=pytmbot \
--pid=host \
--security-opt=no-new-privileges \
orenlab/pytmbot:latest \
--log-level=INFO --mode=prod
# | Logging levels | Note | Args |
---|---|---|---|
1 | INFO |
Balanced logging mode: only the most important information + a short description of errors and exceptions. | --log-level=INFO |
2 | ERROR |
Only errors and exceptions are shown. This can be considered a “quiet” mode. | --log-level=ERROR |
3 | DEBUG |
The most detailed level of logs provides all the information displayed in the previous levels, plus additional details, such as traces and all debugging information. | --log-level=DEBUG |
Please don’t forget to specify your time zone! You can find a list of available time zones, for example, here
Please don’t forget to specify Tag version!
Now everything is ready for you to use the bot. All you need to do is run the /start
command in your Telegram app.
sudo docker logs pytmbot
Alternatively, if the container is running on your workstation, you can use Docker Desktop.