Discord Bot Setup for AI Agents
Bring your AI brain into Discord. Create an application, configure a bot, set permissions, and connect it to Claude Code — all without leaving your team's existing workspace.
Why Connect AI Agents to Discord?
Team collaboration
Run your AI agent inside your team Discord server so everyone can ask questions and get answers in shared channels.
Slash commands
Register /ask, /summarize, /generate, or any custom command that routes directly to your Claude agent.
Role-based access
Use Discord roles to control who can trigger expensive AI operations — admin only, specific channels, etc.
Rich embeds
Format AI responses as Discord embeds with headers, fields, colors, and links — much richer than plain text.
Step 1 — Create a Discord Application
Open the Developer Portal
Go to discord.com/developers/applications and click New Application. Give it a name (e.g., "My AI Brain") and accept the terms.
Create the Bot User
In the left sidebar, click Bot. Click Add Bot and confirm. Your application now has a bot user that can join servers and receive messages.
Get the Bot Token
On the Bot page, click Reset Token and copy it immediately. Store it in your environment:
Invite the Bot to Your Server
Go to OAuth2 → URL Generator. Select bot and applications.commands scopes. Then select the permissions below and use the generated URL to invite:
Slash Commands vs Message-Based Interaction
Slash Commands
/ask What is the weather in Paris?- +Discoverable — Discord shows available commands
- +No prefix needed
- +Works in all channels where bot has permission
- –Must register commands via API before use
- –Requires Interactions endpoint URL
Message Events
@MyBot summarize this thread- +More conversational, natural feel
- +Easy to implement with discord.js
- +Works with message content
- –Requires Message Content Intent (privileged)
- –Less discoverable for new users
Connecting to Your AI Brain
The standard pattern: a Next.js API route handles Discord interactions, routes the message to Claude via the Anthropic SDK, and replies to the user within Discord's 3-second acknowledgement window.
Always defer the reply immediately. Discord requires a response within 3 seconds — Claude takes longer. Use the interaction token to send a follow-up when Claude finishes.
Security Considerations
Get Your Agent Into Discord Today
Our managed agent packages include Discord bot setup — slash command registration, Claude routing, signature verification, and rate limiting — all pre-configured for your server.