The official implementation of code guessing.
- Ensure Python 3.10 or higher is installed
- Install packages from
requirements.txt - Copy
config_stub.pytoconfig.pyand fill it out:- Use some method such as
secrets.token_bytesto generate random bytes forsecret_key - Make an application in the Discord Developer Portal
- Copy the application ID for
app_id - Copy the client secret for
client_secret - Add a redirect in
OAuth2 -> Generalof the formhttps://my.site/callback
- Copy the application ID for
- Set
log_fileto a filename - Set
canonicalto the canonical base URL of the server (like"https://my.site") - (Optional) Set
canon_urlto the URL to your Canon server (see below) - Add the IDs of people allowed to use the admin panel to
admin_ids, or setadmin_ids = "canon"to use the same set as Canon ifcanon_urlis set
- Use some method such as
- Create a SQLite database called
the.dband runschema.sqlin it - Serve the WSGI application
cg:appwithgunicornor similar
A running Canon server is required for the following features:
- Commenting under anonymous names
- Getting notifications from comments
- Blocking anyone not in a certain server from submitting entries
- Sending you a notification when everyone has pressed the "finished" button during stage 2
- Acting as a Discord bot providing the
!anonand!cgcommands
To run Canon, clone the repository, copy config_stub.py to config.py and fill it out:
- Set
log_fileto a filename - Set
tokento a Discord bot token (perhaps the one of the application made earlier). Without doing this, anonymous personas will still work, but Discord-specific features will not - Set
guild_idto the ID of the Discord server being played on (only iftokenis set) - Add your ID to
admin_idsor set it to a role ID (only iftokenis set) - Set
cg_urlto the canonical URL of your code guessing server
It is a Flask application just like cg-site, and can be run in the same way. Do not expose the server to the Internet! It should only be accessible from the machine that cg-site is running on.
Once Canon is running, be sure to set canon_url in cg-site's config to the URL it is exposed under, without a trailing slash.