AdventureBot is a Discord bot that powers a turn‑based dungeon adventure. It uses MySQL to store game sessions and data while gameplay logic lives in the game package. The hub package manages server setup and player interactions.
- Python 3.10+
- MySQL server
- A Discord application with a bot token and the necessary intent permissions
Install the dependencies with:
pip install -r requirements.txtEnable the required Discord intents for your application and initialize the database:
python database/database_setup.pyCreate a config.json file in the project root and provide your own credentials. An example configuration is available in
config.example.json. Environment variables will override values found in
config.json:
DISCORD_TOKENMYSQL_HOSTMYSQL_USERMYSQL_PASSWORDMYSQL_DATABASE
If a variable is not provided, the loader falls back to the value in config.json.
A typical configuration looks like:
{
"discord_token": "YOUR_BOT_TOKEN",
"mysql": {
"host": "localhost",
"user": "root",
"password": "password",
"database": "adventure"
}
}The database_setup.py script is needed for successful bot startup and will seed
the database with the same data found in database/dump.sql. You can either run
the script or import the dump to prepopulate your tables:
mysql -u <user> -p <database> < database/dump.sqlStart the bot with:
python bot.pySlash commands such as /adventuresetup will then be available in your server.
Ensure there is a channel named "Adventurebot" in the server you intend on using the bot with and give the bot needed permission if necessary.
Scores are recorded automatically when a session ends. The bot inserts player stats such as play time, enemies defeated, rooms visited and gil into the high_scores table.
Ensure this table exists by running python database/database_setup.py during setup.
From the hub, press the High Scores button to view the leaderboard. Entries are sorted by play time (ascending) and then enemies defeated, but you can also sort programmatically by enemies_defeated, gil or player_level when using the API.