pytmbot

🎛️ PyTMBot Command-Line Arguments

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.

🛠️ Arguments

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 & Diagnostic Arguments

--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

📄 Required Configurations

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:

General Bot Settings (Required)

Webhook Configuration (if using --webhook True)

Plugins Configuration (if using --plugins)

Monitor Plugin

Outline Plugin

🚀 Usage Examples

Basic Usage

Development 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

Webhook Mode

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

Plugin-Specific Usage

Monitor plugin only:

python main.py --plugins monitor

All plugins with debug logging:

python main.py --plugins monitor,outline --log-level DEBUG

Utility Commands

Generate authentication salt:

python main.py --salt

Health check:

python main.py --health_check

Docker configuration check:

python main.py --check-docker

🐳 Docker Usage Examples

Standard Docker Run

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

Docker Compose

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

Webhook with Docker

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

🛡️ Security Considerations

Production Deployment

Development

🔧 Process Management

The entrypoint script handles:

📋 Troubleshooting

Common Issues

  1. Docker permission errors:
    python main.py --check-docker
    
  2. Health check failures:
    python main.py --health_check
    
  3. Plugin loading issues:
    • Verify InfluxDB connection for monitor plugin
    • Check Outline API configuration for outline plugin
  4. Webhook connection issues:
    • Ensure reverse proxy is properly configured
    • Check --socket_host setting
    • Verify webhook configuration in config file

📜 Notes

For any questions or further assistance, feel free to check out the PyTMBot documentation or open an issue in the repository.

Happy Botting! 🤖