⚡ A modern Telegram bot for group-based PvP missile combat 🚀 Built with async Python, PostgreSQL, and bilingual (FA/EN) support
- PvP Combat System: Reply-based attacks with advanced damage calculations
- Weapons Arsenal: Multiple types with unique damage & effects
- Defense Systems: Shields and interceptors with cooldowns
- Level-based Progression: Dynamic XP, levels, and scaling
- Real-time Status: HP tracking, defenses, and cooldown management
- Telegram Stars Shop: Buy premium items with TG Stars
- Medal Economy: Earn rewards via gameplay & activity
- Inventory System: Store & use items with logging
- Daily Bonuses: Keep engagement alive
- Async-first: Full async/await implementation
- Connection Pooling:
psycopg-poolfor PostgreSQL - Bilingual: English + Persian with per-user settings
- Type Hints: Static safety across the codebase
- Error Handling: Robust exception management & user feedback
- Modular Design: Commands, DB, utils, handlers separated
View Code Structure
TrumpBot/ ├── main.py ├── src/ │ ├── app.py │ ├── commands/ # attack, general, status, ... │ ├── config/ # BotConfig, items │ ├── database/ # DBManager with pooling │ ├── handlers/ # event handlers │ ├── utils/ # helpers, translations │ └── __init__.py ├── pyproject.toml └── README.md - Manager pattern for clean game logic
- Dependency injection for flexibility
- Factory pattern for bot creation
- Full type-hints & structured logging
- Python 3.8+
- PostgreSQL 12+
- Telegram Bot Token from @BotFather
git clone <repository-url> cd TrumpBot pip install -r requirements.txtCreate .env file:
BOT_TOKEN=your_bot_token DATABASE_URL=postgresql://user:pass@localhost:5432/trumpbot UNLIMITED_MISSILES=false LOG_LEVEL=INFOpython main.pyFor production:
python main.py > bot.log 2>&1 &| Command | Action |
|---|---|
/start | Welcome & main menu |
/help | Show full help |
/language | Switch EN/FA |
/status | Show player HP & defenses |
/shield | Quick shield activation |
/attack | Attack (reply or weapon select) |
/shop | Buy items |
/inventory | Show & manage items |
/stars | Premium shop (TG Stars) |
/stats | Combat statistics |
- Parameterized SQL → safe from injection
- Connection pooling → efficient DB usage
- Rate-limiting → fair gameplay
- Graceful degradation → bot never crashes
Dockerfile
FROM python:3.11-slim WORKDIR /app COPY requirements.txt . RUN pip install -r requirements.txt COPY . . CMD ["python", "main.py"]- Fork repo & create branch
- Add feature with type hints + docs
- Open PR with description
Telegram: @tellmeninja
MIT © IliyaDindar