KlangDocs

    Open Klang

    Bots

    View as Markdown

    Compatibility

    Every REST route and gateway event of Discord’s API version 10, and whether Klang supports it, supports part of it, doesn’t yet, or doesn’t have what it’s about.

    How to read it

    • Supported: it works as a library expects.
    • Partial: it works, with a difference the note explains.
    • Not yet: Klang has the feature, but bots can’t reach it yet. The route answers 404, or the event doesn’t arrive.
    • Not in Klang: Klang doesn’t have the feature. The route answers 404 and the event never arrives.

    Routes are relative to https://api.klang.gg/api/v10 (or /api/v9) and need Authorization: Bot <token>, except where it says otherwise. In long routes, … stands for the part the rows above already show, such as /channels/{channel.id}. What changes across the board, such as IDs and permissions, is in Differences from Discord’s API. Each supported route and event is documented, with its fields and errors, in the bot API reference.

    REST routes

    Gateway, users and the app

    Route Status Notes
    GET /gateway Supported No token needed.
    GET /gateway/bot Supported Always one shard, and max_concurrency 1.
    GET /users/@me Supported public_flags has VERIFIED_BOT once the bot is verified.
    PATCH /users/@me Not yet Change the bot’s name and picture in the developer portal.
    GET /users/{user.id} Partial Only people the bot shares a server or a DM with. See Looking up users.
    GET /users/@me/guilds Supported before, after, limit up to 200 and with_counts.
    DELETE /users/@me/guilds/{guild.id} Supported The bot leaves with its role.
    POST /users/@me/channels Partial A DM only with people who allow it, never a group. See Direct messages.
    GET /applications/@me Supported
    GET /oauth2/applications/@me Supported
    PATCH /applications/@me Partial Only interactions_endpoint_url; any other field is a 50035. Edit the rest in the developer portal.
    OAuth2 for people (/oauth2/token, GET /oauth2/@me…) Not yet Only the bot’s install link exists. See Add the bot to a server.
    GET /users/@me/connections, role connections Not in Klang

    Channels and messages

    Route Status Notes
    GET /channels/{channel.id} Supported A server’s channel, a thread or a DM. Overwrites come flattened.
    PATCH, DELETE /channels/{channel.id} Supported Text, voice and categories, and threads. See Managing a server.
    GET /channels/{channel.id}/messages Supported around, before or after, and limit up to 100.
    GET …/messages/{message.id} Supported
    POST /channels/{channel.id}/messages Partial JSON, or a form with files. Polls only with Klang’s durations. One sticker, and replies in the same channel. See Messages.
    PATCH …/messages/{message.id} Partial Text, embeds, allowed_mentions and files (attachments keeps or removes them).
    DELETE …/messages/{message.id} Supported Its own messages, or anyone’s with Manage messages.
    POST …/messages/bulk-delete Supported 2 to 100 messages under 14 days old, with Manage messages. See Moderation.
    POST …/messages/{message.id}/crosspost Not in Klang Klang has no announcement channels.
    POST /channels/{channel.id}/typing Supported
    PUT …/messages/{message.id}/reactions/{emoji}/@me Supported A Unicode emoji, or name:id for a custom one.
    DELETE …/messages/{message.id}/reactions/{emoji}/@me Supported
    GET …/messages/{message.id}/reactions/{emoji} Not yet Who reacted.
    DELETE …/reactions/{emoji}/{user.id} Not yet Someone else’s reaction.
    DELETE …/reactions/{emoji}, DELETE …/reactions Not yet All the reactions of an emoji, or of a message.
    GET …/messages/pins, PUT, DELETE …/pins/{message.id} Supported The older /pins routes too. Up to 50 pins a channel. See Pins.
    PUT, DELETE …/permissions/{overwrite.id} Supported Bits Klang lacks are kept as sent. See Set an overwrite.
    GET, POST /channels/{channel.id}/invites Partial No temporary or targeted invites. See Create an invite.
    GET …/polls/{message.id}/answers/{answer.id} Supported See Who voted.
    POST …/polls/{message.id}/expire Supported Its own polls. See Close a poll.
    PUT, DELETE …/recipients/{user.id} Not in Klang Bots never join group DMs.
    POST /channels/{channel.id}/followers Not in Klang Klang has no announcement channels.
    POST …/send-soundboard-sound Not in Klang

    Threads

    Route Status Notes
    POST …/messages/{message.id}/threads Supported
    POST /channels/{channel.id}/threads Partial Public threads only. No forum posts.
    …/thread-members (join, leave, one, list) Partial Joining is following. Adding or removing someone else doesn’t exist in Klang (50013).
    GET /guilds/{guild.id}/threads/active Supported
    GET …/threads/archived/public Partial The inactive ones: Klang’s threads archive themselves after 7 days.
    …/threads/archived/private and the user’s ones Not in Klang Klang has no private threads.

    Servers, members and roles

    Route Status Notes
    GET /guilds/{guild.id} Supported with_counts too.
    PATCH /guilds/{guild.id} Not yet
    POST /guilds, DELETE /guilds/{guild.id} Not in Klang Bots don’t own servers.
    GET /guilds/{guild.id}/channels Partial The channels the bot can see, then the active threads in them.
    POST, PATCH /guilds/{guild.id}/channels Partial Text, voice and categories. See Managing a server.
    GET /guilds/{guild.id}/members Supported Needs the GUILD_MEMBERS intent switched on (50001 without it). limit up to 1,000 and after.
    GET …/members/{user.id} Supported
    GET …/members/search Not yet
    PATCH …/members/{user.id}, PATCH …/members/@me Partial nick, roles and communication_disabled_until. Not mute, deaf or channel_id yet. At @me, only nick.
    PUT, DELETE …/members/{user.id}/roles/{role.id} Supported Never a role with a permission the bot lacks: see Moderation.
    DELETE …/members/{user.id} Supported Kicking someone.
    GET …/bans, GET, PUT, DELETE …/bans/{user.id} Partial Only people in the server can be banned. delete_message_seconds deletes nothing. See Moderation.
    POST …/bulk-ban Not yet
    GET /guilds/{guild.id}/roles Supported
    GET …/roles/{role.id} Not yet GET /guilds/{guild.id}/roles has every role.
    POST, PATCH, DELETE on roles, PATCH /guilds/{guild.id}/roles Partial One colour, no icons; no bot changes a bot’s role. See Managing a server.
    GET /guilds/{guild.id}/audit-logs Partial What Klang records with a number in Discord. See The audit log.
    GET …/invites, GET, DELETE /invites/{code} Supported
    GET, POST …/emojis, GET, PATCH, DELETE …/emojis/{emoji.id} Partial No role restrictions (roles only empty). See Emojis.
    GET, POST …/stickers, GET, PATCH, DELETE …/stickers/{sticker.id} Partial tags is one emoji. PNG, WebP or GIF up to 512 KB. See Stickers.
    …/auto-moderation/rules, …/rules/{rule.id} Partial Keyword and mention spam rules. Other triggers and actions are a 50035. See AutoMod rules.
    GET /voice/regions, …/regions, …/voice-states Not yet
    …/preview, …/widget, …/vanity-url, …/welcome-screen, …/onboarding, …/prune, …/integrations, …/templates Not in Klang
    …/scheduled-events, …/soundboard-sounds, /stage-instances Not in Klang

    Webhooks

    Route Status Notes
    POST /webhooks/{webhook.id}/{webhook.token} Supported No bot token needed. See Execute a webhook.
    GET /webhooks/{webhook.id}/{webhook.token} Supported
    PATCH, DELETE …/messages/{message.id} Supported Messages that webhook posted.
    GET …/messages/{message.id} Not yet
    PATCH, DELETE /webhooks/{webhook.id}/{webhook.token} Supported Name and avatar; no bot token needed. See With the webhook’s token.
    POST …/github Supported See GitHub.
    GET, POST /channels/{channel.id}/webhooks Partial Text channels only. 15 per channel and 50 per server. See Webhooks.
    GET /guilds/{guild.id}/webhooks Supported Those of the channels where the bot has Manage webhooks.
    GET, PATCH, DELETE /webhooks/{webhook.id} Supported With a bot token. Moving one takes it to a text channel of the same server.

    Commands, interactions and paid apps

    Route Status Notes
    GET, POST, PUT /applications/{app.id}/commands Supported Slash, user and message commands. See Commands.
    GET, PATCH, DELETE …/commands/{command.id} Supported
    GET, POST, PUT …/guilds/{guild.id}/commands, and one command Supported Only in servers the bot is in (50001).
    GET …/guilds/{guild.id}/commands/permissions, and of one command Supported Read only.
    PUT …/commands/permissions, PUT …/commands/{command.id}/permissions Partial 20001 for bot tokens, as in Discord. People change them in the app; there’s no OAuth2 for people yet.
    POST /interactions/{interaction.id}/{interaction.token}/callback Supported Types 4 to 9, and with_response. Files with 4 and 7, ephemeral or not. 10 and 12 (paid apps, activities) don’t exist in Klang.
    POST /webhooks/{app.id}/{interaction.token} Supported Follow-ups, ephemeral or not, with files in both.
    GET, PATCH, DELETE /webhooks/{app.id}/{interaction.token}/messages/{message.id} Supported Also @original.
    Interactions endpoint URL Supported Signed with Ed25519 (verify_key). Set in the portal or with PATCH /applications/@me. See HTTP interactions.
    Buttons and select menus (MESSAGE_COMPONENT, callbacks 6 and 7) Partial The five button styles and the five menus. No premium buttons (style 6). See Buttons, menus and layouts.
    Layout components (IS_COMPONENTS_V2) Supported Section, text display, thumbnail, media gallery, file, separator and container. Klang’s search reads their text displays.
    Modals (callback 9, MODAL_SUBMIT) Supported Labels with a text input, a select menu, a file upload, a radio group, a checkbox group or a checkbox; text displays and the older action rows. See Modals.
    Activities (PRIMARY_ENTRY_POINT, callback 12) Not in Klang
    Apps installed to a user’s account, group DM contexts Not in Klang integration_types is always [0].
    /applications/{app.id}/emojis Not in Klang Klang has no app emojis.
    SKUs, entitlements and subscriptions Not in Klang
    Lobbies and the Social SDK Not in Klang

    Gateway events

    Event Status Intent and notes
    READY, RESUMED Supported No intent needed. Every server first comes as unavailable, then one GUILD_CREATE each.
    GUILD_CREATE, GUILD_UPDATE, GUILD_DELETE Supported GUILDS. GUILD_DELETE also when the bot is removed or loses access.
    CHANNEL_CREATE, CHANNEL_UPDATE, CHANNEL_DELETE Supported GUILDS. Server channels. Opening a DM doesn’t send one.
    THREAD_CREATE, THREAD_UPDATE, THREAD_DELETE Supported GUILDS.
    GUILD_ROLE_CREATE, GUILD_ROLE_UPDATE, GUILD_ROLE_DELETE Supported GUILDS.
    MESSAGE_CREATE, MESSAGE_UPDATE, MESSAGE_DELETE, MESSAGE_DELETE_BULK Supported GUILD_MESSAGES in servers, DIRECT_MESSAGES in DMs. Content follows MESSAGE_CONTENT. referenced_message can be null: see Events.
    MESSAGE_REACTION_ADD, …_REMOVE, …_REMOVE_ALL, …_REMOVE_EMOJI Supported GUILD_MESSAGE_REACTIONS in servers, DIRECT_MESSAGE_REACTIONS in DMs.
    GUILD_MEMBER_ADD, GUILD_MEMBER_UPDATE, GUILD_MEMBER_REMOVE Supported GUILD_MEMBERS. The bot’s own GUILD_MEMBER_UPDATE arrives without the intent.
    USER_UPDATE Supported No intent needed. The bot’s own user.
    GUILD_EMOJIS_UPDATE, GUILD_STICKERS_UPDATE Supported GUILD_EXPRESSIONS. The whole list.
    GUILD_MEMBERS_CHUNK Not yet No intent needed. Op 8 is accepted and doesn’t answer yet.
    TYPING_START Not yet GUILD_MESSAGE_TYPING in servers, DIRECT_MESSAGE_TYPING in DMs.
    PRESENCE_UPDATE Not yet GUILD_PRESENCES. The intent isn’t available yet.
    CHANNEL_PINS_UPDATE Partial GUILDS in servers, DIRECT_MESSAGES in DMs. After an unpin, last_pin_timestamp is null.
    THREAD_MEMBER_UPDATE Not yet GUILDS. The bot following a thread, or stopping, comes in THREAD_MEMBERS_UPDATE.
    THREAD_MEMBERS_UPDATE Supported GUILDS; someone else joining or leaving also needs GUILD_MEMBERS. member_count up to 50.
    THREAD_LIST_SYNC Partial GUILDS. When the bot comes to see a channel with active threads; not on connecting.
    GUILD_BAN_ADD, GUILD_BAN_REMOVE Partial GUILD_MODERATION. Only to bots with Ban members or View audit log in the server.
    GUILD_AUDIT_LOG_ENTRY_CREATE Partial GUILD_MODERATION, to bots with View audit log. Only the entries with a number in Discord.
    INVITE_CREATE, INVITE_DELETE Not yet GUILD_INVITES.
    WEBHOOKS_UPDATE Supported GUILD_WEBHOOKS.
    GUILD_INTEGRATIONS_UPDATE, INTEGRATION_* Not yet GUILD_INTEGRATIONS.
    VOICE_STATE_UPDATE, VOICE_SERVER_UPDATE Not yet GUILD_VOICE_STATES for the first. Bots can’t join voice yet.
    MESSAGE_POLL_VOTE_ADD, MESSAGE_POLL_VOTE_REMOVE Supported GUILD_MESSAGE_POLLS in servers, DIRECT_MESSAGE_POLLS in DMs. One per answer.
    AUTO_MODERATION_RULE_*, AUTO_MODERATION_ACTION_EXECUTION Partial AUTO_MODERATION_CONFIGURATION or AUTO_MODERATION_EXECUTION, to bots with Manage server. No message_id, and matched_content is null.
    INTERACTION_CREATE Supported No intent needed. To the newest connection of the app, and only without an interactions endpoint URL.
    APPLICATION_COMMAND_PERMISSIONS_UPDATE Not yet No intent needed.
    RATE_LIMITED Not yet No intent needed.
    GUILD_SCHEDULED_EVENT_* Not in Klang GUILD_SCHEDULED_EVENTS.
    STAGE_INSTANCE_* Not in Klang GUILDS.
    GUILD_SOUNDBOARD_SOUND_*, SOUNDBOARD_SOUNDS Not in Klang GUILD_EXPRESSIONS.
    VOICE_CHANNEL_EFFECT_SEND, VOICE_CHANNEL_STATUS_UPDATE, VOICE_CHANNEL_START_TIME_UPDATE Not in Klang GUILD_VOICE_STATES or GUILDS.
    ENTITLEMENT_*, SUBSCRIPTION_* Not in Klang No intent needed.

    Gateway opcodes

    Op Name Status Notes
    0 Dispatch Supported
    1 Heartbeat Supported Klang also sends it when a heartbeat is late.
    2 Identify Supported One shard; compress: true is ignored.
    3 Presence Update Partial The status only; activities are ignored.
    4 Voice State Update Not yet Accepted, does nothing.
    6 Resume Supported About 3 minutes: the last 2,000 events, 5 MB.
    7 Reconnect Supported Sent before Klang restarts.
    8 Request Guild Members Not yet Accepted, doesn’t answer.
    9 Invalid Session Supported
    10 Hello Supported heartbeat_interval 41,250 ms.
    11 Heartbeat ACK Supported
    31 Request Soundboard Sounds Not in Klang Closes with 4001.