Discord Channel
xopc connects to Discord via the Discord Gateway (WebSocket) and Discord REST API v10. It supports direct messages, guild channels, threads, attachments, forwarded messages, interactive components, streaming draft edits, ambient Realtime events, multi-account bots, and native Agent Tools.
Setup
- Create an application in the Discord Developer Portal and add a Bot.
- Copy the Bot Token and configure it in
~/.xopc/xopc.json(or via the Console setup wizard /DISCORD_BOT_TOKENenv var):
json
{
"channels": {
"discord": {
"enabled": true,
"botToken": "<YOUR_BOT_TOKEN>",
"dmPolicy": "pairing",
"groupPolicy": "allowlist",
"groupAllowFrom": ["<YOUR_DISCORD_USER_ID>"],
"streaming": {
"mode": "chat",
"throttleMs": 700
}
}
}
}- Enable Message Content Intent in the Developer Portal if you want the bot to read non-mentioned messages in ambient guild channels (
channels.discord.events.ambientChannels).
Capabilities
- Inbound: DMs, guild channels, public/private threads, attachment downloads (images/files/audio/video), forwarded
message_snapshots, reply context (referenced_message), implicit thread follow-ups, interactive button/select/slash-command callbacks, and clarify/exec-approval responses. - Outbound & Streaming: Markdown chunking, replies, media uploads, typing indicators, and live draft-edit streaming (
streaming.mode: "chat"). - Realtime Events: Emits
discord.eventnotifications to the Gateway Realtime stream for message updates/deletes, reactions, thread creations, and ambient channel messages. - Multi-Account & Fine-Grained Policies: Configure
accounts.<id>, per-guildguilds.<guildId>.channels.<channelId>rules (enabled,requireMention,users,ambient,systemPrompt), and live hot-reload.
Agent Tools
The extension registers 9 native tools (gated by channels.discord.actions.*):
discord_list_guilds,discord_list_channels,discord_read_messages,discord_list_threads,discord_list_pins,discord_member_infodiscord_send_message,discord_manage_message(edit/delete/react/pin/unpin),discord_manage_thread(create/archive/unarchive)