packages/docs/plugin-registry/platform/discord.md
The Discord plugin connects Eliza agents to Discord as a bot, enabling message handling across servers, channels, and DMs with support for slash commands, reactions, and voice channels.
Package: @elizaos/plugin-discord
eliza plugins install @elizaos/plugin-discord
bot, applications.commandsSend Messages, Read Message History, Add Reactions, Connect (for voice){
"connectors": {
"discord": {
"token": "YOUR_BOT_TOKEN"
}
}
}
Or via environment variables:
export DISCORD_API_TOKEN=YOUR_BOT_TOKEN
The runtime sets both DISCORD_API_TOKEN and DISCORD_BOT_TOKEN from the configured token, so either variable name works.
| Field | Required | Description |
|---|---|---|
token | Yes | Discord bot token (the Discord config schema uses strict validation — use token, not botToken) |
enabled | No | Set false to disable (default: true) |
groupPolicy | No | Group join policy: "open", "disabled", or "allowlist" (default: "allowlist") |
dm.policy | No | DM access policy: "pairing", "allowlist", "open", or "disabled" (default: "pairing") |
{
"connectors": {
"discord": {
"token": "YOUR_BOT_TOKEN",
"allowedChannels": ["1234567890123456789"],
"prefix": "!"
}
}
}
Discord Message
↓
Plugin receives MESSAGE_CREATE event
↓
Determines if agent should respond:
- DM → always respond
- Channel → respond if mentioned or addressed
↓
Formats as Eliza Memory
↓
AgentRuntime processes
↓
Response sent back to Discord channel/DM
The plugin auto-enables when the connectors.discord block contains a token (or botToken / apiKey — these trigger auto-enable detection but token is the validated schema field):
{
"connectors": {
"discord": {
"token": "YOUR_BOT_TOKEN"
}
}
}
| Variable | Required | Description |
|---|---|---|
DISCORD_API_TOKEN | Yes | Discord bot token |
DISCORD_APPLICATION_ID | No | Discord application ID |
CHANNEL_IDS | No | Comma-separated list of channel IDs to monitor |
DISCORD_LISTEN_CHANNEL_IDS | No | Channel IDs to listen to (alternative to CHANNEL_IDS) |
DISCORD_TEST_CHANNEL_ID | No | Channel ID for test/dev messages |
DISCORD_VOICE_CHANNEL_ID | No | Voice channel ID for voice features |
DISCORD_SHOULD_IGNORE_BOT_MESSAGES | No | Ignore messages from other bots |
DISCORD_SHOULD_IGNORE_DIRECT_MESSAGES | No | Ignore direct messages |
DISCORD_SHOULD_RESPOND_ONLY_TO_MENTIONS | No | Only respond when @mentioned |
The bot token can also be set via:
Both DISCORD_API_TOKEN and DISCORD_BOT_TOKEN environment variables are recognized (the runtime sets both for compatibility).