Robot Kirby is a Discord bot that can imitate specific users, channels, or servers, based on a Markov chain model.
Users must opt in for their data to be collected using the /opt in command.
Robot Kirby uses Hikari and Tanjun for interacting with the Discord API, MongoDB as a database, and Markovify for the Markov chain model.
Credit to Amelia for the idea for the /timedensity command! The /rankedopinion command was written by Amelia and the /similarity command was written by Jenna.
Make a file called .env in the root directory with the following contents:
DISCORD_TOKEN=<your token from the Discord API developer portal>
Then, start the Docker containers:
docker compose up
- Required scopes:
bot,applications.commands. - Gateway intents (Developer Portal → Bot → Privileged Gateway Intents):
- Message Content
- Presence
- Server Members
- Guild permissions (when inviting):
- View Channels
- Send Messages
- Attach Files
- Embed Links
- Read Message History
This repo uses GitHub Actions to enforce code quality on every PR and push to master:
- Formatting:
ruff formatthenruff check --fix(fails if changes are needed). - Type checking:
pyright.
You can run the same checks locally with uv.
uv is a fast Python package and environment manager from Astral.
- macOS/Linux (script):
curl -LsSf https://astral.sh/uv/install.sh | sh - macOS (Homebrew):
brew install uv
After installing, restart your shell so uv is on your PATH.
Task is a simple task runner used by Taskfile.yml for common dev commands. Install it if you want to use the provided tasks:
- macOS (Homebrew):
brew install go-task - macOS/Linux (script):
sh -c "$(curl -sSL https://taskfile.dev/install.sh)" -- -d
Verify: task --version
From the repo root:
-
Create a virtual environment:
uv venv -
Activate it:
source .venv/bin/activate -
Install dependencies (including dev tools like Ruff and Pyright):
uv sync --group dev
- Format and autofix:
uv run ruff format && uv run ruff check --fix - Type check:
uv run pyright - Lint only (no fixes):
uv run ruff check
If you use Taskfile (optional), the following are equivalent:
task format→ runs Ruff format and autofixtask typecheck→ runs Pyright for type checking