Skip to content

feat: add Discord channel#79

Open
srflmr wants to merge 1 commit into
anvie:mainfrom
srflmr:feat/discord-channel
Open

feat: add Discord channel#79
srflmr wants to merge 1 commit into
anvie:mainfrom
srflmr:feat/discord-channel

Conversation

@srflmr

@srflmr srflmr commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Add Discord as a messaging channel, alongside the existing Telegram and WhatsApp channels.

Split out of #76 (now superseded by #78) — Discord shares no code with the evomem/setup work, so it stands alone.

Change

DiscordChannel(BaseChannel) in backend/channels/discord.py — an async client on a daemon thread, mirroring the Telegram channel's structure. Listens to DMs and to guild messages that @mention the bot, routes them through the agent runtime, and replies in the originating channel. Reuses the shared pairing/allowlist flow, outbound buffering, typing indicator, and approval prompts (rendered as discord.ui buttons). Media: image vision, file send, attachment persistence — gated by the agent's attachment config and per-type size limits.

  • Registered 'discord' in CHANNEL_TYPES (the channel registry is the only extension point).
  • requirements.txt: discord.py>=2.3.
  • doctor gains a channel-integrations check (verifies the library is present for configured channels; notes the required Message Content Intent).
  • UI: a setup hint under the Discord bot-token field in templates/agent_detail.html.

Notes

  • Requires the privileged Message Content Intent (enabled in the Discord Developer Portal) to read message text. The channel logs a clear error if it is missing.
  • Discord renders Markdown, so responses are not stripped of formatting; messages are split to respect the 2000-char limit.
  • Intentionally not added to the setup wizard — Discord is configured per-agent like the other channels.

Why it's safe

  • Additive — new module + one registry entry; existing channels untouched. No models/ schema changes.
  • The bot token is never logged; file sends are size- and access-checked before open.

Test plan

  • test_discord_channel green (Discord client mocked).
  • doctor --quick channel-integrations check runs cleanly.

Implement Discord as a first-class channel alongside Telegram and WhatsApp,
replacing the prior UI-only scaffolding.

- backend/channels/discord.py: DiscordChannel(BaseChannel) using discord.py.
  Runs an async client on a daemon thread (mirrors the Telegram channel).
  Listens to DMs and to guild messages that @mention the bot; routes through
  the agent runtime and replies in the originating channel.
- Reuses the shared pairing/allowlist flow, outbound buffering, typing
  indicator, and approval prompts (rendered as discord.ui buttons).
- Media: image vision (data URL), file send, and attachment persistence,
  gated by the agent's attachment config and per-type size limits.
- Register 'discord' in the channel registry; add discord.py>=2.3.
- doctor: add a channel-integrations check (verifies the library is present
  for configured channels; notes the required Message Content Intent).
- UI: add a setup hint under the Discord bot-token field.
- README: mark Discord as implemented.
- Tests: unit_tests/test_discord_channel.py covers helpers, message gating,
  start() guards, and the pairing/approval flow.

Note: Discord requires the privileged Message Content Intent to be enabled
in the Developer Portal for the bot to read message text.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant