Setup guide

Self-host Sloth Lee in an afternoon; the hosted bot needs only the invite.

1

Create the Discord application

Open the Discord Developer Portal, create an application, and add a bot. Copy the application id (client id) and the bot token — the token never leaves your machine.

2

Invite the bot

Use the OAuth invite URL with scopes bot and applications.commands. Sloth Lee asks for the permissions it actually needs — nothing server-wide beyond that.

3

Configure environment

Copy .env.example to .env and fill in DISCORD_TOKEN, DISCORD_CLIENT_ID, DATABASE_URL and SECRETS_KEY — a 32-byte AES-256-GCM key (openssl rand -base64 32). The bot refuses to start without them.

4

Start Postgres

docker compose up -d creates a local dev database (user rev, database rev, bound to 127.0.0.1). Any Postgres 16 instance works — point DATABASE_URL at it.

5

Install, migrate, register, run

npm install (generates the Prisma client) → npm run db:migrate (applies committed SQL) → npm run commands:register (registers your slash commands) → npm run dev.

6

Verify and tune

Run /setup status for a server-specific readiness report. Set PORT to get /healthz and /readyz for container hosts like Northflank. Run exactly one bot process per deployment.

Environment variables

The essentials; the repo .env.example documents the full list.

VariableRequiredPurpose
DISCORD_TOKENYes, to run the botBot token. Never commit it.
DISCORD_CLIENT_IDYes, to run or register commandsApplication ID.
DATABASE_URLYes, to run the botPostgres URL.
SECRETS_KEYYes, to run the bot32-byte AES-256-GCM key; encrypts per-guild Ollama keys.
DISCORD_GUILD_IDFor guild command registrationServer snowflake for commands:register.
PORTOptionalEnables the /healthz + /readyz health server for container hosts.
AI_DAILY_REQUEST_CAPOptionalDaily Ollama request cap on new servers. Default 200.

Rather not run anything?

The hosted bot is the same software — invite it, run /setup, done.

Add to Discord