Skip to content

bettercallninja/TrumpBot

Repository files navigation

🦅 TrumpBot - Advanced Telegram Battle Bot

⚡ A modern Telegram bot for group-based PvP missile combat 🚀 Built with async Python, PostgreSQL, and bilingual (FA/EN) support


✨ Features

🎮 Core Gameplay

  • 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

💎 Premium Features

  • 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

⚙️ Technical Excellence

  • Async-first: Full async/await implementation
  • Connection Pooling: psycopg-pool for 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

🏗 Architecture

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

🚀 Quick Start

Prerequisites

  • Python 3.8+
  • PostgreSQL 12+
  • Telegram Bot Token from @BotFather

Installation

git clone <repository-url>
cd TrumpBot
pip install -r requirements.txt

Configuration

Create .env file:

BOT_TOKEN=your_bot_token
DATABASE_URL=postgresql://user:pass@localhost:5432/trumpbot
UNLIMITED_MISSILES=false
LOG_LEVEL=INFO

Run

python main.py

For production:

python main.py > bot.log 2>&1 &

🎮 Commands

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

🔒 Security & Performance

  • Parameterized SQL → safe from injection
  • Connection pooling → efficient DB usage
  • Rate-limiting → fair gameplay
  • Graceful degradation → bot never crashes

🛡 Deployment

Dockerfile
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "main.py"]

🤝 Contributing

  1. Fork repo & create branch
  2. Add feature with type hints + docs
  3. Open PR with description

📞 Support

Telegram: @bettercallninja


📜 License

MIT © bettercallninja

About

A fun bot for making your groups alive

Topics

Resources

License

Stars

Watchers

Forks

Languages