← Back to Projects

leptons1618@anishgiri.dev:~/projects/quark cat project.toml

Other 2022 Active development

Quark

A Discord bot that plays Akinator — you think of a character, it asks twenty questions and guesses. Five Python files and a Heroku worker.

category
Other
year
2022
status
Active development
stack
5 tools
highlights
6
write-up
3 min read

01Highlights

  1. Wraps the `akinator.py` elimination library in a `discord.py` cog, so the bot's own logic is only the conversation.
  2. Loops on the library's `progression` rather than a fixed question count, ending when Akinator is confident instead of on a schedule.
  3. Four-way input — yes, no, probably, and back — which is what makes walking a question back possible at all.
  4. Each question posts as an embed with a zero-padded counter, so a long game stays scannable in a chat feed.
  5. Two independent cogs share one client, so the small chatbot command cannot take the guessing game down with it.
  6. Runs as a Heroku `worker` on Python 3.8.12, since the Discord gateway is the only way in.

02Built with

  • 01Python
  • 02discord.py
  • 03akinator.py
  • 04discord-components
  • 05Heroku

03Case study

September 9, 2026 3 min read 425 words

Quark — A Discord Bot That Guesses What You Are Thinking Of

Five Python files, one library doing the real work, and all the difficulty in the Discord-shaped part.

The problem

Akinator's elimination algorithm is a solved problem with a published Python package, so the interesting question was never the guessing. It was how to drive a stateful question-and-answer loop inside a Discord conversation, keep twenty questions legible in a chat feed, and ship a long-lived bot process without a web server anywhere in it.

The solution

Wrap the `akinator.py` package in a `discord.py` cog that owns only the interaction. The library decides when it is confident enough to guess; the bot keeps asking until it does, reading four possible answers — yes, no, probably, and back — from a list membership test. Two cogs load into one client, the game and a much smaller hosted-chatbot command, and the whole thing deploys as a Heroku `worker` because the only way in is the Discord gateway.

Outcomes

  • Drives the `akinator.py` elimination library from inside a Discord cog, so the bot's own logic is just the conversation.
  • Loops on the library's `progression` rather than a fixed question count, so the game ends when Akinator is confident rather than on a schedule.
  • Four-way input handling — yes, no, probably and back — which is what makes `b` (go back a question) possible at all.

+3 more in the write-up

Inside the write-up

  1. This is a small project, and that is the honest framing
  2. The whole game is a library call
  3. Two cogs, one bot
  4. Deployed as a Heroku worker
  5. What I would fix first
Read the full case study →

Related projects