Skip to content

Add Discord communication channel adapter#193

Open
machieke wants to merge 4 commits into
asi-alliance:mainfrom
machieke:feature/commchannel-discord
Open

Add Discord communication channel adapter#193
machieke wants to merge 4 commits into
asi-alliance:mainfrom
machieke:feature/commchannel-discord

Conversation

@machieke

Copy link
Copy Markdown

Summary

Adds Discord as a supported commchannel alongside IRC, Telegram, Slack, and Mattermost.

This PR includes:

  • New channels/discord.py adapter using Discord Gateway for inbound messages and HTTP API for outbound messages
  • commchannel=discord wiring in MeTTa channel dispatch
  • Discord launch-script support for DC_BOT_TOKEN, DC_CHANNEL_ID, DC_GATEWAY_INTENTS, and optional API/Gateway overrides
  • Gateway reconnect/resume handling, heartbeat ACK checks, close-code diagnostics, and clearer handling for 4014 disallowed intents
  • Mention-prefixed message support for reduced-intent fallback mode
  • Documentation updates for Discord setup, bot invite requirements, Message Content intent, and launcher examples
  • Best-effort Landlock fallback when the host kernel does not support Landlock
  • Unit tests for Discord adapter behavior and Landlock best-effort handling

Testing

Ran:

  • git diff --check
  • python3 -m pytest Autotests/mock_discord/test_discord_adapter.py Autotests/test_policy_best_effort.py -q
  • python3 -m py_compile channels/discord.py profile/policy.py
  • bash -n scripts/omegaclaw entrypoint.sh

Notes

Discord server-channel usage with full text commands requires enabling Message Content Intent in the Discord Developer Portal. Without that privileged intent, users can set DC_GATEWAY_INTENTS=4609 and interact via DMs or by mentioning the bot at the start of each server-channel message.

machieke and others added 3 commits June 22, 2026 14:58
Implement RESUME on gateway reconnect (op 7) and resumable invalid
session (op 9), tracking session_id/resume_gateway_url/sequence so
messages dropped during transient disconnects are replayed instead of
lost. Cap back-to-back resume attempts to avoid IDENTIFY thrash and fall
back to a fresh identify on the existing capped backoff.

Detect zombied connections via missing HEARTBEAT_ACK (op 11) and force a
reconnect. Centralize the default gateway intents constant.

Wire the discord adapter unit test into run_mandatory and expand
coverage: auth-enabled gating, display-name fallbacks, send chunking,
and the resume payload.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vsbogd vsbogd changed the title Add Discord communication channel adapter [OMEGA-193] Add Discord communication channel adapter Jun 23, 2026
@vsbogd vsbogd requested a review from jazzbox35 June 29, 2026 10:41
@vsbogd vsbogd added the plugin label Jul 16, 2026
@vsbogd vsbogd changed the title [OMEGA-193] Add Discord communication channel adapter Add Discord communication channel adapter Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants