A Telegram bot for a political strategy game set in Novi-Sad, Yugoslavia in 1999. Players compete for control over districts, manage resources, interact with politicians, and respond to international events.
- Python 3.10 or higher
- PostgreSQL database (via Supabase)
- Telegram Bot API token
-
Clone the repository
git clone https://github.com/yourusername/meta-game-bot.git cd meta-game-bot -
Create a virtual environment
python -m venv .venv
-
Activate the virtual environment
- Windows:
.venv\Scripts\activate - macOS/Linux:
source .venv/bin/activate
- Windows:
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables
Copy the
.env.examplefile to.envand fill in your credentials:cp .env.example .env
Edit the
.envfile with your Telegram Bot token, Supabase credentials, and admin user IDs. -
Create necessary directories
mkdir -p logs translations
-
Initialize the database
python db_init.py
-
Run the bot
python main.py
- Players compete for control over 8 districts in Novi-Sad
- Control points (CP) determine control level:
- 0-59 CP: No control
- 60+ CP: District controlled
- 80+ CP: Strong control (bonus resources)
- Each district provides different resources based on your control level
- Influence: Used for political actions and gaining politicians' support
- Money: Used for economic actions, can be converted to other resources (2:1 ratio)
- Information: Used for intelligence and reconnaissance
- Force: Used for military/security actions
- Main Actions (ОЗ): 1 per cycle, higher impact
- Influence: Increase control in a district (+10 CP)
- Attack: Reduce enemy control and gain control
- Defense: Protect against attacks
- Politician Influence: Improve relations with politicians
- Politician Reputation Attack: Reduce a politician's influence
- Politician Displacement: Significantly reduce a politician's influence
- Quick Actions (БЗ): 2 per cycle, smaller impact
- Reconnaissance: Gather information
- Information Spread: Publish news/propaganda
- Support: Smaller control increase (+5 CP)
- Kompromat Search: Find compromising information
- Local and international politicians with ideological positions (-5 to +5)
- Relationship levels affect game outcomes:
- 0-30: Hostile - May work against you
- 30-70: Neutral - Limited interaction
- 70-100: Friendly - Provides resources and support
- International politicians can impose effects on the game
- Players can join forces for coordinated attacks or defense
- Resources contributed by all participants are combined for stronger effect
- Each participant receives control points based on their contribution
- Each day has two cycles: Morning and Evening
- Morning deadlines: 12:00, results at 13:00
- Evening deadlines: 18:00, results at 19:00
/start- Begin the game, register as a player/help- Show available commands/status- Show your current game status/map- View the current control map/time- Check current game cycle information/action- Submit a main action/quick_action- Submit a quick action/cancel_action- Cancel your last action/actions_left- Check remaining actions/view_district [name]- Get information about a district/resources- View your current resources/convert_resource [type] [amount]- Exchange resources/check_income- See expected resource income/politicians- List available politicians/politician_status [name]- Get information about a politician/international- View international politicians/collective- Initiate a collective action/join [action_id]- Join a collective action/active_actions- View all active collective actions
/admin_process- Process all pending actions and advance the cycle/admin_generate [count]- Generate international effects
The game uses a PostgreSQL database (hosted on Supabase) with the following main tables:
players: Stores player information and game statedistricts: Contains district information and resource productionpoliticians: Stores both local and international politiciansactions: Records all player actionscollective_actions: Tracks coordinated group actionsresources: Manages player resourcesdistrict_control: Tracks control points in districtscycles: Manages game cycles and deadlines
The bot supports multiple languages:
- English (en_US)
- Russian (ru_RU)
Language selection is done during registration and can be changed later.
- Rate limiting to prevent spam
- Authentication for commands
- Connection pooling and retry mechanisms
- Admin access controls
pytest tests/- Define the feature functionality in the appropriate module
- Update command handlers or callbacks as needed
- Add necessary database functions and tables
- Update internationalization files with new strings
- Test the feature comprehensively
bot/: Bot components (commands, callbacks, states, keyboards)db/: Database interface and SQL filesutils/: Utility functions (i18n, formatting, logging)translations/: Language fileslogs/: Log filestests/: Test cases
This project is licensed under the MIT License - see the LICENSE file for details.