Messages, reactions and pins: send (with embeds, components, polls and file uploads), read, edit, delete, crosspost, react, and pin.

Functions

bulk-delete-messages

fn (request: BulkDeleteMessagesRequest): Bool
fn (request: BulkDeleteMessagesRequest, opts: Map): Bool

POST /channels/{channel_id}/messages/bulk-delete - Delete 2-100 messages at once. Messages older than 14 days are rejected. Needs MANAGE_MESSAGES. reason goes to the audit log.

create-message

fn (request: CreateMessageRequest): Map
fn (request: CreateMessageRequest, opts: Map): Map

POST /channels/{channel_id}/messages - Send a message. Provide at least one of content, embeds, components, sticker_ids, poll or files. Unset fields are omitted from the request.

  • message_reference: {message_id} replies to a message ({type: 1, message_id, channel_id} forwards one).
  • allowed_mentions: {parse: []} suppresses pings from user text.
  • files uploads attachments as multipart/form-data; reference one in an embed as attachment://<filename>. attachments is generated from files when you don't pass it.
  • nonce with enforce_nonce: true deduplicates retries.
  • flags: 4 = SUPPRESS_EMBEDS, 4096 = SUPPRESS_NOTIFICATIONS, 32768 = IS_COMPONENTS_V2.

Example

::messages ::discord::messages

sent ::messages/create-message(::messages/CreateMessageRequest({
  channel_id: "1100000000000000000",
  content: "Nightly report attached",
  files: [{filename: "report.csv", content: "date,count\n2026-11-01,42\n"}]
}))
sent.id

create-reaction

fn (request: CreateReactionRequest): Bool
fn (request: CreateReactionRequest, opts: Map): Bool

PUT /channels/{channel_id}/messages/{message_id}/reactions/{emoji}/@me - React to a message.

Example

::messages ::discord::messages

::messages/create-reaction(::messages/CreateReactionRequest({
  channel_id: "1100000000000000000",
  message_id: "1200000000000000000",
  emoji: "👍"
}))

crosspost-message

fn (request: CrosspostMessageRequest): Map
fn (request: CrosspostMessageRequest, opts: Map): Map

POST /channels/{channel_id}/messages/{message_id}/crosspost - Publish a message in an Announcement channel to every following channel.

delete-all-reactions

fn (request: DeleteAllReactionsRequest): Bool
fn (request: DeleteAllReactionsRequest, opts: Map): Bool

DELETE /channels/{channel_id}/messages/{message_id}/reactions - Remove every reaction from a message. Needs MANAGE_MESSAGES.

delete-all-reactions-for-emoji

fn (request: DeleteAllReactionsForEmojiRequest): Bool
fn (request: DeleteAllReactionsForEmojiRequest, opts: Map): Bool

DELETE /channels/{channel_id}/messages/{message_id}/reactions/{emoji} - Remove every reaction of one emoji. Needs MANAGE_MESSAGES.

delete-message

fn (request: DeleteMessageRequest): Bool
fn (request: DeleteMessageRequest, opts: Map): Bool

DELETE /channels/{channel_id}/messages/{message_id} - Delete a message. Deleting another user's message needs MANAGE_MESSAGES.

delete-own-reaction

fn (request: DeleteOwnReactionRequest): Bool
fn (request: DeleteOwnReactionRequest, opts: Map): Bool

DELETE /channels/{channel_id}/messages/{message_id}/reactions/{emoji}/@me - Remove the bot's own reaction.

delete-user-reaction

fn (request: DeleteUserReactionRequest): Bool
fn (request: DeleteUserReactionRequest, opts: Map): Bool

DELETE /channels/{channel_id}/messages/{message_id}/reactions/{emoji}/{user_id} - Remove another user's reaction. Needs MANAGE_MESSAGES.

edit-message

fn (request: EditMessageRequest): Map
fn (request: EditMessageRequest, opts: Map): Map

PATCH /channels/{channel_id}/messages/{message_id} - Edit a message. Only the fields you set change; unset fields are left alone. Set an empty value to remove content (embeds: [], components: []), or list fields in clear to send them as null.

attachments is the full list to keep: existing attachments not in it are removed. New files are appended as files[n]; include {id: n} entries for them in attachments when you also pass it.

Example

::messages ::discord::messages

::messages/edit-message(::messages/EditMessageRequest({
  channel_id: "1100000000000000000",
  message_id: "1200000000000000000",
  content: "Deploy finished (edited)"
}))

get-all-pins

fn (channel-id: Str): Vec<Map>
fn (channel-id: Str, opts: Map): Vec<Map>
fn (channel-id: Str, max-items: Int): Vec<Map>
fn (channel-id: Str, max-items: Int, opts: Map): Vec<Map>

Every pin in a channel (up to max-items, default 1000) as [{pinned_at, message}], following has_more.

get-all-pins-loop

fn (channel-id: Str, max-items: Int, before: Str?, acc: Vec): Vec<Map>
fn (channel-id: Str, max-items: Int, before: Str?, acc: Vec, opts: Map): Vec<Map>

get-channel-messages

fn (request: GetChannelMessagesRequest): Vec<Map>
fn (request: GetChannelMessagesRequest, opts: Map): Vec<Map>

GET /channels/{channel_id}/messages - Up to limit (1-100, default 50) messages, newest first. Page with one of before, after or around (a message id). Needs VIEW_CHANNEL and READ_MESSAGE_HISTORY; message content is empty unless the app has the Message Content intent.

Example

::messages ::discord::messages

recent ::messages/get-channel-messages(::messages/GetChannelMessagesRequest({
  channel_id: "1100000000000000000",
  limit: 10
}))
// => [{id: "...", content: "Hello", author: {...}}, ...]

get-channel-pins

fn (request: GetChannelPinsRequest): Map
fn (request: GetChannelPinsRequest, opts: Map): Map

GET /channels/{channel_id}/messages/pins - Pinned messages, newest pin first. Returns {items: [{pinned_at, message}], has_more}. limit is 1-50 (default 50); page with before set to the last item's pinned_at timestamp, or use get-all-pins.

Example

::messages ::discord::messages

pins ::messages/get-channel-pins(::messages/GetChannelPinsRequest({
  channel_id: "1100000000000000000"
}))
map(pins.items, (p) { p.message.content })

get-message

fn (request: GetMessageRequest): Map
fn (request: GetMessageRequest, opts: Map): Map

GET /channels/{channel_id}/messages/{message_id} - One message by id.

get-message-history

fn (channel-id: Str, max-items: Int): Vec<Map>
fn (channel-id: Str, max-items: Int, before: Str?): Vec<Map>
fn (channel-id: Str, max-items: Int, before: Str?, opts: Map): Vec<Map>

Page backwards through a channel's history with before, newest first, collecting up to max-items messages (100 per request). The 3-arity form starts before a given message id.

Example

last-500 ::discord::messages/get-message-history("1100000000000000000", 500)

get-reactions

fn (request: GetReactionsRequest): Vec<Map>
fn (request: GetReactionsRequest, opts: Map): Vec<Map>

GET /channels/{channel_id}/messages/{message_id}/reactions/{emoji} - Users who reacted with emoji (up to limit, 1-100). type 0 = normal, 1 = super reactions. Page with after (a user id).

pin-message

fn (request: PinMessageRequest): Bool
fn (request: PinMessageRequest, opts: Map): Bool

PUT /channels/{channel_id}/messages/pins/{message_id} - Pin a message. Needs PIN_MESSAGES. reason goes to the audit log.

reaction-path

fn (channel-id: Str, message-id: Str, emoji: Str): Str

unpin-message

fn (request: UnpinMessageRequest): Bool
fn (request: UnpinMessageRequest, opts: Map): Bool

DELETE /channels/{channel_id}/messages/pins/{message_id} - Unpin a message. Needs PIN_MESSAGES. reason goes to the audit log.

Types

BulkDeleteMessagesRequest

BulkDeleteMessagesRequest type {
    channel_id: Str,
    messages: Vec<Str>,
    reason: Str?
}

CreateMessageRequest

CreateMessageRequest type {
    channel_id: Str,
    content: Str?,
    nonce: Any?,
    enforce_nonce: Bool?,
    tts: Bool?,
    embeds: Vec<Map>?,
    allowed_mentions: Map?,
    message_reference: Map?,
    components: Vec<Map>?,
    sticker_ids: Vec<Str>?,
    attachments: Vec<Map>?,
    flags: Int?,
    poll: Map?,
    files: Vec<::discord::api/FileUpload>?
}

CreateReactionRequest

CreateReactionRequest type {
    channel_id: Str,
    message_id: Str,
    emoji: Str
}

CrosspostMessageRequest

CrosspostMessageRequest type {
    channel_id: Str,
    message_id: Str
}

DeleteAllReactionsForEmojiRequest

DeleteAllReactionsForEmojiRequest type {
    channel_id: Str,
    message_id: Str,
    emoji: Str
}

DeleteAllReactionsRequest

DeleteAllReactionsRequest type {
    channel_id: Str,
    message_id: Str
}

DeleteMessageRequest

DeleteMessageRequest type {
    channel_id: Str,
    message_id: Str
}

DeleteOwnReactionRequest

DeleteOwnReactionRequest type {
    channel_id: Str,
    message_id: Str,
    emoji: Str
}

DeleteUserReactionRequest

DeleteUserReactionRequest type {
    channel_id: Str,
    message_id: Str,
    emoji: Str,
    user_id: Str
}

EditMessageRequest

EditMessageRequest type {
    channel_id: Str,
    message_id: Str,
    content: Str?,
    embeds: Vec<Map>?,
    flags: Int?,
    allowed_mentions: Map?,
    components: Vec<Map>?,
    attachments: Vec<Map>?,
    files: Vec<::discord::api/FileUpload>?,
    clear: Vec<Str>?
}

GetChannelMessagesRequest

GetChannelMessagesRequest type {
    channel_id: Str,
    around: Str?,
    before: Str?,
    after: Str?,
    limit: Int?
}

GetChannelPinsRequest

GetChannelPinsRequest type {
    channel_id: Str,
    before: Str?,
    limit: Int?
}

GetMessageRequest

GetMessageRequest type {
    channel_id: Str,
    message_id: Str
}

GetReactionsRequest

GetReactionsRequest type {
    channel_id: Str,
    message_id: Str,
    emoji: Str,
    type: Int?,
    after: Str?,
    limit: Int?
}

PinMessageRequest

PinMessageRequest type {
    channel_id: Str,
    message_id: Str,
    reason: Str?
}

UnpinMessageRequest

UnpinMessageRequest type {
    channel_id: Str,
    message_id: Str,
    reason: Str?
}