Giter VIP home page Giter VIP logo

cms-rrc-bot's Introduction

RRC Bot

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.

Source Files

  • 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.

Getting Emoji IDs

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.

Initial Setup

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.

Deployment (a.k.a. if Ryan gets hit by a bus)

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.

  1. Put a copy of run_rrc_bot.sh into the home directory of a user on the host system.
  2. Run ssh-keygen on the host and copy id_rsa.pub to your GitHub account, or to a fork of this repository.
  3. Run sudo apt install github python3 monit
  4. Copy extras/cms-rrc-bot to /etc/monit/conf-enabled
  5. ssh user@host ./run_rrc_bot.sh
  6. Configure the bot (edit config/ to taste, taking care to copy the sample config to a new config.json, and edit the bot key and all the various IDs to match those on the RRC server.
  7. Run step 4 again. The bot should now be running.

Management and Fault Tolerance

In the event of a crash, the bot will auto-restart itself via monit. To start/restart manually, consult the monit manual

Logging

To see the live status of the bot, run tail -F repo_path/cms-rrc-bot.log

Author and Copyright

(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.

cms-rrc-bot's People

Contributors

rjt-pl avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.