- Runs on Heroku with one dyno.
- Queries Cogitare for the
- Uses a Postgres database for all data.
- Has a
!namegenerator/picker based on real data.
- Also provides
!wordwar, many others.
- Does novel and goal management.
DISCORD_TOKEN=The discord bot token.
RACK_ENV=Currently only used for Bundler loading. Defaults to
DICERE_URL=Point to the Dicere API url.
DATABASE_URL=Points to a Postgres server (defaults to a local server).
DB_SCHEMA=The database schema to use (for namespacing inside a single Postgres instance, defaults to
WOLFRAM_KEY=With a valid Wolfram|Alpha key for the
COMMANDS_WHITELIST=(Optional, useful in dev.) Only loads the comma-separated commands.
Installation & Development
To run locally:
- Create a Postgres database,
- Clone this repo,
- Create a
.envfile with the configuration above in the form
- Install the dependencies:
- Run the migrations:
- Start the bot:
You might need to prefix commands with
The bot needs to be restarted at every change.
The bot was previously a Cinch IRC bot, so has peculiarities from that time.
rake fix to run the lint check and fixer (good to do before pushing).
Migrations timestamped in 2018 are the initial schema (the migration system was established in 2019). When creating a new migration, use today’s date.
After creating a migration, run it with
rake db:migrate, then immediately run
rake db:redo, to test its rollback.
rake console to get a shell with most of the same context as the app. Note
that commands are not loaded automatically.
Name frequency compute thing
Names are loaded in postgres (all-lowercase). Then two views are materialised that compute the score of each unique name. The score is then log-normalised to give a smoother distribution for querying.
The compute was kept as two views instead of inlining to ease inspection.