feat(messaging): add Discord bot as a messaging channel - #960
Open
roccoren wants to merge 15 commits into
Open
Conversation
New @craft-agent/messaging-discord-worker package: stdio protocol with round-trip tests and a discord.js-backed worker runtime supporting text, edit, buttons, files, typing, and inbound message/interaction relay.
…ger config
- PlatformType, AdapterCapabilities.markdown, MessagingConfig.platforms += discord
- BindingConfig.discordGuildTrigger ('mention' | 'all', default 'mention')
- DiscordAdapter spawns the discord worker; real editMessage/sendButtons/ clearButtons/typing; incoming + button_press translation with bot drop - formatForDiscord (heading downgrade, fence-aware) - IncomingMessage.isDM/mentionedBot; Router guild-trigger gate honoring BindingConfig.discordGuildTrigger - adapter + format + router trigger tests
- registry options.discord (workerEntry/nodeBin); WorkspaceState.discord - testDiscordCredentials (GET /users/@me), saveDiscordCredentials, tryConnectDiscord, onDiscordEvent runtime transitions - discord added to init/updateConfig/disconnect/runtime iteration + isKnownPlatform - export DiscordAdapter/parseDiscordCredentials from package index
- channels.ts + routing.ts classification - IMessagingGatewayRegistry test/saveDiscordCredentials - server-core RPC handlers mirroring Lark - update ipc-channels wire-format snapshot test
…pipeline - channel-map + ElectronAPI: test/saveDiscordCredentials - electron main + headless server pass discord.workerEntry - bootstrap forwards optional discord config - dev/packaged/server build pipelines build + ship messaging-discord-worker - electron-builder extraResources (mac/win/linux)
- DiscordConnectDialog (bot token + Message Content Intent hint) - discord.svg icon + MessagingPlatformIcon registration - Discord platform card in MessagingSettingsPage - extend 'telegram|whatsapp|lark' unions with 'discord' across renderer
- settings.messaging.discord.* keys across all 7 locales (sorted, parity-clean) - doc-links messaging summary lists Discord
roccoren
force-pushed
the
feat/discord-messaging-channel
branch
from
July 10, 2026 04:20
6c947da to
f2eeb72
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b2433dd5-b479-4f5f-82cd-67ec49f3b7e0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Discord as a first-class messaging channel alongside Telegram, WhatsApp, and Lark. A user connects a Discord bot token; sessions can then be bound to Discord DMs and server (guild) text channels with the full
PlatformAdaptercapability set (text, message editing, inline buttons, file uploads, typing).Implements the high-priority Discord ask from #584.
Architecture
Mirrors the WhatsApp isolation model: a new
@craft-agent/messaging-discord-workerpackage runsdiscord.jsv14 in a Node subprocess, speaking NDJSON over stdio to aDiscordAdapterinmessaging-gateway. Router, bindings, access-control, commands, and pending-senders are all platform-agnostic and reused unchanged.What's included
@craft-agent/messaging-discord-worker: NDJSON protocol (with round-trip tests) + discord.js worker (login, DM/@mention detection, attachment download, button interactions, send/edit/typing) + esbuild self-contained bundle.DiscordAdapter(editing/buttons/files/typing; 2000-char max) +formatForDiscord+ Router guild-trigger gate honoring a per-bindingdiscordGuildTrigger('mention' | 'all'; DMs always route).GET /users/@me), connect/disconnect/forget, runtime state transitions.TEST_DISCORD/SAVE_DISCORDRPC channels + handlers.DiscordConnectDialog(bot token + Message Content Intent hint), icon, settings card, and'telegram'|'whatsapp'|'lark'union extensions.extraResources(mac/win/linux).settings.messaging.discord.*keys across all 7 locales (sorted, parity-clean) + doc-links.docs/superpowers/.Setup (for reviewers testing)
botscope + Send Messages) to a server./new//bind.Verification
tsc --noEmitclean across worker/gateway/server-core/server/shared/electron.node --check.Out of scope (v1)
Threads/forum channels, slash-command registration, reactions/voice.