Bot developed as a tool for SA-SEL's Discord server.
git clone [email protected]:sa-sel/discord-bot.git
cd /path/to/discord-bot/
pip install -r requirements.txt
- Provide your config
python src/main.py
You must provide your own Google Sheets API's credentials variables (or file) as well as your Discord token, spreadsheet key and MongoDB Atlas URI. The data may be provided as a credentials.json
and .env
on the project's root directory or as Heroku config variables (if you're hosting in Heroku, see image below).
If you don't know how to get Google's API credentials, watch this video.
The .env
file should be as follows:
DISCORD_TOKEN =
SPREADSHEET_KEY =
MONGODB_ATLAS_URI =
Heroku's config variables should be set as follows:
You must create a discord application in here and a bot inside it. The token needed is the bot's token, not the application's - it can be found in https://discord.com/developers/applications/<APPLICATION ID>/bot, as can be seen in the image below.
Get it from the spreadsheet's link: https://docs.google.com/spreadsheets/d/<SPREADSHEET_KEY>. You must share the spreadsheet with your bot's email (from the Google Sheets API, it should be specified in your credentials.json
).
We're mainly using pydocstyle
and flake8
for linting. Download and configure their extensions/enable their functionality in your IDE - e.g.: for VSCode, see this video.
We're using black
and isort
for autoformatting. Download and integrate them to your IDE - e.g.: for VSCode, see this post. Important, do not add custom args to black
.
Write commit messages following this style guide and be sure to make use of git commit --amend
and --no-edit
when necessary. Write commit message that actually describe (summarize) the changes you made - do not commit stuff like Fix bug
, Fix
, Fix bug 3
, Fix bug (again)
.
Aside from that, start all your commit messages with #<TASK_NUMBER> -
. e.g., when working on the task #7
, you commit the creation of the >choose
command: #7 - Create >choose
.
- Clone the repo
- Choose a task to work on in the board
- The task must be in the 'To do' column and without assignees
- Cheque se a task sem alguma dependência e, se sim, se elas já foram concluídas
- Give preference to tasks with higher priority
- Assign the task to yourself and move it to the 'In dev' column
- Create a new branch from
dev
(new branch's name should follow the patterntask-<TASK_NUMBER>
) - Make all your changes in this new branch
- Merge the
dev
branch into yoursgit fetch --all
git merge origin dev
- Resolve all the merge conflicts
git commit
(keep the default commit message)
git push --set-upstream origin task-<TASK_NUMBER>
- Make a PR to
dev
and move the task to the 'Waiting merge' column- Your PR's title should be
#<TASK_NUMBER> - <TASK_NAME>
- Your PR's title should be
- Only merge your PR when:
- It has at least two approves
- All builds were successful
- There's no merge conflicts
The spreadsheet must have a sheet named commands
and a sheet named triggers
with the specifications below.
It must have the following columns:
- COMMAND CATEGORY
- COMMAND NAME - can't contain whitespace
- COMMAND ALIASES
- Multiple aliases should be separated by a linebreak (Alt + Enter);
- Do not include the command name.
- RESPONSE TEXT - the reply's text content
- RESPONSE IMAGE
- Public links to the reply's image contents;
- Maximum of 10 images, separeted by linebreaks;
- The links should go directly to the images.
- TTS - if that command should be read by discord's text-to-speech
- REPLY - if the response should be sent as a reply rather than a normal message
It must have the following columns:
- TRIGGER
- Message content that will trigger the reply;
- Not case-sensitive;
- Multiple triggers should be separated by a linebreak.
- RESPONSE TEXT
- RESPONSE IMAGE
- TTS
- REPLY
It was designed to be in a Heroku dyno, but you may do it however you prefer.
The >codenames
command uses Selenium and to make it work with Heroku, you must add the following buildpacks to your app.