Read Discord channel history, download attachments, and sync context between bots.
fetch_messages(channel, limit) — read history (max 100, oldest-first)
download_attachment(chat_id, mid) — download files/images from a message
reply(chat_id, text) — send message
react(chat_id, mid, emoji) — add emoji reaction
edit_message(chat_id, mid, text) — edit previous message
fetch_messages(channel="<channel_id>", limit=30)
Returns: [timestamp] user: content (id: message_id)
Attachments marked with +Natt. Use download_attachment to fetch.
Discord returns newest N messages. To go further back:
# Pseudo-code
last_id = None
while need_more:
msgs = fetch_messages(channel, limit=100, before=last_id)
last_id = msgs[0].id # oldest in batch
process(msgs)| Method | When |
|---|---|
<channel> tag (auto) |
Bot mentioned → realtime push |
fetch_messages (manual) |
Pull history on demand |
When 2+ bots share a channel:
- Mention-based routing:
@BotAtriggers BotA only - Last-read cursor: save last
message_idprocessed inψ/memory/ - Dedup: check
message_idbefore processing - Scope split: each bot owns a domain (pricing vs logistics)
Bot needs these channel permissions:
- View Channel
- Send Messages
- Read Message History
- Attach Files
For private channels: bot must be explicitly added via Channel Permissions → Add members/roles.
| Error | Cause | Fix |
|---|---|---|
| Missing Access | Bot not in channel permissions | Add bot role to channel |
| Intermittent Missing Access | Permission cache expired | Make channel private + add bot explicitly |
| Empty response | No messages or wrong channel ID | Verify channel ID from URL |
Bot token stored at: ~/.claude/channels/<oracle-name>/.env
Channel allowlist: ~/.claude/channels/<oracle-name>/access.json
{
"groups": {
"<channel_id>": { "requireMention": true, "allowFrom": ["<user_id>"] }
}
}- Don't poll in a loop — use
fetch_messageson-demand - Don't store full message history in memory — save only decisions/facts
- Don't reply to every message — only when mentioned or asked
- Don't post pricing in public channels — check channel privacy first