Running bot locally
- Create a local PostgreSQL database
- Set up the database by running the commands in the
sql_setup.sql
file using your favourite database management software - Copy
.env.example
into a.env
file - Set environment variables
DB_USER
,DB_PASSWORD
andDB_NAME
- If desired, you can set the
DATABASE_URL
environment variable to the connection string containing the username, password, database name, hostname and port instead - Keep
SSL_MODE
set to false when running the bot locally, unless you need it- If
SSL_MODE
is missing from.env
, it will default to using SSL
- If
- If desired, you can set the
- Create Discord application at https://discord.com/developers and add a bot user
- Set the
DISCORD_SECRET
environment variable to the bot token (not the application token) - Set the
GUILD_IDS
environment variable to the id of your server to force Discord to register the commands more quickly - Change the configuration in
constants.py
(optional, only needed for very few features/commands such as setting the current academic year or changing the administrative user) - Install dependencies using
pip install -r requirements.txt
- Run main.py and enjoy
Deploying bot
- Environment variables need to be set for
DATABASE_URL
andDISCORD_SECRET
- If
SSL_MODE
is missing from.env
, it will default to using SSL
- If