Skip to content

Discord adapter

Configure Discord gateway intents, permissions, sessions, commands, attachments, and response behavior.

  1. Create an application and bot in the Discord Developer Portal.
  2. Under Bot → Privileged Gateway Intents, enable Message Content Intent. mikan requests this intent and cannot inspect ordinary message text without it.
  3. Install the app with the bot and applications.commands scopes.
  4. Grant the bot access required by the channels it will serve: View Channels, Send Messages, Read Message History, Add Reactions, Attach Files, Embed Links, and Send Messages in Threads.
  5. Set the token and start mikan:
Terminal window
export DISCORD_BOT_TOKEN="..."
mikan /path/to/workspace

Channel permission overrides still apply. A successful installation does not guarantee access to every guild channel or private thread.

The adapter handles:

  • messageCreate in DMs, guild channels, and Discord thread channels
  • slash commands: login, session, new, stop, model, and sandbox
  • message attachments

DMs trigger directly. Guild messages normally require a mention, a reply/thread context that mikan handles, or a matching auto-reply policy. Stop commands are checked before the normal trigger gate.

mikan uses resolveChatSessionKey() to isolate shared conversations:

ScenarioConversation/session identity
DMconversation and session use the DM channel ID
Guild top-level messageconversation uses the channel ID; a triggered message is scoped by message ID
Discord thread channelconversation uses the parent channel ID; session is <parentChannelId>:<threadChannelId>
Reply in a shared channelsession is scoped from the referenced/root message ID
Slash commandresolved from the interaction’s channel/thread context

This prevents unrelated guild messages and threads from sharing agent context.

The responder supports Discord Markdown, typing indicators, initial replies, incremental message edits, reply targets, reactions, and file uploads. Long output is split below Discord’s message limit using a 1,900-character target.

Inbound attachments are downloaded into the conversation’s attachments/ directory with sanitized file names before the event reaches the runtime.

Guild slash-command acknowledgements are usually ephemeral; DM commands reply directly.

mikan does not treat voice, embeds, components, polls, or every Discord media/event type as agent input. Thread/channel visibility is limited by the app installation and channel permissions.