Contributing to Bot

This project is responsible for maintaining the Discord Bot in our Discord community. Our members and staff rely on it on a daily basis. It adds conveniences for our members when using the community, as well as being a core of our moderation toolkit.

The bot is built with discord.py and has features relying on our site and snekbox projects.

This guide is new and is the process of testing and refinement. If you have any troubles following it, let staff know!

Requirements


Fork the project

You will need access to a copy of the git repository of your own that will allow you to edit the code and push your commits to. Creating a copy of a repository under your own account is called a fork.

This is where all your changes and commits will be pushed to, and from where your PRs will originate from.

For any Core Developers, since you have write permissions already to the original repository, you can just create a feature branch to push your commits to instead.


Development environment

  1. Clone your fork to a local project directory
  2. Install the project's dependencies
  3. Prepare your hosts file (Optional)

Test server and bot account

You will need your own test server and bot account on Discord to test your changes to the bot.

Setup the listed Channels and Roles below in your test server.

Channels

#ot-offtopics (at least one)
#help-0 (at least one)
#bot-commands
#reddit
#dev-log
#mods
#defcon
#mod-alerts
#talent-pool
#big-brother
#mod-log
#user-log
#message-change-log

Roles

@Admins
@Moderators
@Developers (to act as verified role, same as in-server)
@Muted


Configure the bot

You will need to copy IDs of the test Discord server, as well as the created channels and roles to paste in the config file. If you're not sure how to do this, check out the information over here.

  1. Create a copy of config-default.yml named config.yml
  2. Go down to guild: section and add the test guild ID.
  3. Change the channel and role IDs to match the ones in your test server.
  4. Create a webhook in each of #talent-pool and #big-brother and copy the IDs for them into the config file also.
  5. Go down to urls: section, and set site: &DOMAIN "web:8000"
  6. In the same section, set site_schema: &SCHEMA "http://"
  7. Setup the environmental variables listed in the section below.

Environmental variables

BOT_TOKEN=YourDiscordBotTokenHere

Run the project

To run the project, launch the project containers via docker-compose from your project directory.

docker-compose up

Use a local development site

If you're wanting to connect the bot to a local development Site, you will need to:
1. Check the name of your site project folder.
2. Add COMPOSE_PROJECT_NAME=sitefoldername to your bot's .env file using lowercase for the folder name.
3. Start the site project first using docker-compose.
4. Start the bot project next using the following command:

docker-compose up --no-deps bot


Read the Compose Project Names section of the Docker page for a more in-depth explanation on project names.

If you get any Docker related errors, reference the Possible Issues section of the Docker page.


Working with Git

Now that you have everything setup, it is finally time to make changes to the bot! If you have not yet read the contributing guidelines, now is a good time. Contributions that do not adhere to the guidelines may be rejected.

Notably, version control of our projects is done using Git and Github. It can be intimidating at first, so feel free to ask for any help in the server.

Click here to see the basic Git workflow when contributing to one of our projects.

Have fun!