discordgo library. The bot receives messages from both direct messages and guild (server) channels in real time.
The channel supports:
- Direct messages (DMs)
- Guild channel messages with optional
@mention-only filtering - Audio file attachments (downloaded and forwarded to the agent)
- Other attachment URLs forwarded as text references
- Typing indicator (refreshed every 8 seconds while the agent is thinking)
- Placeholder message (“Thinking… 💭”) edited in-place with the final response when enabled
- Media sending (images, files) via
SendMedia - HTTP/HTTPS and SOCKS5 proxy support for the Discord WebSocket connection
Setup
Create a Discord application
Go to the Discord Developer Portal and click New Application. Give it a name and click Create.
Create a bot user
In the left sidebar, select Bot and click Add Bot → Yes, do it!Under Privileged Gateway Intents, enable:
- Message Content Intent — required to read message text
- Server Members Intent — required to resolve member display names
Copy the bot token
On the Bot page, click Reset Token and copy the token. Store it securely — this is your
token config value. Do not share it.Invite the bot to your server
Go to OAuth2 → URL Generator. Under Scopes, select
bot. Under Bot Permissions, select:- Send Messages
- Read Message History
- Add Reactions
- Attach Files
- View Channels
Get your Discord user ID
In Discord, go to Settings → Advanced and enable Developer Mode. Right-click your username anywhere and select Copy User ID. This is the value to put in
allow_from.Configuration reference
Set to
true to activate the Discord channel.The bot token from the Discord Developer Portal. Keep this secret — anyone with this token can control your bot.
Proxy URL for both the HTTP API client and the WebSocket gateway connection. Supports
http://, https://, and socks5:// schemes. Example: socks5://127.0.0.1:1080. If empty, HTTP_PROXY / HTTPS_PROXY environment variables are used if set.Discord user IDs (snowflake strings) allowed to message the agent. Example:
["123456789012345678"]. Enable Developer Mode in Discord settings to copy user IDs by right-clicking a username.Leave empty to allow all users. See Common configuration fields for all supported formats.When
true, the bot only responds in guild (server) channels when @mentioned directly. Messages that do not contain a mention are silently ignored. DMs are always answered regardless of this setting.Default: false.A Discord channel ID where agent reasoning traces are sent. Leave empty to disable. See Messaging channels for details.
The mention_only option
In a large Discord server, you likely do not want the agent responding to every message in every channel. Set mention_only to true:
@mention the bot in a guild channel trigger a response. The bot mention (<@BOT_ID>) is stripped from the content before it reaches the agent.
DMs always get a response, regardless of mention_only.
Discord’s message length limit is 2000 characters. Operator automatically splits longer responses into multiple sequential messages while preserving code block integrity.