OpenPOTD is a Discord bot for running PoTW/POTD style competitions with:
- scheduled posting,
- multi-guild support,
- subproblems with marks,
- automatic integer checking,
- manual marking workflows with review threads and buttons,
- rankings and roles.
- Python
3.11+(CI runs on3.11and3.13) - A Discord bot token
- Bot invited with slash-command + message permissions
- Initialize files:
# Windows
init.bat
# Linux/macOS
./init.sh- Create/use a virtual environment, then install dependencies:
python -m venv .venv
# Windows PowerShell
.\.venv\Scripts\Activate.ps1
# Linux/macOS
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt-
Configure
config/config.yml:- add your Discord user ID to
authorised, - set
allowed_guild_idto blank, one guild ID, or a list of guild IDs, - set
posting_timetoHH:MM(or leave blank to disable auto-posting), - keep
allow_local_db_reset: falseoutside local testing.
- add your Discord user ID to
-
Provide token:
- local: put token in
config/token.txt, or - env var: set
DISCORD_TOKEN(or the name configured intoken_env_var).
- local: put token in
-
Start:
python openpotd.pyRun these (slash commands recommended) in each guild:
/init/potd_channel <channel>- Optional
/subproblem_thread_channel <text-or-forum-channel> - Optional
/submission_channel <channel>(manual submissions mirrored to staff) - Optional
/submission_ping_role <role> - Optional
/ping_role <role>(role pinged when posting problems) - Optional
/auto_publish_news true|false
Then create season + problems:
/newseason <name>/start_season <season_id>/add ...for main problems/add_subproblem ...and/link_subimg ...for subproblems
Post immediately with:
/post(today’s scheduled problem),/post_problem problem_id:<id>(specific problem, also creates subproblem threads).
- If a problem has subproblems, users can submit by DM text or
/submit(interactive picker). - Subproblem with
answerset: auto integer check. - Subproblem without
answer: manual review flow. - Manual flow creates mirrored staff review entries with
Claim / Correct / Incorrectbuttons. - Review state persists across bot restarts.
Minimum practical permissions in posting/review channels:
View ChannelSend MessagesEmbed LinksAttach Files(if using images)Create Public Threads+Send Messages in Threads(for subproblem/review threads)Manage Messages(only needed for auto-publish in Announcement channels)
If posting fails with Missing Permissions (50013), check that channel-level overrides did not remove one of these.
Use this repository as a Railway service. Procfile is included:
worker: python -u openpotd.pypython -m unittest discover -s tests -p "test_*.py" -v
python -m compileall -q openpotd.py shared.py cogs testsCI runs automatically on push/PR via .github/workflows/ci.yml.