Discord Bot Integration Guide
This guide will walk you through setting up a Discord bot, obtaining credentials, inviting the bot to your server, and configuring Kesoku to run it.
đ ī¸ 1. Create a Discord Developer Application
To connect Kesoku to Discord, you must register a bot application:
- Navigate to the Discord Developer Portal.
- Click New Application (top right) and name your bot (e.g.
Kesoku Agent). - Go to the Bot tab on the left.
- Click Reset Token and copy the generated token. Store it securely.
- This token will be set as
bot_tokeninconfig.tomlor asDISCORD_TOKENin your environment.
- This token will be set as
âī¸ 2. Enable Gateway Intents
To allow Kesoku to receive channel messages and members lists, you must enable Privileged Gateway Intents:
- In the Bot tab, scroll down to Privileged Gateway Intents.
- Enable the following options:
- Presence Intent
- Server Members Intent
- Message Content Intent (Crucial: Allows the bot to read user prompts)
- Click Save Changes.
đ 3. Invite the Bot to Your Server
Generate an invite URL to add the bot to your target server:
- Go to the OAuth2 > URL Generator tab.
- Under Scopes, check bot and applications.commands (enables slash commands).
- Under Bot Permissions, check the following permissions:
- General Permissions:
Read Messages/View Channel. - Text Permissions:
Send Messages,Create Public Threads,Send Messages in Threads,Embed Links,Attach Files,Read Message History,Use Slash Commands.
- General Permissions:
- Copy the generated URL at the bottom of the page.
- Paste the URL into your browser, select your server, and click Authorize.
đ 4. Configure config.toml
Add your Discord configurations to the [discord] section in config.toml:
[discord]
enabled = true
bot_token = "YOUR_DISCORD_BOT_TOKEN" # Or leave empty to use DISCORD_TOKEN environment variable
chatbot_id = "discord" # Unique chatbot identifier
user_allowlist = ["my_username"] # Optional: allowed Discord usernames or user IDs
# Channel-specific overrides
[[discord.channels]]
channels = ["1234567890", "general"] # Match channel ID or exact channel name
llm = "claude" # Use Claude model in these channels
auto_thread = false # Disable automatic thread creation in these channels
Options Breakdown:
enabled(boolean): Set totrueto run the Discord listener inside the Kesoku daemon loop (kesoku start).user_allowlist(list of strings): If populated, the bot only responds to these specific users. Other users can only trigger responses if they explicitly@mentionthe bot.auto_thread(boolean, default:true): Iftrue, the bot automatically isolates every new session conversation by creating a sub-thread inside the channel. Iffalse, the conversation runs directly inside the channel.