Skip to main content

Overview

The rest namespace provides low-level bindings to Discord’s REST API. These functions map directly to Rust ops and give you fine-grained control over Discord interactions.
Most bot use cases are better served by the higher-level SDK functions (ctx.reply(), ctx.edit(), etc.). Use rest only when you need direct API access.

Message Operations

sendMessage()

Send a message to a channel.
rest.sendMessage(args: RawSendMessage): Promise<void>
args
RawSendMessage
required
Message payload including channel ID, content, embeds, components, etc.
Example:
await rest.sendMessage({
  channelId: '123456789',
  content: 'Hello from the rest API!',
  embeds: [myEmbed],
  components: [actionRow]
})

editMessage()

Edit an existing message.
rest.editMessage(args: RawEditMessage): Promise<void>

deleteMessage()

Delete a message.
rest.deleteMessage(args: RawDeleteMessage): Promise<void>

bulkDeleteMessages()

Delete multiple messages at once (2-100 messages).
rest.bulkDeleteMessages(args: RawBulkDeleteMessages): Promise<void>

fetchMessage()

Fetch a specific message by ID.
rest.fetchMessage(args: RawFetchMessage): Promise<JsonValue>

fetchMessages()

Fetch multiple messages from a channel.
rest.fetchMessages(args: RawFetchMessages): Promise<JsonValue[]>

pinMessage()

Pin a message to a channel.
rest.pinMessage(args: RawPinMessage): Promise<void>

unpinMessage()

Unpin a message from a channel.
rest.unpinMessage(args: RawPinMessage): Promise<void>

crosspostMessage()

Crosspost a message to announcement channels.
rest.crosspostMessage(args: RawCrosspostMessage): Promise<JsonValue>

Reaction Operations

addReaction()

Add a reaction to a message.
rest.addReaction(args: RawReaction): Promise<void>

removeReaction()

Remove a reaction from a message.
rest.removeReaction(args: RawReaction): Promise<void>

clearReactions()

Clear all reactions from a message.
rest.clearReactions(args: RawClearReactions): Promise<void>

Interaction Operations

sendInteractionResponse()

Send an initial response to an interaction.
rest.sendInteractionResponse(args: RawInteractionResponse): Promise<void>

deferInteractionResponse()

Defer an interaction response (shows “thinking” state).
rest.deferInteractionResponse(args: RawDeferInteractionResponse): Promise<void>

updateInteractionResponse()

Update the initial interaction response.
rest.updateInteractionResponse(args: RawUpdateInteractionResponse): Promise<void>

editOriginalInteractionResponse()

Edit the original interaction response.
rest.editOriginalInteractionResponse(args: RawEditInteractionResponse): Promise<JsonValue>

deleteOriginalInteractionResponse()

Delete the original interaction response.
rest.deleteOriginalInteractionResponse(args: RawDeleteInteractionResponse): Promise<void>

createFollowupMessage()

Create a followup message to an interaction.
rest.createFollowupMessage(args: RawFollowupMessage): Promise<JsonValue>

editFollowupMessage()

Edit a followup message.
rest.editFollowupMessage(args: RawFollowupMessage): Promise<JsonValue>

deleteFollowupMessage()

Delete a followup message.
rest.deleteFollowupMessage(args: RawDeleteFollowupMessage): Promise<void>

Command Operations

upsertGuildCommands()

Create or update all guild slash commands at once.
rest.upsertGuildCommands(args: RawUpsertGuildCommands): Promise<void>

createGuildCommand()

Create a new guild slash command.
rest.createGuildCommand(args: RawCreateGuildCommand): Promise<JsonValue>

editGuildCommand()

Edit an existing guild command.
rest.editGuildCommand(args: RawEditGuildCommand): Promise<JsonValue>

deleteGuildCommand()

Delete a guild command.
rest.deleteGuildCommand(args: RawDeleteGuildCommand): Promise<void>

getGuildCommands()

Get all guild commands.
rest.getGuildCommands(args: RawGuildId): Promise<JsonValue[]>

getGuildCommand()

Get a specific guild command by ID.
rest.getGuildCommand(args: RawGetGuildCommand): Promise<JsonValue>

editGuildCommandPermissions()

Edit permissions for a guild command.
rest.editGuildCommandPermissions(args: RawCommandPermissions): Promise<JsonValue>

getGuildCommandsPermissions()

Get permissions for all guild commands.
rest.getGuildCommandsPermissions(args: RawGuildId): Promise<JsonValue[]>

getGuildCommandPermissions()

Get permissions for a specific guild command.
rest.getGuildCommandPermissions(args: RawGetGuildCommand): Promise<JsonValue>

Member Operations

kickMember()

Kick a member from the guild.
rest.kickMember(args: RawGuildUser): Promise<void>

banMember()

Ban a member from the guild.
rest.banMember(args: RawBanMember): Promise<void>

unbanMember()

Unban a member from the guild.
rest.unbanMember(args: RawGuildUser): Promise<void>

addMemberRole()

Add a role to a member.
rest.addMemberRole(args: RawMemberRole): Promise<void>

removeMemberRole()

Remove a role from a member.
rest.removeMemberRole(args: RawMemberRole): Promise<void>

editMember()

Edit member properties (nickname, roles, etc.).
rest.editMember(args: RawEditMember): Promise<JsonValue>

Channel Operations

createChannel()

Create a new channel in the guild.
rest.createChannel(args: RawCreateChannel): Promise<JsonValue>

editChannel()

Edit channel properties.
rest.editChannel(args: RawEditChannel): Promise<JsonValue>

deleteChannel()

Delete a channel.
rest.deleteChannel(args: RawDeleteChannel): Promise<JsonValue>

Thread Operations

createThread()

Create a new thread in a channel.
rest.createThread(args: RawCreateThread): Promise<JsonValue>

createThreadFromMessage()

Create a thread from an existing message.
rest.createThreadFromMessage(args: RawCreateThreadFromMessage): Promise<JsonValue>

joinThread()

Join a thread.
rest.joinThread(args: RawThreadId): Promise<void>

leaveThread()

Leave a thread.
rest.leaveThread(args: RawThreadId): Promise<void>

addThreadMember()

Add a member to a thread.
rest.addThreadMember(args: RawThreadMember): Promise<void>

removeThreadMember()

Remove a member from a thread.
rest.removeThreadMember(args: RawThreadMember): Promise<void>

Webhook Operations

executeWebhook()

Execute a webhook.
rest.executeWebhook(args: RawExecuteWebhook): Promise<JsonValue | null>

editWebhook()

Edit webhook properties.
rest.editWebhook(args: RawEditWebhook): Promise<JsonValue>

deleteWebhook()

Delete a webhook.
rest.deleteWebhook(args: RawDeleteWebhook): Promise<void>

Type Exports

The rest module also exports commonly-used types:
export type { RawAllowedMentions, RawAttachment }

Usage Notes

All rest functions are async and return Promises. Most operations return Promise<void> on success, while fetch operations return Promise<JsonValue> or Promise<JsonValue[]>.
These are low-level operations that bypass flora’s convenience wrappers. Make sure you understand the Discord API before using these directly.

When to Use rest

Use rest when you need to:
  • Perform operations not available through high-level SDK functions
  • Implement custom Discord bot patterns
  • Access Discord API features not yet wrapped by the SDK
  • Build advanced moderation or management tools
For most use cases, prefer the high-level SDK functions like ctx.reply(), ctx.edit(), and the command/event system.

Build docs developers (and LLMs) love