A Telegram bot that provides humorous predictions with a modular architecture.
- Telegram Bot API token (get it from BotFather)
-
Build the Docker image:
docker build -t vorkybot .
-
Run the container:
docker run -e API_KEY=your_telegram_bot_token -d --name vorkybot vorkybot
-
Set your API_KEY as an environment variable:
export API_KEY=your_telegram_bot_token
-
Start the service:
docker-compose up -d
- Add a new stack in Portainer
- Upload or paste the docker-compose.yml file
- Set environment variables:
- API_KEY: your_telegram_bot_token
- Deploy the stack
/future
command: Get a random humorous prediction (limited to once per 24 hours per user)
You can provide your own predictions file instead of using the built-in ones:
-
Create a text file with one prediction per line
-
Mount this file when running Docker:
# Using docker run docker run -e API_KEY=your_telegram_bot_token -v /path/to/your/predictions.txt:/app/data/predictions.txt:ro -d --name vorkybot vorkybot
With docker-compose, uncomment and edit the volume mounting line:
volumes: - ./data:/app/data - /path/to/your/predictions.txt:/app/data/predictions.txt:ro
-
The bot will automatically use your external predictions file if it exists
The bot follows a modular architecture with separation of concerns:
-
Models: Data structures and business logic
Prediction
: Handles prediction selection from available replies
-
Services: Core functionality providers
CooldownManager
: Manages user cooldown periods for predictions
-
Bot: Telegram integration
VorkyBot
: Main bot class that handles Telegram integration and command processing
This architecture makes the code more maintainable, testable, and follows best practices like dependency injection and single responsibility principle.