Skip to content

Tokens and Environment Variables

Isaac Beh edited this page Jan 5, 2024 · 7 revisions

Here is the full list of tokens and environment variables being used in UQCSbot

Core Bot Functionality

These are required for the bot to function properly in production.

DISCORD_BOT_TOKEN

The token to authenticate the bot with Discord. This can be acquired through the UQCS Discord or you can setup your own bot within the Discord Developer Portal.

POSTGRES_URI_BOT

A URI with username and password to connect to a PostgreSQL database for the bot to use. If none is given, the bot will default to an in memory SQLite database, only recommended if you're not working on commands that need the database.

Examples of valid URIs:

URI Functionality
sqlite:/// Will run as an in memory database and is equivalent to when you don't define it. If you don't need a database, this will be fine.
sqlite:///test.db Will run with the SQLite database in the file test.db. Useful if you need some basic database functionality.
postgresql://uqcsbot:uqcsbot@database:5432/uqcsbot The Postgres URI for if you're running the bot under Docker. This is to simulate how the bot runs in production.

Cog Specific Functionality

These are more specific for some command functionality, and may need to be refreshed periodically.

AOC_SESSION_ID

A user's session id for the Advent of Code cog. The session id expires after 30 days of being generated (at least according to the AOC website; it appears to last longer than this in practise). To generate a session id, you'll need an account that has access to the UQCS Leaderboard (the UQCS Google Account is used for production). To grab this, log into Advent of Code, open developer tools in your browser (F12), navigate to the Application Tab (Chromium) or Storage Tab (Firefox), and find the session cookie value.

HACKATHON_START_TIME HACKATHON_END_TIME

These are the start and end time for the next hackathon (used by the /hackathon command). Use the format YYYY-MM-DD HH:MM. Remember to enclose it in quotation marks given the space in the time format.

MC_RCON_ADDRESS MC_RCON_PORT MC_RCON_PASSWORD

These are for connecting to and managing a UQCS run Minecraft server. These values correspond to the address, port, and password for connecting through RCON to the server. These need to be configured within the server.properties of a Minecraft server for these to work.

SB_BASE_THRESHOLD SB_BIG_THRESHOLD SB_RATELIMIT

The thresholds for the Starboard. Base threshold is the number of emoji reacts that are needed to get a message sent to the starboard, while big threshold is the number of emoji reacts that are needed to get a message pinned in the starboard.

The ratelimit is the number of seconds after being sent/pinned that a message has to wait before it can be sent/pinned again. This prevents react/unreact spam turning into mass sending/deletion/pinning of messages in the starboard.