Discord Adapter
@onebots/adapter-discord implements Discord API v10 directly and does not depend on discord.js. It supports Gateway, Interactions Webhooks, Webhook Events, and manual ingress, and includes a standalone strongly typed Lite client.
Installation
Open Extensions in the Web console and select the adapter, or run:
onebots ui --data-dir <workspace> --setupThe manager installs the adapter and its required peer dependencies into a verified immutable runtime generation. Do not run package-manager install commands directly in the OneBots runtime directory.
Gateway mode
discord.my_bot:
account_id: my_bot
token: "your_discord_bot_token"
receive_mode: gateway
intents:
- Guilds
- GuildMembers
- GuildMessages
- GuildMessageReactions
- DirectMessages
- DirectMessageReactions
- MessageContent
presence:
status: online
activities:
- name: "Running OneBots"
type: 0The Web form renders Intents as constrained choices and Presence activities as a dynamic structured list. Privileged intents such as GuildMembers and MessageContent must also be enabled in the Discord Developer Portal.
Gateway reconnects indefinitely by default and supports Resume, heartbeat ACK checks, Identify rate limits, sharding, Presence, and AbortSignal. A dispatch sequence is committed only after all event destinations succeed; failures resume from the last committed position.
Interactions and Webhook Events
discord.my_bot:
account_id: my_bot
token: "your_discord_bot_token"
receive_mode: interactions # or webhook_events
application_id: "123456789012345678"
public_key: "64-character hexadecimal Application Public Key"- Interactions endpoint:
POST /discord/{account_id}/interactions - Webhook Events endpoint:
POST /discord/{account_id}/events
Both modes reuse the OneBots HTTP host for Ed25519 verification, replay-window validation, concurrent redelivery coalescing, and commit-after-success deduplication. They do not open another port.
With receive_mode: manual, an existing host can pass verified events to account.client.ingest(rawEvent). Standard Requests can use acceptHttp(request), while non-Fetch hosts can call ingestHttp(...) for a structured response.
Native resource model
Discord Guild and Channel resources map to canonical get_guild_* and get_channel_* actions; Guilds are not presented as Groups. Messages support text, mentions, replies, embeds, stickers, media attachments, and the native discord_message segment.
Named platform actions cover:
- Guild members, roles, threads, invites, reactions, and message pins;
- Auto Moderation, Scheduled Events, and Guild Emoji;
search_guild_messages, including repeated array query parameters, withREAD_MESSAGE_HISTORYand theMESSAGE_CONTENTintent;set_voice_channel_statusfor setting or clearing ephemeral voice-channel status;- default and Guild Soundboard sounds, complete Guild sound lifecycle, and playback in a voice channel;
- original Interaction responses and Followup lifecycle;
send_gateway_commandand the fixed-origincall_discord_apiescape hatch.
See the package README for the complete action list and Lite SDK examples.