The PyTMBot supports several command-line arguments to customize its behavior. Below is a detailed description of each argument you can use when starting the bot.
Argument | Type | Default | Choices | Description |
---|---|---|---|---|
--mode |
str |
prod |
dev , prod |
Select the mode of operation for PyTMBot. Use dev for development and prod for production. |
--log-level |
str |
INFO |
DEBUG , INFO , ERROR |
Set the logging level for the bot. More verbose logs can be helpful during development. |
--webhook |
str |
False |
True , False |
Start the bot in webhook mode. Useful for receiving updates via HTTP callbacks. |
--socket_host |
str |
127.0.0.1 |
N/A | Define the host address for the socket to listen on in webhook mode. Default is localhost. |
--plugins |
str |
"" |
N/A | Specify a comma-separated list of plugins to load. Available: monitor , outline |
--salt |
flag |
False |
N/A | Generate unique salt for using it in TOTP authentication and exit |
--health_check |
flag |
False |
N/A | Perform comprehensive health check and exit |
--check-docker |
flag |
False |
N/A | Check Docker socket access and group configuration, then exit |
--health_check
Performs a comprehensive health check that validates:
Usage:
python main.py --health_check
# or in Docker
docker run orenlab/pytmbot:latest --health_check
--check-docker
Specifically checks Docker-related configuration:
Usage:
python main.py --check-docker
# or in Docker
docker run orenlab/pytmbot:latest --check-docker
Depending on the command-line arguments you choose, certain configuration settings must be filled out in your configuration file. Below are the sections you need to complete:
prod_token
or dev_bot_token
based on --mode
global_chat_id
for notificationsallowed_user_ids
, allowed_admins_ids
, and auth_salt
--webhook True
)webhook_config
section--socket_host 0.0.0.0
when using with reverse proxy--plugins
)url
, token
, org
, and bucket
values in configurationmonitor
section of your configurationapi_url
and cert
paths for the Outline APIDevelopment mode with debug logging:
python main.py --mode dev --log-level DEBUG
Production mode with specific plugins:
python main.py --mode prod --log-level INFO --plugins monitor,outline
Development webhook (with reverse proxy):
python main.py --mode dev --webhook True --socket_host 0.0.0.0
Production webhook:
python main.py --mode prod --webhook True --socket_host 0.0.0.0 --log-level INFO
Monitor plugin only:
python main.py --plugins monitor
All plugins with debug logging:
python main.py --plugins monitor,outline --log-level DEBUG
Generate authentication salt:
python main.py --salt
Health check:
python main.py --health_check
Docker configuration check:
python main.py --check-docker
Production deployment:
docker run -d \
--name pytmbot \
--restart on-failure \
-v /path/to/config.yaml:/opt/app/pytmbot.yaml:ro \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
orenlab/pytmbot:latest --mode prod --log-level INFO
Development with debug:
docker run -d \
--name pytmbot-dev \
-v /path/to/config.yaml:/opt/app/pytmbot.yaml:ro \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
orenlab/pytmbot:latest --mode dev --log-level DEBUG --plugins monitor
services:
pytmbot:
image: orenlab/pytmbot:latest
container_name: pytmbot
restart: on-failure
volumes:
- /path/to/config.yaml:/opt/app/pytmbot.yaml:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
command: --mode prod --log-level INFO --plugins monitor,outline
docker run -d \
--name pytmbot \
--restart on-failure \
-p 8080:8080 \
-v /path/to/config.yaml:/opt/app/pytmbot.yaml:ro \
orenlab/pytmbot:latest --mode prod --webhook True --socket_host 0.0.0.0
--mode prod
for production environmentsINFO
or ERROR
to avoid sensitive information in logs--webhook True
only behind a reverse proxy with proper SSL termination--mode dev
only in development environments--log-level DEBUG
may contain sensitive informationThe entrypoint script handles:
python main.py --check-docker
python main.py --health_check
--socket_host
setting--plugins
For any questions or further assistance, feel free to check out the PyTMBot documentation or open an issue in the repository.
Happy Botting! 🤖