Total Files
274
Python source files
Bot Commands
18
Slash commands
Items
70+
Across 5 categories
Rooms
60+
Encounters & scenarios
What It Is

Roguelike RPG via Telegram

RogueBot is a fully-featured dungeon crawler game delivered entirely through a Telegram bot interface. Players interact by pressing reply-keyboard buttons — the bot generates story text, combat choices, item actions, and NPC dialogue as messages. There is no external UI; the game loop runs entirely in chat.

Dual Platform Support

The project ships with two separate entry points: main.py for Telegram (via python-telegram-bot) and main_vk.py for VKontakte. There is also an main_alice.py for Yandex Alice integration. All share the same game engine and user/room/item code.

Persistent State via Pickle

Each player's state (HP, MP, gold, inventory, current room, gods level, missions, buffs, pets, costume, variables) is serialized to a .usr file using Python pickle. A MongoDB database (via pymongo) stores global state: leaderboards, boss state, tournament data, and shared variables. Previously TinyDB, migrated to MongoDB in the EN modernization build.

Game Loop Summary

On /start, a new player character is created. The player enters the corridor and can open a door (random room), pray to a god, visit the shop, check inventory, or manage levels. Each room encounter resolves via text choices and dice rolls. Death records to the leaderboard; players can reborn. Bosses are shared global events updated by a background job.

Tech Stack

python-telegram-bot

main.py

Telegram integration layer. Updated to PTB v13 — CommandHandler and MessageHandler now use (update, context) callback signature. Background tasks use JobQueue.run_repeating(). No deprecated @run_async or Job() constructor.

MongoDB (pymongo)

databasemanager/__init__.py

MongoDB database for global state. Stores leaderboards, boss HP, tournament brackets, and shared variables. Replaced TinyDB/mongothon. Requires mongod running locally. Uses native pymongo update_one(upsert=True) and aggregate().

Pickle User State

usermanager.py · user/

Each player serialised as a User object pickled to users/<uid>.usr. Supports VK users (prefixed vk) vs. Telegram users.

Botan Analytics

botan.py · statistics.py

Optional Botan.io integration for tracking user events and generating referral links via /rate. Gracefully skipped if token absent.

python-telegram-bot v13 Migration

Handler Signature: (bot, update)(update, context)

All command and message handlers in main.py were rewritten to use the PTB v13 callback-style signature (update, context). The old positional (bot, update) pattern was removed from every handler function. context.bot is now used instead of the free bot parameter.

Job Queue API: Job()JobQueue.run_repeating()

The legacy Job(divine_intervention, 3*60*60.0) + updater.job_queue.put() pattern was replaced with jq.run_repeating(divine_intervention, interval=3*60*60, first=10). All three background jobs (divine intervention, tournament update, queue reply) now use the modern PTB v13 API. The @run_async decorator was removed entirely — deprecated and unused in v13.

Database: TinyDB + mongothon → MongoDB (pymongo)

mongothon Removed — Dead Package

mongothon3 was a dead PyPI package that caused import failures on install. All three model files (leaderboard_model.py, variable_model.py, lists_model.py) were rewritten using plain pymongo with native find_one, update_one(upsert=True), and insert_one calls.

Death Aggregation: .group()$group Pipeline

The deprecated MongoDB collection.group() call in leaderboard_model.py was replaced with a proper aggregate() pipeline using $match, $group, $sort, and $limit. This is the correct approach for pymongo 4.x.

Bug Fix: add_to_list() Wrong Variable

The original databasemanager/__init__.py called Lists.add_to_list(name, val, force) — passing the undefined local name val instead of the parameter value. This caused a silent NameError on all list additions. Fixed.

Import System: impimportlib

itemloader.py and roomloader.py — Replaced Deprecated imp

Both dynamic module loaders used imp.load_source() and imp.load_compiled(), which were deprecated in Python 3.4 and removed in Python 3.12. Replaced with importlib.machinery.SourceFileLoader / SourcelessFileLoader and spec_from_file_location + module_from_spec. Also replaced the deprecated room_loader.load_module() call with spec.loader.exec_module(mod).

Logging: logger.warn()logger.warning()

Python 3.12 Compatibility

logger.warn() was deprecated since Python 3.2 and removed in 3.12. All occurrences across main.py, itemloader.py, roomloader.py, and localizations/locale_manager.py were updated to logger.warning().

Requirements & Removed Dead Packages

requirements.txt — Pinned to Modern Versions

Dead and incompatible packages removed: mongothon3, vk_api, codecov. Replaced with pinned working versions: python-telegram-bot==13.15, pymongo==4.6.1, tinydb==4.8.0, requests==2.31.0, tweepy==4.14.0, sortedcontainers==2.4.0.

English Locale

New localizations/en.json + config.LANG = 'en'

A complete English locale file (en.json) was created with all 80+ game strings, UI labels, combat messages, god dialogues, shop receipts, and inventory labels. The config now defaults to LANG = 'en'. All inline hardcoded Russian strings throughout main.py, tornamentmanager.py, usermanager.py, and all 274 room/item/user files were translated to English.

Syntax Verified

Zero Syntax Errors Across All 274 Files

Every .py file in the project was verified with ast.parse() after translation. Four apostrophe-in-single-quoted-string errors discovered during translation were fixed. Final check: python3 -m py_compile on all core modules passed clean.

Request Flow
00

Locale Strings

All game text is loaded from localizations/en.json via locale_manager.get(key). The config value LANG = 'en' routes to the English file. Buttons, death messages, shop text, and combat replies are all resolved at runtime from this single source — making the bot fully internationalizable without code changes.

01

Telegram Message Received

main.py receives a message via start_polling(). A reply() closure is constructed that enqueues outgoing messages into a deque. This prevents Telegram 429 rate-limit errors via a 35ms dispatch job.

02

Command or Message Routing

Slash commands (/start, /leaderboard, etc.) are routed via CommandHandler. All other text goes to msg()usermanager.message()user.message() state machine.

03

User State Machine

The User.message() method dispatches based on self.state: name, name_confirm, first_msg, corridor, pray, shop, inventory, room, dice, pet, reborned, or restart. Each state calls a definition method imported from user/ sub-modules.

04

Room Loading

rooms/roomloader.py dynamically imports the room Python module by name and level. Each room class has an enter() method and optionally make_damage(), escape(), won(), and item interaction hooks.

05

Item Loading

items/itemloader.py loads items from items/good/, items/bad/, items/loot/, items/neutral/, and items/pets/. Items define on_use(), on_fight(), on_corridor(), on_shop(), get_damage_bonus(), and stat fields.

06

State Persisted

After every operation, usermanager.save_user(usr) pickles the modified User back to disk. Global state (boss, leaderboard, tournaments, shared vars) is written to MongoDB via databasemanager using pymongo with upsert writes.

Module Map

main.py

Entry point — Telegram

Rewritten for PTB v13 callback-style handlers ((update, context) signature). Replaced legacy Job()/run_async with JobQueue.run_repeating(). Manages message queue to avoid Telegram 429 errors.

usermanager.py

Player persistence layer

CRUD for User pickle files. Provides get_user, save_user, new_user, delete, random_user, and helper wrappers called by main.py handlers.

user/

14 definition files

User class mixin-imports: corridor, death, fight, gods, inventory, items, levels, meet, missions, money, pets, room, save, shop, stats. Each file is imported directly into the User class body.

rooms/roomloader.py

Dynamic room importer

Resolves room by (level, type, name) → Python module path, imports it, and instantiates the room object. Supports default and vietnam zone packs.

items/itemloader.py

Item registry

Loads all item classes, builds the shop pool (4 random items per visit), and provides load_item() and load_shop_items().

databasemanager/

TinyDB wrapper

Provides get_variable, set_variable, get_leaderboard, add_to_list, and leaderboard model for rooms and deaths.

bossmanager.py

Global boss state

Manages the shared world boss (one at a time). Boss respawns after 1 hour. Six possible bosses with varying HP pools (49k – 575k) and coin rewards.

tornamentmanager.py

PvP tournament engine

Players sign up via the Coliseum room. When 10+ players queue, a tournament starts. Every 10 seconds damage is exchanged round-robin until one player remains. Winner receives 10–20k gold.

User State Values
State Description ────────────────────────────────────────── name Waiting for player to type their name name_confirm Bot suggests a variant name; player confirms first_msg Introduction narrative, first door prompt corridor Between rooms; main action menu pray Choosing a god to pray to shop Browsing the Alchemist's Shop inventory Viewing / managing item inventory room Inside an active room encounter dice Rolling dice (fight or room event) pet Managing a pet companion reborned Character died; showing death narrative restart * Confirming character deletion
RogueBot-master/
Total Commands
18
Registered handlers
Public
6
Any player
Moderator
6
MODERS_IDS only
Admin
6
ADMINS_IDS only
Public Commands
Moderator Commands
Admin Commands
Voting Commands
Combat Actions
👊

Hit with your hand

Physical attack. Damage = user.get_damage() (base 10 + item bonuses + pet bonus) + get_damage_bonus() (dice roll / item procs). The most reliable option.

🔮

Conjure a blow

Magic attack. Costs 5 MP. Damage = get_mana_damage() (base 0 + staff/amulet bonuses). Low damage early; scales with mage items. Fails if MP < 5.

Use: Imagination

Triggers a dice roll. On a high roll, deals dice_result + damage_bonus // 2 damage. Adds creative chaos — the dice result is between 1 and 32 (DICE_MAX).

Use: <Item Name>

For any fightable=True item in inventory. Each item defines its own get_damage_bonus(user, reply) method with unique effects — the Scroll of a Thousand Lightnings does 1800+ dmg on wet enemies; the AK-47 grants flat bonus shots.

🏃

Escape

Attempt to flee. Some rooms allow escape; others trap the player. Escape success may depend on charisma, items, or room-specific logic. The Scroll of Flash guarantees escape.

Stat Formulas
damage_total = base_damage(10) + Σ item.damage + pet.damage damage_bonus = Σ calc_bonus(item.get_damage_bonus(), count) + Σ buff.damage_plus + pet.damage_bonus mana_damage = Σ item.mana_damage + buff.mana_damage defence = base_defence(1) + Σ item.defence + Σ buff.defence gold_bonus = Π item.gold_bonus^count × Π buff.gold_bonus × pet.gold_bonus charisma = base_charisma(0) + Σ item.charisma calc_bonus(b, cnt) = b × (1 + log(cnt) / 0.79) # stacking logarithm
Dice System

Dice Roll (1–32)

A dice roll is requested by the game and the player must press the 🎲 Throw button. The result (1–32) modifies outcomes in combat, room events, and special encounters. Items like the Storyteller's Die grant bonus results. The result threshold DICE_MIDDLE = 16 separates success/fail in many checks. SMART_LEVEL = 10 and DUMMY_LEVEL = -10 gate intelligence-based checks.

Divine Intervention (Background Job)

Every 3 Hours — For All Players

A background job fires every 3 hours for all active Telegram users. Gods may grant: full MP restore (Buddha), a wine item (Jesus), full HP restore (Allah), a special room preview (Author), or the Iron Halo buff (God-Emperor). This replaces the prayed flag and delivers blessings passively.

Usual Rooms — Default Zone
Apple Tree
apple_tree.py
Chest
chest.py
Clairvoyance
clairvoyance.py
Commissar
comissar.py
Destiny Book
destiny_book.py
The Devil
devil.py
Dog
dog.py
Door
door.py
Dumbledore's Office
dumbledore_office.py
Exit
exit.py
Fog Door
fog_door.py
Frog
frog.py
Gideon
gideon.py
Gnome
gnome.py
The Goal
goal.py
Haircutter
haircutter.py
Leprechaun
lepricone.py
Librarian
librarian.py
Lucifer's Bank
lucifer_bank.py
Luck
luck.py
Musclelot
musclelot.py
No Sudden Movement
no_sudden_movement.py
Nothing
nothing.py
Orc Shop
orc_shop.py
Rick & Morty
rick_and_morty.py
River
river.py
Roulette
roulette.py
Sensei
sensei.py
Shaolin Monastery
shaolin_monastery.py
Slender
slender.py
Some Player
some_player.py
Spanish Girl
spanish_girl.py
Troll Bridge
troll_bridge.py
Uncle Stanley
uncle_stanley.py
Vegan
vegan.py
Vladislav
vladislav.py
Watches
watches.py
Water
water.py
Witcher
witcher.py
Caesar (Tournament)
cesar.py
Callback
call_back.py
Special Rooms
Bill Cipher
bill_cypher.py
Bill Gates
bill_gates.py
Gabe Newell
gabe.py
Ice Cream Lake
icecream.py
Kiba
kiba.py
Hideo Kojima
kodzima.py
Leftovers
remains.py
Treasury (Rickrolled)
rick_astley.py
Crossroads (Sign)
sign.py
Catapult Room
stone_room.py
Something from Below
the_thing_from_below.py
Coliseum (Tournament)
tornament.py
Yegorf1
yegorf1.py
Halloween Shop
helloween_shop.py
Vietnam Zone — Missions
Caravan (multi-part)
missions/caravan/
Leprechaun Quest
missions/lepricone/
Main Mission (3 parts)
missions/main/
Tips Tutorial
missions/tips/
Trap
usual/trap.py
River (Vietnam)
usual/river.py
Easy Tier
NameHPDamage RangeNotes
Rat202 – 4Basic starter enemy
Slug (Slime)300 – 3Almost harmless; drops slime
Flying Rat (Bat)155 – 7Fast; drops bat wing
Grass120 – 0Does zero damage; comedic
Minion231 – 4Banana makes him confused
Duck (Fire)105 – 7Fire duck; bread interacts
Spirit101 – 5Disembodied; low threat
Zombie200 – 2Slow; minimal damage
Sylphide257 – 14Air element; moderate
Werewolf3515 – 23Highest-damage easy mob
Archmage (past)5015 – 20Magic-heavy; tough for tier
Unnatural Seven-Legged5015 – 30Dragon Slayer does extra dmg
Medium Tier
NameHPDamage RangeNotes
Bear7015 – 30Solid mid-tier fighter
Dipper603 – 8Gravity Falls reference; low dmg
Ghoul1015 – 35Glass cannon; glass HP, nasty atk
Internet Troll10010 – 20Tanky; charisma-based interactions
Knight17030 – 40Drops helmet/sword/shield loot
Mimic (Box)5050 – 50Always hits for exactly 50; surprise
Mirror10 – 0Special mechanic; reflects player
Nazgul10010 – 15LotR enemy; steady damage
Promoter10015 – 17Ad-man; charisma mechanics
Rabbit2501 – 3Monty Python ref; huge HP, tiny atk
Mechano Turtle20010 – 12Armored; high HP
Long-Haired Brunette12016 – 18Chewbacca reference
Group of Bandits40030 – 60High threat; multiple enemies
Hard Tier
NameHPDamage RangeNotes
Basilisk13516 – 25Drops basilisk tooth
Dark Lord1,00020 – 25"Must be a fierce guy" — source code
Jason Voorhees10015 – 30Horror icon encounter
Orc13020 – 40Standard hard-tier brawler
Vaper8010 – 20Vape-themed; special interactions
Vietnam Zone Enemies
NameHPDamage RangeNotes
Bush (Soldier)28020 – 35Guerrilla enemy; camouflaged
Hippie20040 – 50Surprisingly dangerous
Vietnamese Army1,50040 – 70Elite; highest base HP non-boss
Special / Boss-Room Monsters
NameTypeNotes
DragonbossDragon Slayer does bonus damage
Doctor Who MonsterspecialLaser Screwdriver interaction
Twi MonsterspecialUses twi_phrases taunts
Kids MonstermiscBeginner-level encounter
Good Items — Beneficial Effects
HP Potion
A test tube with colored liquid. Restores health points.
MP Potion
Colored potion. Restores mana points for magic attacks.
Boxing Gloves
Uncomfortable for a sword, but hit harder and don't hurt your hands!
Scroll of Flash
Guarantees escape from any room. One-time use teleport out.
Save Scroll
Save me! Creates a checkpoint to return to on death.
Novice Mage's Staff
Increases your magic damage by +20 mana_damage. Fightable.
Scroll of a Thousand Lightnings
Deals massive lightning damage — even more on wet enemies (×3.5 mult).
Water Scroll
Soaks the enemy (tag: wet), enabling lightning combos next turn.
Turtle Scroll (Armor)
Temporary defence buff. Wraps you in shell armor.
Super Scroll
Triples your current damage for one hit. Expensive burst.
Seal of Purity
Warhammer 40K litany parchment. +1 defence when worn.
Tin Foil Hat
Protects brain from radiation. +20 defence. Niche but powerful.
Half Death Potion
Fakes player death to escape encounters. Removes item on use.
Golden Sand
Grants a gold bonus buff multiplier per room cleared.
Storyteller's Die
Grants improved dice rolls. Unique Author-themed item.
Rainbow (Psychopast)
Psychedelic item with multi-element aura effects.
Slave Monk Robe
Buddha-theme robe; grants aura buffs when worn.
Cross
Jesus-themed protection item. Repels certain undead-type enemies.
Koran
Allah-themed holy item; provides protection blessings.
Knife
Simple melee weapon. Reliable damage bonus when equipped.
Fork
Comedic weapon. Actually does respectable damage for its cost.
Sand
Throw it in enemies' eyes. Accuracy-reducing item.
Magician's Amulet
+7 mana_damage. Solid early mage item from loot.
B&W Potion (SWP)
Swaps HP and MP values. Situational but powerful.
Bad Items — Cursed / Harmful
Daltonism Potion
Colored potion — induces colorblindness effect on the player.
Chewing Gum
Reduces mana damage if mana_damage is below SMART_LEVEL.
Homeless Potion
Cursed potion. Negative transformation effects on the character.
Wand (Magic)
Unstable magic. May backfire. Unpredictable damage output.
Rat Potion
Transforms player into RAT_RACE — changes available corridor actions.
Scroll of Summoning Stones
Rocks fall from the sky. Deals 50–100 damage to the player.
Stone Potion
"The cobblestone must lie." Triggers reborn with this death message.
Tree Potion
"Trees don't do anything." Another cursed reborn trigger.
Voodoo Doll
Small rag doll. In skilled hands does wonders — actually deals 20–30 self-damage.
Loot Items — Found in Rooms
Dragon Slayer
Bonus damage vs. dragons and quinquepedes. Rare sword.
Frostmourne
Tears flesh and souls. Lich King's sword; premium weapon.
Laser Screwdriver
Doctor Who item. +100 def, +100 atk, +100 mana. The best single item.
AK-47
High damage ranged weapon. Requires bullets. Military loot.
M-16
Vietnam-era assault rifle. Pairs well with the zone theme.
M79 Grenade Launcher
Area damage; uses grenades as ammo. Powerful but slow.
Minigun
Sustained high fire rate. One of the highest DPS loot weapons.
Laser Pistol
Sci-fi ranged weapon. Uses laser bullets as ammo.
Knight Helmet
Tin helmet. Fragile but gives +15 defence.
Knight Sword
Sharp as a feather under the rib. Reliable melee weapon.
Soldier's Helmet
Metal star helmet. +40 defence. Best armour in the game.
Mechmod (Mechmod)
Pants rolled up mechanically. Reduces defence by –20. Trolling.
Yog-Sothoth's Puzzle
Lovecraftian cube. Heartbeat inside. Multi-step puzzle interaction.
Vietnam Star (Ointment)
Universal healing ointment. Said to cure cancer. Restores HP.
Fez
Red with a gold bell. Extremely expensive cosmetic.
Ring
Generic ring. Deals 10–20 self-damage on equip. Cursed.
Neutral Items
Necronomicon
Human-skin book with blood symbols. Powerful but dangerous.
Blank Scroll
Can be written with magic. Interacts with scribing rooms.
PrAtein
Who said jocks are dumb? +20 damage +5 mana_damage.
Wizard Hat
Has "Wizard" inscribed on it. −1 mana_damage. Cosmetic-heavy.
Laser Pointer
Cat-luring device. Minor utility in specific rooms.
Cobblestone
Error 500 stone. Context-dependent description from room state.
Scissors
Deals 1–2 damage to self on use. Very situational.
Waypoint Sign
Points to a special room. Unlocks Sign corridor button.
Pets
Bear
+25 defence. Tanky companion.
Dog
Loyal companion with combat damage bonus.
Fox
Provides support in difficult times. Versatile.
Duck (Fire)
Fire duck companion. Unique room interactions.
Frog
Pokes with a fork. Low damage but funny.
Homeless
A homeless companion. Gold interaction bonuses.

How World Bosses Work

The current boss is stored in TinyDB as a shared variable. Any player can encounter and damage the active boss. Boss HP persists across all players — collective effort is required to kill it. When it dies, its coin pool (randomized per spawn) is distributed. After 1 hour, a new random boss spawns.

Boss Roster
Black Knight
❤️ 129,500 HP
💰 Up to 51,000 coins
Hellkite Dragon
❤️ 175,500 HP
💰 Up to 71,000 coins
Moonlight Butterfly
❤️ 49,500 HP
💰 Up to 21,000 coins — easiest
Naping Dragon
❤️ 77,500 HP
💰 Up to 31,000 coins
Cthulhu
❤️ 575,900 HP
💰 Up to 251,000 coins — hardest
Lich King
❤️ 325,000 HP
💰 Up to 141,000 coins
PvP Tournament

Coliseum — Caesar's Tournament

Players sign up via the Coliseum room (caesar.py). When the queue reaches 10 players, tornamentmanager.start_tornament() fires. Every 10 seconds, all players simultaneously deal their queued damage to the next player in a round-robin. Dead players are eliminated. The last survivor wins 10,000–20,000 gold from Caesar. Attacks are single-use per cycle — players who haven't attacked yet do 0 damage that round.

How Praying Works

From the corridor, players tap 🙏 Pray to God. They choose from their five gods. Each prayer increments gods_level[god_num]. At GOD_LEVEL = 3 threshold, a god_love() blessing fires. Praying too fast triggers the "Not so often" cooldown message. Switching to a different god after committing resets all levels and triggers evilgod() wrath.

The Five Gods
🧘 Buddha
Blessing: Full MP restore
Wrath: "You're lucky Buddhists are calm"
— nothing bad happens (peaceful)
✝️ Jesus
Blessing: Adds wine to inventory
Wrath: Deals 5–10 HP damage. "Jesus got angry and killed your Egyptian children."
☪️ Allah
Blessing: Full HP restore
Wrath: Deals 20–30 HP damage. "Allah does not tolerate mistakes."
📖 The Author (Narrator)
Blessing: Opens special ice cream room
Wrath: Gives intoxicated_shoes item. "I'm in charge here, right?"
⚔️ God-Emperor
Blessing: Iron Halo defence buff
Wrath: EmperorBurn buff (ongoing fire damage). "Doused with promethium."

Default Zone

rooms/default/

The main dungeon. 4 difficulty tiers: easy, medium, hard, expert. Contains 40+ usual rooms, 14 special rooms, and 28 monster types. All players start here in the easy level.

Vietnam Zone

rooms/vietnam/

Unlockable alternate zone with a Vietnam War theme. New monster types (Bush Soldier, Hippie, Vietnamese Army), Vietnam-specific missions (Caravan, Leprechaun, Main mission), and zone-exclusive rooms. Accessed by changing rooms_pack.

Level / Floor System

Multi-Floor Dungeon

Players start on the easy floor. As they progress, new levels unlock: easy → medium → hard → expert. The corridor shows ⬆ Go Upstairs and ⬇ Go Down buttons when adjacent floors are available. When changing floors, the bot displays a scraped list of room names found on that floor (a "someone scratched it on the wall" narrative). Each floor has its own monster pool weighted to its difficulty.

Mission System

Three Concurrent Missions

On character creation, three missions are initialised: main (story), tips (30-room tutorial path), and caravan (20-room side quest). Missions are stored as a stack per player. get_last_mission() returns the active one; pop_mission() completes it. Mission rooms are gated and progress through multi-part scripted encounters in rooms/vietnam/missions/.

Prerequisites

Python 3.10+

Minimum required

The bot uses Python 3.10+ syntax and type constructs. Tested on 3.10 and 3.11. The importlib.machinery changes and logger.warning() fixes ensure compatibility up to Python 3.12+.

MongoDB

mongod on localhost:27017

A running local MongoDB instance is required. The bot connects to the rogbot database automatically on first run. No schema setup needed — collections are created on first write. Install via apt install mongodb or brew.

Telegram Bot Token

@BotFather

Create a bot via @BotFather on Telegram to get your TELEGRAM_TOKEN. Set in config.py before running. Optionally set ADMINS_IDS and MODERS_IDS as lists of Telegram user ID strings.

pip packages

requirements.txt

All pinned to tested versions. Install with pip install -r requirements.txt. On system Python (Kali/Debian) add --break-system-packages flag. Main deps: python-telegram-bot==13.15, pymongo==4.6.1.

Quick Start
01

Install dependencies

pip install -r requirements.txt — installs all pinned packages. On Kali NetHunter: pip install -r requirements.txt --break-system-packages

02

Start MongoDB

mongod --dbpath ./data/db & — or use the system service: sudo systemctl start mongod. The database will be auto-created as rogbot.

03

Edit config.py

Open config.py and set TELEGRAM_TOKEN = 'your_token_here'. Optionally add your Telegram user ID to MODERS_IDS and ADMINS_IDS for admin commands. Leave Twitter and Botan fields commented out if unused.

04

Create users directory

mkdir -p users — The bot does this automatically, but creating it manually avoids the first-run log message. Pickle user files will be saved here as users/<uid>.usr.

05

Run the bot

python main.py — The bot starts polling. You should see "Bot officially started!" in the logs. Send /start to your bot on Telegram to begin playing.

config.py Reference
TELEGRAM_TOKEN = 'YOUR_BOT_TOKEN' # Required — from @BotFather DATABASE_PATH = 'db.json' # Legacy — ignored in EN build (MongoDB used) USERS_PATH = 'users' # Directory for .usr pickle files LANG = 'en' # Locale: 'en' → localizations/en.json MODERS_IDS = [] # List of str Telegram IDs with mod commands ADMINS_IDS = [] # List of str Telegram IDs with admin commands # Optional — Botan.io analytics # BOTANIO_TOKEN = 'your_botan_token' # Optional — Twitter integration for Twi monster # CONSUMER_KEY = '' # CONSUMER_SECRET = '' # ACCESS_TOKEN = '' # ACCESS_TOKEN_SECRET = ''
Directory Layout After First Run
RogueBot-EN/ ├── main.py ← Entry point ├── config.py ← Your settings here ├── requirements.txt ├── users/ ← Auto-created; one .usr file per player │ ├── 123456789.usr │ └── ... ├── localizations/ │ ├── en.json ← All game strings (English) │ └── locale_manager.py ├── databasemanager/ ← MongoDB wrapper ├── user/ ← User class (14 definition files) ├── rooms/ ← 60+ room encounter modules │ ├── default/ ← Main dungeon (easy/medium/hard/expert) │ └── vietnam/ ← Vietnam zone ├── items/ ← 70+ item modules └── utils/ ← Buffs, costumes, potions, names
Notes for Kali NetHunter / Android Linux

Terminal-First Environment

The bot is fully terminal-compatible — no GUI required. MongoDB can be run via mongod in the background. Use tmux or screen to keep the bot session alive. If MongoDB is unavailable, install via apt install -y mongodb or use a remote MongoDB Atlas URI by patching the MongoClient() call in databasemanager/__init__.py.

Breaking Changes Fixed
FileIssueFix
main.pyPTB v12→v13: (bot, update) handler signatureAll handlers → (update, context)
main.pyDeprecated @run_async decoratorRemoved entirely
main.pyLegacy Job(fn, interval) + .put()jq.run_repeating(fn, interval)
main.pyOld MessageHandler(False, msg)Filters.text & ~Filters.command
itemloader.pyimp.load_source() — removed in Python 3.12importlib.machinery.SourceFileLoader
roomloader.pyimp.load_module() + SourceFileLoader deprecationspec_from_file_location + exec_module
databasemanager/mongothon3 uninstallable dead packageRewritten with plain pymongo
leaderboard_model.pyDeprecated collection.group()aggregate() pipeline
__init__.py (db)add_to_list(name, val) — wrong variable nameFixed: valvalue
All .py fileslogger.warn() removed in Python 3.12logger.warning()
Dependency Changes
PackageOldNewReason
python-telegram-botunpinned13.15Latest stable v13 with context callbacks
pymongovia mongothon34.6.1Direct modern driver; mongothon removed
tinydbunpinned4.8.0Kept as optional; pinned for compat
requestsunpinned2.31.0Pinned for security
tweepyunpinned4.14.0Modern Twitter v2 API support
mongothon3requiredREMOVEDDead package, import error on install
vk_apirequiredREMOVEDVK integration not in EN build
codecovrequiredREMOVEDCI tool, not a runtime dependency
Files Added
FileDescription
config.pyConfiguration template with all keys documented
localizations/en.jsonFull English locale — 80+ game string keys
README_EN.mdEnglish deployment README with setup steps
tests.pyBasic smoke tests for database variable and list operations
All Translated Modules

274 Files — Inline Strings, Comments, Button Labels

Every Python file had Russian inline strings, button labels, story text, NPC dialogue, monster taunts, and code comments translated to English. This includes all 41 usual rooms, 14 special rooms, 28 monster rooms, 6 boss rooms, all mission rooms, 70+ item files, all 14 user definition files, all 3 databasemanager models, all utility files, and the main entry point. The localization JSON captures the 80+ shared UI strings; the remaining room-specific narrative is embedded directly in each module.