Overview
Therest 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.
Message Operations
sendMessage()
Send a message to a channel.Message payload including channel ID, content, embeds, components, etc.
editMessage()
Edit an existing message.deleteMessage()
Delete a message.bulkDeleteMessages()
Delete multiple messages at once (2-100 messages).fetchMessage()
Fetch a specific message by ID.fetchMessages()
Fetch multiple messages from a channel.pinMessage()
Pin a message to a channel.unpinMessage()
Unpin a message from a channel.crosspostMessage()
Crosspost a message to announcement channels.Reaction Operations
addReaction()
Add a reaction to a message.removeReaction()
Remove a reaction from a message.clearReactions()
Clear all reactions from a message.Interaction Operations
sendInteractionResponse()
Send an initial response to an interaction.deferInteractionResponse()
Defer an interaction response (shows “thinking” state).updateInteractionResponse()
Update the initial interaction response.editOriginalInteractionResponse()
Edit the original interaction response.deleteOriginalInteractionResponse()
Delete the original interaction response.createFollowupMessage()
Create a followup message to an interaction.editFollowupMessage()
Edit a followup message.deleteFollowupMessage()
Delete a followup message.Command Operations
upsertGuildCommands()
Create or update all guild slash commands at once.createGuildCommand()
Create a new guild slash command.editGuildCommand()
Edit an existing guild command.deleteGuildCommand()
Delete a guild command.getGuildCommands()
Get all guild commands.getGuildCommand()
Get a specific guild command by ID.editGuildCommandPermissions()
Edit permissions for a guild command.getGuildCommandsPermissions()
Get permissions for all guild commands.getGuildCommandPermissions()
Get permissions for a specific guild command.Member Operations
kickMember()
Kick a member from the guild.banMember()
Ban a member from the guild.unbanMember()
Unban a member from the guild.addMemberRole()
Add a role to a member.removeMemberRole()
Remove a role from a member.editMember()
Edit member properties (nickname, roles, etc.).Channel Operations
createChannel()
Create a new channel in the guild.editChannel()
Edit channel properties.deleteChannel()
Delete a channel.Thread Operations
createThread()
Create a new thread in a channel.createThreadFromMessage()
Create a thread from an existing message.joinThread()
Join a thread.leaveThread()
Leave a thread.addThreadMember()
Add a member to a thread.removeThreadMember()
Remove a member from a thread.Webhook Operations
executeWebhook()
Execute a webhook.editWebhook()
Edit webhook properties.deleteWebhook()
Delete a webhook.Type Exports
Therest module also exports commonly-used types:
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[]>.When to Use rest
Userest 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
ctx.reply(), ctx.edit(), and the command/event system.