Discord bot#

Game Master is the guild’s Discord bot, built with discord.py. It posts events and takes sign-ups, hands out roles based on the website, awards chat levels and badges, and moderates the server.

The bot never opens the database. It talks to the website’s API only over HTTP, with a shared key (the X-API-Key header). Anything it remembers lives on the website.

Main parts#

Folder

What’s in it

src/sidequest_bot/plugins/

One file per feature: events, roles, levels, moderation, and so on. See How it works.

src/sidequest_bot/api_client.py

The only code that calls the website’s API.

src/sidequest_bot/lib/roles.py

Guards every role grant and revoke; see How it works.

src/sidequest_bot/assets/role_icons/

The badge, level and gate role images.

tests/

Boots a real copy of the website’s API in-process for each test, so tests check real request and reply shapes.

        flowchart LR
    Discord <-->|gateway + REST| Bot["bot<br/>discord.py plugins"]
    Bot -->|"/api/guilds/... + X-API-Key"| API["website: api/<br/>Litestar backend"]
    

Pages#