docs/guides/discord-ai-agent.md
This guide connects nanobot to Discord so a Discord user or server channel can talk to your self-hosted AI agent through the nanobot gateway.
discord channel enabled in nanobotnanobot agent -m "Hello!"
python -m pip install nanobot-ai
nanobot onboard --wizard
Install the optional channel dependency:
nanobot plugins enable discord
Create a Discord application, add a bot, copy the token, and enable
MESSAGE CONTENT INTENT in the bot settings.
Merge this snippet into ~/.nanobot/config.json:
{
"channels": {
"discord": {
"enabled": true,
"token": "YOUR_BOT_TOKEN",
"allowChannels": [],
"groupPolicy": "mention",
"streaming": true
}
}
}
Omitting allowFrom enables pairing-only mode. A new user should DM the bot
first, get a pairing code, and be approved before using the bot in servers.
Invite the bot with permissions to read history and send messages.
nanobot channels status
nanobot gateway
Send the bot a DM first. It should return a pairing code. Approve it from a trusted local surface:
nanobot agent -m "/pairing approve ABCD-EFGH"
After approval, mention it in an allowed server channel:
@your-bot Hello from Discord
groupPolicy as mention for first deployment.allowChannels for server channels where the bot should operate.allowFrom only when you want a
static allowlist.allowChannels, and
whether the bot was mentioned.