A Discord bot that provides various utilities and management tools for Assetto Corsa tournaments.
- Posts a weekly poll asking drivers if they will join the next race.
- Records race results and calculates points based on finishing position.
- Maintains a ranking channel, updated by summing points from recent races.
- Picks a random track.
- Lets admins clean up images from the commands channel.
- Renames new members to a 3-letter tag on join.
bot/
├── commands/ # Slash commands (cogs)
├── core/ # Bot setup, config, logging, error handling
├── events/ # Discord event listeners
├── scheduler/ # Scheduled jobs
└── services/ # Business logic
main.py # Entry point
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt-
Go to the Discord Developer Portal and create a new application.
-
In the Bot → Privileged Gateway Intents tab, enable:
- Server Members Intent
- Message Content Intent
-
In the OAuth2 → URL Generator tab, select
botand grant at least the following permissions:- Send Messages
- Manage Messages
- Manage Nicknames
- Read Message History
- Create Polls.
Use the generated URL to invite the bot to your server.
-
Save the token to write it in the
.envfile.
Enable Developer Mode in Discord, then right-click each role/channel and select Copy ID for:
- Admin role
- Driver role
- Poll channel
- Standings channel
- Ranking channel
- Commands channel
Copy .env.example to .env and fill in the values:
cp .env.example .envpython main.py- Create a new file in
bot/commands/, or add a command to an existing file if it fits an existing category. - Define a
commands.Cogsubclass with your command as an@app_commands.command(...)method. - If the cog is in a new file, add a
cog_app_command_errorhandler callinglog_app_command_error, following the pattern used in the existing cogs, so errors are logged consistently. - If the cog is in a new file, register it in the
EXTENSIONSlist inbot/core/bot.py.
Add the job to bot/scheduler/jobs.py, following the pattern used by start_scheduler, and register it with the scheduler.add_job(...) call.
Add a new file in bot/events/ with a commands.Cog using @commands.Cog.listener() for the relevant Discord event, and register it in EXTENSIONS.
This project is licensed under the MIT License. See LICENSE for details.