-
Notifications
You must be signed in to change notification settings - Fork 19
Home
Apollo is a Discord bot for the University of Warwick Computing Society. It is designed to augment our Discord server with a few of the user services available on our website.
- Create a new virtual environment
python -m venv venv
. - Activate the virtual environment
- On Linux and macOS:
source venv/bin/activate
. - On Windows:
.\venv\Scripts\activate
- On Linux and macOS:
- Install dependencies
pip install -r requirements.txt
- Copy
config.example.yaml
toconfig.yaml
and configure the fields. - Copy
alembic.example.ini
toalembic.ini
. - Set up the database by running migrations with
alembic upgrade head
.- In production, Postgres is recommended instead of SQLite.
- On the Discord Developer Portal, create your bot and give it member and message content intents.
- Run
python apollo.py
.
-
TODO Update
-
When writing anything that needs to reply to a specific username, please do
from utils import get_name_string
and get the display string using this function, with the discordMessage
object as the argument (e.g.display_name = get_name_string(ctx.message)
). This will return either a discord username, formatted correctly, or an irc nickname depending on the source of the message. Finally, this can be used as normal in a format string e.g.await ctx.send(f'Sorry {display_name}, that won't work.')
. -
When writing a new command, please read in the rest of the message using
*args: clean_content
(seecogs/commands/flip.py
as an example), and if you need it as one large string, use" ".join(args)
. This is instead of reading the whole message content, which will likely break the irc bridging (unless you know what you're doing). -
This project uses the Black Python formatter. Before submitting your code for a PR, run
black .
on the root directory of this project to bring all of your up to spec for the code style guide. -
For testing CI locally, use act-cli.
-
The current production database engine is PostgreSQL. You may wish to use another database engine such as MySQL or SQLite for local testing.
-
To create a DB migration:
- Create model in
/models
- Import in
/models/__init__.py
- Run
alembic revision --autogenerate -m "<change description>"
- Check the newly created upgrade and downgrade is correct
- Upgrade your database with
alembic upgrade head
- Create model in