mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-12 08:46:02 +00:00
3.9 KiB
3.9 KiB
Discord EBA Adapter
Status
Discord is currently being migrated from the legacy source adapter:
src/langbot/pkg/platform/sources/discord.py
src/langbot/pkg/platform/sources/discord.yaml
Target EBA directory:
src/langbot/pkg/platform/adapters/discord/
├── adapter.py
├── api_impl.py
├── event_converter.py
├── manifest.yaml
├── message_converter.py
├── platform_api.py
├── types.py
└── voice.py
Configuration
| Field | Required | Default | Description |
|---|---|---|---|
client_id |
Yes | "" |
Discord application client ID. |
token |
Yes | "" |
Discord bot token. |
The bot needs gateway permissions and intents for the target test server. Message content intent is required for message-based EBA events.
Planned Events
Initial EBA migration should support:
message.receivedmessage.editedmessage.deletedmessage.reactiongroup.member_joinedgroup.member_leftbot.invited_to_groupbot.removed_from_groupplatform.specific
Discord-specific events that do not map cleanly to common events should be surfaced as platform.specific.
Planned Common APIs
| API | Expected Status | Notes |
|---|---|---|
send_message |
Supported | Text plus attachment files. |
reply_message |
Supported | Uses Discord message references. |
edit_message |
Supported | Bot can edit its own messages. |
delete_message |
Supported | Requires message management permissions for non-bot messages. |
forward_message |
Emulated | Discord has no native forward API; copy content and attachments when possible. |
get_group_info |
Supported | Maps Discord guild/channel metadata into EBA group info depending on target ID. |
get_group_member_list |
Supported | Requires member cache or guild member fetch permissions. |
get_group_member_info |
Supported | Maps Discord roles/permissions into EBA member roles. |
get_user_info |
Supported | Uses Discord user fetch/cache. |
upload_file |
Not standalone | Discord uploads files as message attachments; standalone upload should raise NotSupportedError unless a storage-backed design is added. |
get_file_url |
Supported for attachment URLs | Discord attachment URLs are already downloadable URLs. |
mute_member |
Supported where possible | Prefer Discord timeout API for guild members. |
unmute_member |
Supported where possible | Clears timeout. |
kick_member |
Supported | Destructive; test only with a disposable account/bot. |
leave_group |
Supported | Bot leaves a guild; destructive and should run last. |
call_platform_api |
Supported | Discord-specific actions live here. |
Planned Platform-Specific APIs
Initial actions to expose through call_platform_api:
get_channelget_guildget_guild_channelsget_guild_rolescreate_invitepin_messageunpin_messageadd_reactionremove_reactiontyping
Voice actions should stay Discord-specific:
join_voice_channelleave_voice_channelget_voice_connection_statuslist_active_voice_connectionsget_voice_channel_info
Live Test Plan
Use the LangBot Discord server debug channel for end-to-end verification:
- Create or reuse a Discord bot application.
- Invite it to the LangBot server with message, member, reaction, and moderation permissions needed by the test.
- Run the Discord EBA adapter in standalone test mode.
- Send a message in the debug channel and verify
message.received. - Verify send/reply/edit/delete/forward message APIs.
- Verify attachment/file URL behavior.
- Verify guild/channel/member info APIs.
- Verify platform-specific APIs such as typing, pin/unpin, invite, reaction.
- Verify moderation APIs against a disposable target member if available.
- Run destructive
leave_grouponly at the very end or skip it when preserving the server membership matters.