This Discord bot runs the IRR submission and approval functions for the Champion Motorsports Race Review Committee (CMS RRC). It is programmed with discord.py and COGS.
- utils.py: Some smaller utility classes/methods, like to manage json files or make sure only admins can use certain commands.
- cogs/questionnaire.py: All the logic for the questionnaire, that is: questionnaire itself, approving/rejecting/editing answers, sending it to the forum.
- cogs/admin.py: All admin functions (commands).
- logger.py: Custom logger, outputs to STDOUT only.
- main.py: Used to start the bot, loads the config.json file and creates the bot instance.
- bot.py: Bot class.
- extras/run_rrc_bot.sh: Startup script. This wrapper script performs additional functions such as cloning the source code repository and checking for updates.
This is currently only useful for the button label of the Submit Protest
button. Type \:Emoji_Name:
on the server, and it'll print the ID of the
specified emoji.
See (setup.md)[setup.md] for more information on initial setup, including registering a new Discord application. This has already been done and should not be necessary to repeat.
This bot has been deployed on a Linux VPS managed by Ryan Thompson. To re-deploy, kill the old bot first. These instructions assume a Debian/Ubuntu Linux system. It's very possible to deploy elsewhere, but in that case you'll probably want to follow the directions of your bot hosting provider.
- Put a copy of
run_rrc_bot.sh
into the home directory of a user on the host system. - Run
ssh-keygen
on the host and copyid_rsa.pub
to your GitHub account, or to a fork of this repository. - Run
sudo apt install github python3 monit
- Copy
extras/cms-rrc-bot
to/etc/monit/conf-enabled
ssh user@host ./run_rrc_bot.sh
- Configure the bot (edit
config/
to taste, taking care to copy the sample config to a newconfig.json
, and edit the bot key and all the various IDs to match those on the RRC server. - Run step 4 again. The bot should now be running.
In the event of a crash, the bot will auto-restart itself via monit. To start/restart manually, consult the monit manual
To see the live status of the bot, run tail -F repo_path/cms-rrc-bot.log
(c)2023 Ryan Thompson [email protected]
Limited license to David Anderson of Champion Motorsports to use, modify, and deploy this code for non-commercial purposes in conjunction with the Race Review Committee (Stewards) at Champion Motorsports (cmsracing.com).
Any other use is not allowed, unless you receive express written permission from me via email.