Welcome to the development guide! This is basically a reference sheet to help you through the process of developing Cakebot!
You will need to install dependencies (see section below) before you can start developing, so your IDE can assist you in development.
Note: you may want to create a
virtualenvfirst. If you want to, see the section below.
Please run this in a terminal:
If this fails, check that you have pip installed for your Python version.
Here is how to run the bot in a Virtual Environment (
What provider should I use?
virtualenv instead of
See here for how to do that.
Then, head to here to learn how to create it and activate it.
Run this command:
Starting Bot in Development Environment
The bot is built to work primarily on our server, and because of that, some files may need to be adjusted on your computer.
GitHub API Wrapper
Normally, you will need to not provide a token (used by the
+report command, and its GitHub API wrapper instance), as we aren't publishing our personal access token for @RDILBot for security reasons.
If you really must use it (e.g. for testing), follow this guide to creating a personal access token (make sure you add
repo:public_repo permissions at the very least), then paste the generated token into the "github" field of the "tokens" object in your
You will need to create your own bot here (new application -> build a bot -> create bot) and generate/supply a token (which needs to be pasted into the "discord" value of the "tokens" object in the
You should only run this the first time.
Since we use a database to store some information in, you will need to run this command to create it:
Running the Bot
We have a custom command-line interface for the bot, and so you will need to run it to launch the bot:
To see more commands that are available via the CLI, you can run
python3 main.py --help.
Making New Python Modules
When making new Python modules, please keep the following in mind:
- Please add copyright header to the top of the file before any code.
- Please put it in the
cakebotpackage for organization.
UpperCamelCaseto name it.
Here is the copyright header we require:
To develop the bot, you will need to have a supported Python version installed.
The bot runs on
v3.8.0 in production, so lower version syntax/features can potentially throw errors.
The bot currently does support:
However, we absolutely do not support Python versions older than
3.6.x may work, but is not suggested.
Please see this guide on how to analyze stacks for Python.
If the last line of your stack contains
improper token passed, try these steps:
- Make sure the line of the JSON for the token specifies the right one.
- Check if your bot is already running in any other terminals. It can only run one instance at a time.
If the bot seems to have a performance issue, you can try enabling the profiler to find the issue.
This does require you to have admin access to the bot (your Discord user ID in the
To start profiling, run the command
start-profiler in any Discord channel.
The profiler will start analysis in the background.
To end the profiling session and get results, just run
All recorded results will be outputted to the