restEndpoints
Documentation / @discordeno/rest / restEndpoints
Variable: restEndpoints
constrestEndpoints:object
Defined in: endpoints.ts:171
Internal
You are not supposed to use the functions in this object directly. Use the RestManager instead.
Type Declaration
addDmRecipient()
addDmRecipient(
rest,channelId,userId,options):Promise<void>
Adds a recipient to a group DM.
Parameters
rest
channelId
The ID of the group dm to add the user to.
userId
The user ID of the user to add to the group dm.
options
The options for adding the user
Returns
Promise<void>
Remarks
Requires an OAuth2 access token with the gdm.join scope
See
https://docs.discord.com/developers/resources/channel#group-dm-add-recipient
addGuildMember()
addGuildMember(
rest,guildId,userId,options):Promise<void>
Adds a member to a guild.
Parameters
rest
guildId
The ID of the thread to add the member to.
userId
The user ID of the member to add to the thread.
options
The options for the add of a guild member
Returns
Promise<void>
Remarks
Requires the bot to be in the specified server
Requires an OAuth2 access token with the guilds.join scope
Fires a Guild Member Add gateway event.
See
https://docs.discord.com/developers/resources/guild#add-guild-member
addMemberToLobby()
addMemberToLobby(
rest,lobbyId,userId,options):Promise<DiscordLobbyMember>
Adds the provided user to the specified lobby. If called when the user is already a member of the lobby will update fields such as metadata on that user instead.
Parameters
rest
lobbyId
The ID of the lobby to add the user to
userId
The ID of the user to add to the lobby
options
The options to add the user to the lobby
Returns
Promise<DiscordLobbyMember>
The lobby member object
addReaction()
addReaction(
rest,channelId,messageId,reaction):Promise<void>
Adds a reaction to a message.
Parameters
rest
channelId
The ID of the channel the message to add a reaction to is in.
messageId
The ID of the message to add a reaction to.
reaction
string
The reaction to add to the message.
Returns
Promise<void>
Remarks
Requires the READ_MESSAGE_HISTORY permission.
If nobody else has reacted to the message:
- Requires the
ADD_REACTIONSpermission.
Fires a Message Reaction Add gateway event.
See
https://docs.discord.com/developers/resources/channel#create-reaction
addReactions()
addReactions(
rest,channelId,messageId,reactions,ordered?):Promise<void>
Adds multiple a reaction to a message.
This function uses the addReaction() helper behind the scenes.
Parameters
rest
channelId
The ID of the channel the message to add reactions to is in.
messageId
The ID of the message to add the reactions to.
reactions
string[]
The reactions to add to the message.
ordered?
boolean
Whether the reactions must be added in order or not.
Returns
Promise<void>
Remarks
Requires the READ_MESSAGE_HISTORY permission.
If nobody else has reacted to the message:
- Requires the
ADD_REACTIONSpermission.
Fires a Message Reaction Add gateway event for every reaction added.
addRole()
addRole(
rest,guildId,userId,roleId,reason?):Promise<void>
Adds a role to a member.
Parameters
rest
guildId
The ID of the guild the member to add the role to is in.
userId
The user ID of the member to add the role to.
roleId
The ID of the role to add to the member.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Remarks
Requires the MANAGE_ROLES permission.
Fires a Guild Member Update gateway event.
See
https://docs.discord.com/developers/resources/guild#add-guild-member-role
addThreadMember()
addThreadMember(
rest,channelId,userId):Promise<void>
Adds a member to a thread.
Parameters
rest
channelId
The ID of the thread to add the member to.
userId
The user ID of the member to add to the thread.
Returns
Promise<void>
Remarks
Requires the ability to send messages in the thread. Requires the thread not be archived.
Fires a Thread Members Update gateway event.
See
https://docs.discord.com/developers/resources/channel#add-thread-member
banMember()
banMember(
rest,guildId,userId,options?,reason?):Promise<void>
Bans a user from a guild.
Parameters
rest
guildId
The ID of the guild to ban the user from.
userId
The ID of the user to ban from the guild.
options?
The parameters for the creation of the ban.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Remarks
Requires the BAN_MEMBERS permission.
Fires a Guild Ban Add gateway event.
See
https://docs.discord.com/developers/resources/guild#create-guild-ban
bulkBanMembers()
bulkBanMembers(
rest,guildId,options,reason?):Promise<DiscordBulkBan>
Bans up to 200 users from a guild.
Parameters
rest
guildId
The ID of the guild to ban the users from.
options
The users to ban and the other options for the ban.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordBulkBan>
Remarks
Requires the BAN_MEMBERS and MANAGE_GUILD permissions.
If all provided users fail to be banned, discord will respond with an error (code: 500000: Failed to ban users)
Fires as many Guild Ban Add gateway events as many user where banned.
See
https://docs.discord.com/developers/resources/guild#bulk-guild-ban
bulkUpdateLobbyMembers()
bulkUpdateLobbyMembers(
rest,lobbyId,options):Promise<DiscordLobbyMember[]>
Adds, updates, or removes up to 25 members from the specified lobby in a single request.
Parameters
rest
lobbyId
The ID of the lobby to add, update, or remove members from
options
The options to add, update, or remove members from the lobby
Returns
Promise<DiscordLobbyMember[]>
Returns an array of lobby member objects for the upserted members. Removed members are not included in the response.
Remarks
Members with remove_member: false (the default) are upserted — added if not present, or updated with the provided metadata and flags if already a member. Members with remove_member: true are removed.
Users unknown to Discord will return a 404 UNKNOWN_USER error. Users that fail permission checks or who have already reached the maximum number of lobbies per application (and are not already a member of this lobby) are silently dropped from the upsert set.
See
https://docs.discord.com/developers/resources/lobby#bulk-update-lobby-members
consumeEntitlement()
consumeEntitlement(
rest,applicationId,entitlementId):Promise<void>
For One-Time Purchase consumable SKUs, marks a given entitlement for the user as consumed. The entitlement will have consumed: true when using List Entitlements
Parameters
rest
applicationId
The id of the application to get the entitlement
entitlementId
The id of the entitlement to get
Returns
Promise<void>
createApplicationEmoji()
createApplicationEmoji(
rest,options):Promise<DiscordEmoji>
Creates an emoji for the application.
Parameters
rest
options
The parameters for the creation of the emoji.
Returns
Promise<DiscordEmoji>
An instance of the created DiscordEmoji.
See
https://docs.discord.com/developers/resources/emoji#create-application-emoji
createAutomodRule()
createAutomodRule(
rest,guildId,options,reason?):Promise<DiscordAutoModerationRule>
Creates an automod rule in a guild.
Parameters
rest
guildId
The ID of the guild to create the rule in.
options
CreateAutoModerationRuleOptions
The parameters for the creation of the rule.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordAutoModerationRule>
An instance of the created DiscordAutoModerationRule.
Remarks
Requires the MANAGE_GUILD permission.
Fires an Auto Moderation Rule Create gateway event.
See
https://docs.discord.com/developers/resources/auto-moderation#create-auto-moderation-rule
createChannel()
createChannel(
rest,guildId,options,reason?):Promise<DiscordChannel>
Creates a channel within a guild.
Parameters
rest
guildId
The ID of the guild to create the channel within.
options
The parameters for the creation of the channel.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordChannel>
An instance of the created DiscordChannel.
Remarks
Requires the MANAGE_CHANNELS permission.
If setting permission overwrites, only the permissions the bot user has in the guild can be allowed or denied.
Setting the MANAGE_ROLES permission is only possible for guild administrators.
Fires a Channel Create gateway event.
See
https://docs.discord.com/developers/resources/guild#create-guild-channel
createEmoji()
createEmoji(
rest,guildId,options,reason?):Promise<DiscordEmoji>
Creates an emoji in a guild.
Parameters
rest
guildId
The ID of the guild in which to create the emoji.
options
The parameters for the creation of the emoji.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordEmoji>
An instance of the created DiscordEmoji.
Remarks
Requires the CREATE_GUILD_EXPRESSIONS permission.
Emojis have a maximum file size of 256 kilobits. Attempting to upload a larger emoji will cause the route to return 400 Bad Request.
Fires a Guild Emojis Update gateway event.
See
https://docs.discord.com/developers/resources/emoji#create-guild-emoji
createForumThread()
createForumThread(
rest,channelId,options,reason?):Promise<DiscordChannel>
Creates a new thread in a forum channel or media channel, and sends a message within the created thread.
Parameters
rest
channelId
The ID of the forum channel to create the thread within.
options
The parameters for the creation of the thread.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordChannel>
An instance of DiscordChannel with a nested DiscordChannel object.
Remarks
Requires the CREATE_MESSAGES permission.
Fires a Thread Create gateway event. Fires a Message Create gateway event.
See
https://docs.discord.com/developers/resources/channel#start-thread-in-forum-or-media-channel
createGlobalApplicationCommand()
createGlobalApplicationCommand(
rest,command,options?):Promise<DiscordApplicationCommand>
Creates an application command accessible globally; across different guilds and channels.
Parameters
rest
command
The command to create.
options?
CreateGlobalApplicationCommandOptions
Additional options for the endpoint
Returns
Promise<DiscordApplicationCommand>
An instance of the created DiscordApplicationCommand.
Remarks
⚠️ Creating a command with the same name as an existing command for your application will overwrite the old command. ⚠️ Global commands once created are cached for periods of an hour, so changes made to existing commands will take an hour to surface. ⚠️ You can only create up to 200 new commands daily.
When using the bearer token the token needs the applications.commands.update scope and must be a Client grant token.
You will be able to update only your own application commands
See
createGuildApplicationCommand()
createGuildApplicationCommand(
rest,command,guildId,options?):Promise<DiscordApplicationCommand>
Creates an application command only accessible in a specific guild.
Parameters
rest
command
The command to create.
guildId
The ID of the guild to create the command for.
options?
CreateGuildApplicationCommandOptions
Additional options for the endpoint
Returns
Promise<DiscordApplicationCommand>
An instance of the created DiscordApplicationCommand.
Remarks
⚠️ Creating a command with the same name as an existing command for your application will overwrite the old command. ⚠️ You can only create up to 200 new commands daily.
When using the bearer token the token needs the applications.commands.update scope and must be a Client grant token.
You will be able to update only your own application commands
See
createGuildSoundboardSound()
createGuildSoundboardSound(
rest,guildId,options,reason?):Promise<DiscordSoundboardSound>
Create a new soundboard sound for the guild.
Parameters
rest
guildId
The guild to create the sounds in
options
The options to create the sound
reason?
string
The audit log reason
Returns
Promise<DiscordSoundboardSound>
Remarks
Fires a Guild Soundboard Sound Create Gateway event.
Requires the CREATE_GUILD_EXPRESSIONS permission.
createGuildSticker()
createGuildSticker(
rest,guildId,options,reason?):Promise<DiscordSticker>
Create a new sticker for the guild.
Parameters
rest
guildId
The ID of the guild to get
options
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordSticker>
Remarks
Requires the CREATE_GUILD_EXPRESSIONS permission.
Fires a Guild Stickers Update Gateway event.
Every guilds has five free sticker slots by default, and each Boost level will grant access to more slots.
Lottie stickers can only be uploaded on guilds that have either the VERIFIED and/or the PARTNERED guild feature.
See
https://docs.discord.com/developers/resources/sticker#create-guild-sticker
createGuildTemplate()
createGuildTemplate(
rest,guildId,options):Promise<DiscordTemplate>
Creates a template from a guild.
Parameters
rest
guildId
The ID of the guild to create the template from.
options
The parameters for the creation of the template.
Returns
Promise<DiscordTemplate>
An instance of the created DiscordTemplate.
Remarks
Requires the MANAGE_GUILD permission.
Fires a Guild Update gateway event.
See
https://docs.discord.com/developers/resources/guild-template#create-guild-template
createInvite()
createInvite(
rest,channelId,options?,reason?):Promise<DiscordInvite>
Creates an invite to a channel in a guild.
Parameters
rest
channelId
The ID of the channel to create the invite to.
options?
The parameters for the creation of the invite.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordInvite>
An instance of the created DiscordInvite.
Remarks
Requires the CREATE_INSTANT_INVITE permission.
Fires an Invite Create gateway event.
See
https://docs.discord.com/developers/resources/channel#create-channel-invite
createLobby()
createLobby(
rest,options):Promise<DiscordLobby>
Creates a new lobby, adding any of the specified members to it, if provided.
Parameters
rest
options
The options to create the lobby
Returns
Promise<DiscordLobby>
The created lobby
createLobbyChannelInviteForSelf()
createLobbyChannelInviteForSelf(
rest,bearerToken,lobbyId):Promise<DiscordLobbyInvite>
Creates a single-use guild invite to the lobby's linked channel, targeted at the calling user.
Parameters
rest
bearerToken
string
The access token of the user
lobbyId
The ID of the lobby to create the invite for
Returns
Promise<DiscordLobbyInvite>
The created invite object
Remarks
Uses Bearer token for authorization with the sdk.social_layer scope.
The lobby must have a linked channel and the caller must be a member of the lobby. The invite expires after one hour.
createLobbyChannelInviteForUser()
createLobbyChannelInviteForUser(
rest,lobbyId,userId):Promise<DiscordLobbyInvite>
Creates a single-use guild invite to the lobby's linked channel on behalf of an application, targeted at the specified user.
Parameters
rest
lobbyId
The ID of the lobby to create the invite for
userId
The ID of the user to create the invite for
Returns
Promise<DiscordLobbyInvite>
The created invite object
Remarks
Uses Bot token for authorization
The lobby must have a linked channel. The invite expires after one hour.
createOrJoinLobby()
createOrJoinLobby(
rest,options):Promise<DiscordLobby>
Creates a new lobby for the application identified by a secret, or joins the calling user to the existing lobby with that secret if one already exists.
Updates lobby metadata and the calling member's metadata on join.
Parameters
rest
options
The options to create or join the lobby
Returns
Promise<DiscordLobby>
- The created or joined lobby
Remarks
Uses Bearer token for authorization with the sdk.social_layer scope.
createRole()
createRole(
rest,guildId,options,reason?):Promise<DiscordRole>
Creates a role in a guild.
Parameters
rest
guildId
The ID of the guild to create the role in.
options
The parameters for the creation of the role.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordRole>
An instance of the created DiscordRole.
Remarks
Requires the MANAGE_ROLES permission.
Fires a Guild Role Create gateway event.
See
https://docs.discord.com/developers/resources/guild#create-guild-role
createScheduledEvent()
createScheduledEvent(
rest,guildId,options,reason?):Promise<DiscordScheduledEvent>
Creates a scheduled event in a guild.
Parameters
rest
guildId
The ID of the guild to create the scheduled event in.
options
The parameters for the creation of the scheduled event.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordScheduledEvent>
An instance of the created DiscordScheduledEvent.
Remarks
Requires the MANAGE_EVENTS permission.
A guild can only have a maximum of 100 events with a status of ScheduledEventStatus.Active or ScheduledEventStatus.Scheduled (inclusive).
Fires a Guild Scheduled Event Create gateway event.
See
https://docs.discord.com/developers/resources/guild-scheduled-event#create-guild-scheduled-event
createStageInstance()
createStageInstance(
rest,options,reason?):Promise<DiscordStageInstance>
Creates a stage instance associated with a stage channel.
Parameters
rest
options
The parameters for the creation of the stage instance.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordStageInstance>
An instance of the created DiscordStageInstance.
Remarks
Requires the user to be a moderator of the stage channel.
Fires a Stage Instance Create gateway event.
See
https://docs.discord.com/developers/resources/stage-instance#create-stage-instance
createTestEntitlement()
createTestEntitlement(
rest,applicationId,body):Promise<Partial<DiscordEntitlement>>
Creates a test entitlement to a given SKU for a given guild or user. Discord will act as though that user or guild has entitlement to your premium offering.
Parameters
rest
applicationId
The id of the application to create the entitlement
body
The options for new entitlement
Returns
Promise<Partial<DiscordEntitlement>>
Remarks
This endpoint returns a partial entitlement object. It will not contain subscription_id, starts_at, or ends_at, as it's valid in perpetuity.
createWebhook()
createWebhook(
rest,channelId,options,reason?):Promise<DiscordWebhook>
Creates a webhook.
Parameters
rest
channelId
The ID of the channel to create the webhook in.
options
The parameters for the creation of the webhook.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordWebhook>
An instance of the created DiscordWebhook.
Remarks
Requires the MANAGE_WEBHOOKS permission.
⚠️ The webhook name must not contain the substrings 'clyde', or 'discord' (case-insensitive).
Fires a Webhooks Update gateway event.
See
https://docs.discord.com/developers/resources/webhook#create-webhook
deleteApplicationEmoji()
deleteApplicationEmoji(
rest,id):Promise<void>
Deletes an emoji from the application.
Parameters
rest
id
The ID of the emoji to delete.
Returns
Promise<void>
See
https://docs.discord.com/developers/resources/emoji#delete-application-emoji
deleteAutomodRule()
deleteAutomodRule(
rest,guildId,ruleId,reason?):Promise<void>
Deletes an automod rule.
Parameters
rest
guildId
The ID of the guild to delete the rule from.
ruleId
The ID of the automod rule to delete.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Remarks
Requires the MANAGE_GUILD permission.
Fires an Auto Moderation Rule Delete gateway event.
See
https://docs.discord.com/developers/resources/auto-moderation#delete-auto-moderation-rule
deleteChannel()
deleteChannel(
rest,channelId,reason?):Promise<void>
Deletes a channel from within a guild.
Parameters
rest
channelId
The ID of the channel to delete.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
nothing
Remarks
For community guilds, the Rules, Guidelines and Community Update channels cannot be deleted.
If the channel is a thread:
-
Requires the
MANAGE_THREADSpermission. -
Fires a Thread Delete gateway event.
Otherwise:
-
Requires the
MANAGE_CHANNELSpermission. -
⚠️ Deleting a category channel does not delete its child channels. Instead, they will have their
parent_idproperty removed, and aChannel Updategateway event will fire for each of them. -
Fires a Channel Delete gateway event.
See
https://docs.discord.com/developers/resources/channel#deleteclose-channel
deleteChannelPermissionOverride()
deleteChannelPermissionOverride(
rest,channelId,overwriteId,reason?):Promise<void>
Deletes a permission override for a user or role in a channel.
Parameters
rest
channelId
The ID of the channel to delete the permission override of.
overwriteId
The ID of the permission override to delete.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Remarks
Requires the MANAGE_ROLES permission.
Fires a Channel Update gateway event.
See
https://docs.discord.com/developers/resources/channel#delete-channel-permission
deleteCurrentUserApplicationRoleConnection()
deleteCurrentUserApplicationRoleConnection(
rest,bearerToken,applicationId):Promise<void>
Deletes the application role connection for the user.
Parameters
rest
bearerToken
string
The access token of the user
applicationId
The id of the application to delete the role connection
Returns
Promise<void>
Remarks
This requires the role_connections.write scope.
See
https://docs.discord.com/developers/resources/user#delete-current-user-application-role-connection
deleteEmoji()
deleteEmoji(
rest,guildId,id,reason?):Promise<void>
Deletes an emoji from a guild.
Parameters
rest
guildId
The ID of the guild from which to delete the emoji.
id
The ID of the emoji to delete.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Remarks
For emojis created by the current user, requires either the CREATE_GUILD_EXPRESSIONS or MANAGE_GUILD_EXPRESSIONS permission.
For other emojis, requires the MANAGE_GUILD_EXPRESSIONS permission.
Fires a Guild Emojis Update gateway event.
See
https://docs.discord.com/developers/resources/emoji#delete-guild-emoji
deleteFollowupMessage()
deleteFollowupMessage(
rest,token,messageId):Promise<void>
Deletes a follow-up message to an interaction.
Parameters
rest
token
string
The interaction token to use, provided in the original interaction.
messageId
The ID of the message to delete.
Returns
Promise<void>
Remarks
Unlike deleteMessage(), this endpoint allows the bot user to act without needing to see the channel the message is in.
Fires a Message Delete event.
See
https://docs.discord.com/developers/interactions/receiving-and-responding#delete-followup-message
deleteGlobalApplicationCommand()
deleteGlobalApplicationCommand(
rest,commandId):Promise<void>
Deletes an application command registered globally.
Parameters
rest
commandId
The ID of the command to delete.
Returns
Promise<void>
See
deleteGuildApplicationCommand()
deleteGuildApplicationCommand(
rest,commandId,guildId):Promise<void>
Deletes an application command registered in a guild.
Parameters
rest
commandId
The ID of the command to delete from the guild.
guildId
The ID of the guild to delete the command from.
Returns
Promise<void>
See
deleteGuildSoundboardSound()
deleteGuildSoundboardSound(
rest,guildId,soundId,reason?):Promise<void>
Delete the given soundboard sound.
Parameters
rest
guildId
The guild to create the sounds in
soundId
The sound id to delete
reason?
string
The audit log reason
Returns
Promise<void>
Remarks
Fires a Guild Soundboard Sound Delete Gateway event.
For sounds created by the current user, requires either the CREATE_GUILD_EXPRESSIONS or MANAGE_GUILD_EXPRESSIONS permission.
For other sounds, requires the MANAGE_GUILD_EXPRESSIONS permission.
deleteGuildSticker()
deleteGuildSticker(
rest,guildId,stickerId,reason?):Promise<void>
Delete a new sticker for the guild.
Parameters
rest
guildId
The ID of the guild to get
stickerId
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Remarks
For stickers created by the current user, requires either the CREATE_GUILD_EXPRESSIONS or MANAGE_GUILD_EXPRESSIONS permission.
For other stickers, requires the MANAGE_GUILD_EXPRESSIONS permission.
Fires a Guild Stickers Update Gateway event.
Every guilds has five free sticker slots by default, and each Boost level will grant access to more slots.
Lottie stickers can only be uploaded on guilds that have either the VERIFIED and/or the PARTNERED guild feature.
See
https://docs.discord.com/developers/resources/sticker#delete-guild-sticker
deleteGuildTemplate()
deleteGuildTemplate(
rest,guildId,templateCode):Promise<void>
Deletes a template from a guild.
Parameters
rest
guildId
The ID of the guild to delete the template from.
templateCode
string
The code of the template to delete.
Returns
Promise<void>
Remarks
Requires the MANAGE_GUILD permission.
Fires a Guild Update gateway event.
See
https://docs.discord.com/developers/resources/guild-template#delete-guild-template
deleteIntegration()
deleteIntegration(
rest,guildId,integrationId,reason?):Promise<void>
Deletes an integration attached to a guild.
Parameters
rest
guildId
The ID of the guild from which to delete the integration.
integrationId
The ID of the integration to delete from the guild.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Remarks
Requires the MANAGE_GUILD permission.
Deletes all webhooks associated with the integration, and kicks the associated bot if there is one.
Fires a Guild Integrations Update gateway event. Fires a Integration Delete gateway event.
See
https://docs.discord.com/developers/resources/guild#delete-guild-integration
deleteInvite()
deleteInvite(
rest,inviteCode,reason?):Promise<void>
Deletes an invite to a channel.
Parameters
rest
inviteCode
string
The invite code of the invite to delete.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Remarks
Requires the MANAGE_CHANNELS permission.
Fires an Invite Delete gateway event.
See
https://docs.discord.com/developers/resources/channel#delete-channel-invite
deleteLobby()
deleteLobby(
rest,lobbyId):Promise<void>
Deletes the specified lobby if it exists.
It is safe to call even if the lobby is already deleted as well.
Parameters
rest
lobbyId
The ID of the lobby to delete
Returns
Promise<void>
Nothing
deleteMessage()
deleteMessage(
rest,channelId,messageId,reason?):Promise<void>
Deletes a message from a channel.
Parameters
rest
channelId
The ID of the channel to delete the message from.
messageId
The ID of the message to delete from the channel.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Remarks
If not deleting own message:
- Requires the
MANAGE_MESSAGESpermission.
Fires a Message Delete gateway event.
See
https://docs.discord.com/developers/resources/channel#delete-message
deleteMessages()
deleteMessages(
rest,channelId,messageIds,reason?):Promise<void>
Deletes multiple messages from a channel.
Parameters
rest
channelId
The ID of the channel to delete the messages from.
messageIds
The IDs of the messages to delete from the channel.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Remarks
Requires the MANAGE_MESSAGES permission.
⚠️ Messages older than 2 weeks old cannot be deleted.
Fires a Message Delete Bulk gateway event.
See
https://docs.discord.com/developers/resources/channel#bulk-delete-messages
deleteOriginalInteractionResponse()
deleteOriginalInteractionResponse(
rest,token):Promise<void>
Deletes the initial message response to an interaction.
Parameters
rest
token
string
The interaction token to use, provided in the original interaction.
Returns
Promise<void>
Remarks
Unlike deleteMessage(), this endpoint allows the bot user to act without needing to see the channel the message is in.
Fires a Message Delete event.
See
deleteOwnReaction()
deleteOwnReaction(
rest,channelId,messageId,reaction):Promise<void>
Deletes a reaction added by the bot user from a message.
Parameters
rest
channelId
The ID of the channel the message to delete the reaction from is in.
messageId
The ID of the message to delete the reaction from.
reaction
string
The reaction to delete from the message.
Returns
Promise<void>
Remarks
Requires the READ_MESSAGE_HISTORY permission.
Fires a Message Reaction Remove gateway event.
See
https://docs.discord.com/developers/resources/channel#delete-own-reaction
deleteReactionsAll()
deleteReactionsAll(
rest,channelId,messageId):Promise<void>
Deletes all reactions for all emojis from a message.
Parameters
rest
channelId
The ID of the channel the message to delete the reactions from is in.
messageId
The ID of the message to delete the reactions from.
Returns
Promise<void>
Remarks
Requires the READ_MESSAGE_HISTORY permission.
Requires the MANAGE_MESSAGES permission.
Fires a Message Reaction Remove All gateway event.
See
https://docs.discord.com/developers/resources/channel#delete-all-reactions
deleteReactionsEmoji()
deleteReactionsEmoji(
rest,channelId,messageId,reaction):Promise<void>
Deletes all reactions for an emoji from a message.
Parameters
rest
channelId
The ID of the channel the message to delete the reactions from is in.
messageId
The ID of the message to delete the reactions from.
reaction
string
The reaction to remove from the message.
Returns
Promise<void>
Remarks
Requires the READ_MESSAGE_HISTORY permission.
Requires the MANAGE_MESSAGES permission.
Fires a Message Reaction Remove Emoji gateway event.
See
https://docs.discord.com/developers/resources/channel#delete-all-reactions-for-emoji
deleteRole()
deleteRole(
rest,guildId,roleId,reason?):Promise<void>
Deletes a role from a guild.
Parameters
rest
guildId
The ID of the guild to delete the role from.
roleId
The ID of the role to delete.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Remarks
Requires the MANAGE_ROLES permission.
Fires a Guild Role Delete gateway event.
See
https://docs.discord.com/developers/resources/guild#delete-guild-role
deleteScheduledEvent()
deleteScheduledEvent(
rest,guildId,eventId):Promise<void>
Deletes a scheduled event from a guild.
Parameters
rest
guildId
The ID of the guild to delete the scheduled event from.
eventId
The ID of the scheduled event to delete.
Returns
Promise<void>
Remarks
Requires the MANAGE_EVENTS permission.
Fires a Guild Scheduled Event Delete gateway event.
See
https://docs.discord.com/developers/resources/guild-scheduled-event#delete-guild-scheduled-event
deleteStageInstance()
deleteStageInstance(
rest,channelId,reason?):Promise<void>
Deletes the stage instance associated with a stage channel, if one exists.
Parameters
rest
channelId
The ID of the stage channel the stage instance is associated with.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Remarks
Requires the user to be a moderator of the stage channel.
Fires a Stage Instance Delete gateway event.
See
https://docs.discord.com/developers/resources/stage-instance#delete-stage-instance
deleteTestEntitlement()
deleteTestEntitlement(
rest,applicationId,entitlementId):Promise<void>
Deletes a currently-active test entitlement. Discord will act as though that user or guild no longer has entitlement to your premium offering.
Parameters
rest
applicationId
The id of the application from where delete the entitlement
entitlementId
The id of the entitlement to delete
Returns
Promise<void>
deleteUserReaction()
deleteUserReaction(
rest,channelId,messageId,userId,reaction):Promise<void>
Deletes a user's reaction from a message.
Parameters
rest
channelId
The ID of the channel the message to delete the reaction from is in.
messageId
The ID of the message to delete the reaction from.
userId
The ID of the user whose reaction to delete.
reaction
string
The reaction to delete from the message.
Returns
Promise<void>
Remarks
Requires the READ_MESSAGE_HISTORY permission.
Requires the MANAGE_MESSAGES permission.
Fires a Message Reaction Remove gateway event.
See
https://docs.discord.com/developers/resources/channel#delete-user-reaction
deleteWebhook()
deleteWebhook(
rest,webhookId,reason?):Promise<void>
Deletes a webhook.
Parameters
rest
webhookId
The ID of the webhook to delete.
reason?
string
Returns
Promise<void>
Remarks
Requires the MANAGE_WEBHOOKS permission.
Fires a Webhooks Update gateway event.
See
https://docs.discord.com/developers/resources/webhook#delete-webhook
deleteWebhookMessage()
deleteWebhookMessage(
rest,webhookId,token,messageId,options?):Promise<void>
Deletes a webhook message.
Parameters
rest
webhookId
The ID of the webhook to delete the message belonging to.
token
string
The webhook token, used to manage the webhook.
messageId
The ID of the message to delete.
options?
The parameters for the deletion of the message.
Returns
Promise<void>
Remarks
Fires a Message Delete gateway event.
See
https://docs.discord.com/developers/resources/webhook#delete-webhook
deleteWebhookWithToken()
deleteWebhookWithToken(
rest,webhookId,token):Promise<void>
Deletes a webhook message using the webhook token, thereby bypassing the need for authentication + permissions.
Parameters
rest
webhookId
The ID of the webhook to delete the message belonging to.
token
string
The webhook token, used to delete the webhook.
Returns
Promise<void>
Remarks
Fires a Message Delete gateway event.
See
https://docs.discord.com/developers/resources/webhook#delete-webhook-with-token
editApplicationCommandPermissions()
editApplicationCommandPermissions(
rest,guildId,commandId,bearerToken,options):Promise<DiscordGuildApplicationCommandPermissions>
Edits the permissions for a guild application command.
Parameters
rest
guildId
The ID of the guild the command is registered in.
commandId
The ID of the command to edit the permissions of.
bearerToken
string
The bearer token to use to make the request.
options
object[]
The parameters for the edit of the command permissions.
Returns
Promise<DiscordGuildApplicationCommandPermissions>
An instance of the edited DiscordGuildApplicationCommandPermissions.
Remarks
The bearer token requires the applications.commands.permissions.update scope to be enabled, and to have access to the guild whose ID has been provided in the parameters.
See
editApplicationEmoji()
editApplicationEmoji(
rest,id,options):Promise<DiscordEmoji>
Edits an application emoji.
Parameters
rest
id
The ID of the emoji to edit.
options
The parameters for the edit of the emoji.
Returns
Promise<DiscordEmoji>
An instance of the updated DiscordEmoji.
See
https://docs.discord.com/developers/resources/emoji#modify-application-emoji
editApplicationInfo()
editApplicationInfo(
rest,body):Promise<DiscordApplication>
Edit properties of the app associated with the requesting bot user.
Parameters
rest
body
Returns
Promise<DiscordApplication>
Remarks
Only properties that are passed will be updated.
editAutomodRule()
editAutomodRule(
rest,guildId,ruleId,options,reason?):Promise<DiscordAutoModerationRule>
Edits an automod rule.
Parameters
rest
guildId
The ID of the guild to edit the rule in.
ruleId
The ID of the rule to edit.
options
Partial<EditAutoModerationRuleOptions>
The parameters for the edit of the rule.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordAutoModerationRule>
An instance of the edited DiscordAutoModerationRule.
Remarks
Requires the MANAGE_GUILD permission.
Fires an Auto Moderation Rule Update gateway event.
See
https://docs.discord.com/developers/resources/auto-moderation#modify-auto-moderation-rule
editBotProfile()
editBotProfile(
rest,options):Promise<DiscordUser>
Modifies the bot's username, avatar or banner.
Parameters
rest
options
The parameters for the edit of the bot's profile.
botAvatarURL?
string | null
botBannerURL?
string | null
username?
string
Returns
Promise<DiscordUser>
An instance of the edited DiscordUser.
Remarks
Editing the username may cause the bot's discriminator to be randomized.
avatar and banner must to be a Data URI scheme. urlToBase64 from @discordeno/utils can be used to convert a URL to a Data URI scheme.
See
https://docs.discord.com/developers/resources/user#modify-current-user
editChannel()
editChannel(
rest,channelId,options,reason?):Promise<DiscordChannel>
Edits a channel's settings.
Parameters
rest
channelId
The ID of the channel to edit.
options
The parameters for the edit of the channel.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordChannel>
An instance of the edited DiscordChannel.
Remarks
If editing a channel of type ChannelTypes.GroupDm:
- Fires a Channel Update gateway event.
If editing a thread channel:
-
Requires the
MANAGE_THREADSpermission unless if setting thearchivedproperty tofalsewhen thelockedproperty is alsofalse, in which case only theSEND_MESSAGESpermission is required. -
Fires a Thread Update gateway event.
If editing a guild channel:
-
Requires the
MANAGE_CHANNELSpermission. -
If modifying permission overrides:
-
Requires the
MANAGE_ROLESpermission. -
Only permissions the bot user has in the guild or parent channel can be allowed/denied unless the bot user has a
MANAGE_ROLESpermission override in the channel.
-
-
If modifying a channel of type ChannelTypes.GuildCategory:
- Fires a Channel Update gateway event for each child channel impacted in this change.
-
Otherwise:
- Fires a Channel Update gateway event.
editChannelPermissionOverrides()
editChannelPermissionOverrides(
rest,channelId,options,reason?):Promise<void>
Edits the permission overrides for a user or role in a channel.
Parameters
rest
channelId
The ID of the channel to edit the permission overrides of.
options
EditChannelPermissionOverridesOptions
The permission override.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Remarks
Requires the MANAGE_ROLES permission.
Only permissions the bot user has in the guild or parent channel can be allowed/denied unless the bot user has a MANAGE_ROLES permission override in the channel.
Fires a Channel Update gateway event.
See
https://docs.discord.com/developers/resources/channel#edit-channel-permissions
editChannelPositions()
editChannelPositions(
rest,guildId,channelPositions):Promise<void>
Edits the positions of a set of channels in a guild.
Parameters
rest
guildId
The ID of the guild in which to edit the positions of the channels.
channelPositions
A set of objects defining the updated positions of the channels.
Returns
Promise<void>
Remarks
Requires the MANAGE_CHANNELS permission.
Fires a Channel Update gateway event for every channel impacted in this change.
At most one entry per request may change parent_id. A request that changes parent_id for more than one channel fails with a 400 response and error code 40009.
Permissions are checked per entry, based on what the entry changes:
- An entry that only changes
positionrequires theMANAGE_CHANNELSpermission at the guild level (or on the channel's current parent category). It does not require access to the individual channel, so a full reordering may include channels the current user cannot view. - An entry that changes
parent_idrequires theMANAGE_CHANNELSpermission on that channel and on the destination (the new parent category, or the guild when moving the channel out of a category), and the current user must be able to view the channel. Otherwise the request fails with a403response and error code 50001. Settinglock_permissionsadditionally requiresMANAGE_ROLES.
See
https://docs.discord.com/developers/resources/guild#modify-guild-channel-positions
editCurrentMember()
editCurrentMember(
rest,guildId,options,reason?):Promise<DiscordMember>
Edits the nickname of the bot user.
Parameters
rest
guildId
The ID of the guild to edit the nickname of the bot user in.
options
The parameters for the edit of the nickname.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordMember>
An instance of the edited DiscordMember
Remarks
Fires a Guild Member Update gateway event.
See
https://docs.discord.com/developers/resources/guild#modify-current-member
editEmoji()
editEmoji(
rest,guildId,id,options,reason?):Promise<DiscordEmoji>
Edits an emoji.
Parameters
rest
guildId
The ID of the guild in which to edit the emoji.
id
The ID of the emoji to edit.
options
The parameters for the edit of the emoji.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordEmoji>
An instance of the updated DiscordEmoji.
Remarks
For emojis created by the current user, requires either the CREATE_GUILD_EXPRESSIONS or MANAGE_GUILD_EXPRESSIONS permission.
For other emojis, requires the MANAGE_GUILD_EXPRESSIONS permission.
Fires a Guild Emojis Update gateway event.
See
https://docs.discord.com/developers/resources/emoji#modify-guild-emoji
editFollowupMessage()
editFollowupMessage(
rest,token,messageId,options):Promise<DiscordMessage>
Edits a follow-up message to an interaction.
Parameters
rest
token
string
The interaction token to use, provided in the original interaction.
messageId
The ID of the message to edit.
options
The parameters for the edit of the message.
Returns
Promise<DiscordMessage>
An instance of the edited DiscordMessage.
Remarks
Unlike editMessage(), this endpoint allows the bot user to act without needing to see the channel the message is in.
Does not support ephemeral follow-up messages due to these being stateless.
Fires a Message Update event.
See
https://docs.discord.com/developers/interactions/receiving-and-responding#edit-followup-message
editGlobalApplicationCommand()
editGlobalApplicationCommand(
rest,commandId,options):Promise<DiscordApplicationCommand>
Edits a global application command.
Parameters
rest
commandId
The ID of the command to edit.
options
The parameters for the edit of the command.
Returns
Promise<DiscordApplicationCommand>
An instance of the edited DiscordApplicationCommand.
See
editGuild()
editGuild(
rest,guildId,options,reason?):Promise<DiscordGuild>
Edits a guild's settings.
Parameters
rest
guildId
The ID of the guild to edit.
options
The parameters for the edit of the guild.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordGuild>
An instance of the edited DiscordGuild.
Remarks
Requires the MANAGE_GUILD permission.
If attempting to add or remove the GuildFeatures.Community feature:
- Requires the
ADMINISTRATORpermission.
Fires a Guild Update gateway event.
See
https://docs.discord.com/developers/resources/guild#modify-guild
editGuildApplicationCommand()
editGuildApplicationCommand(
rest,commandId,guildId,options):Promise<DiscordApplicationCommand>
Edits an application command registered in a guild.
Parameters
rest
commandId
The ID of the command to edit.
guildId
The ID of the guild the command is registered in.
options
The parameters for the edit of the command.
Returns
Promise<DiscordApplicationCommand>
An instance of the edited DiscordApplicationCommand.
See
https://docs.discord.com/developers/interactions/application-commands#edit-guild-application-command
editGuildOnboarding()
editGuildOnboarding(
rest,guildId,options,reason?):Promise<DiscordGuildOnboarding>
Modifies the onboarding configuration of the guild.
Parameters
rest
guildId
The guild to edit the onboarding from
options
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordGuildOnboarding>
Remarks
Requires the MANAGE_GUILD and MANAGE_ROLES permissions.
Onboarding enforces constraints when enabled. These constraints are:
- at least 7 default channels
- at least 5 of the 7 channels must allow sending messages to the @everyone role
The mode field modifies what is considered when enforcing these constraints.
editGuildSticker()
editGuildSticker(
rest,guildId,stickerId,options,reason?):Promise<DiscordSticker>
Edit the given sticker.
Parameters
rest
guildId
The ID of the guild to get
stickerId
options
AtLeastOne<EditGuildStickerOptions>
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordSticker>
Remarks
For stickers created by the current user, requires either the CREATE_GUILD_EXPRESSIONS or MANAGE_GUILD_EXPRESSIONS permission.
For other stickers, requires the MANAGE_GUILD_EXPRESSIONS permission.
Fires a Guild Stickers Update Gateway event.
See
https://docs.discord.com/developers/resources/sticker#modify-guild-sticker
editGuildTemplate()
editGuildTemplate(
rest,guildId,templateCode,options):Promise<DiscordTemplate>
Edits a template's settings.
Parameters
rest
guildId
The ID of the guild to edit a template of.
templateCode
string
The code of the template to edit.
options
The parameters for the edit of the template.
Returns
Promise<DiscordTemplate>
An instance of the edited DiscordTemplate.
Remarks
Requires the MANAGE_GUILD permission.
Fires a Guild Update gateway event.
See
https://docs.discord.com/developers/resources/guild-template#modify-guild-template
editMember()
editMember(
rest,guildId,userId,options,reason?):Promise<DiscordMember>
Edits a member's properties.
Parameters
rest
guildId
The ID of the guild to edit the member of.
userId
The user ID of the member to edit.
options
The parameters for the edit of the user.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordMember>
Remarks
This endpoint requires various permissions depending on what is edited about the member. To find out the required permission to enact a change, read the documentation of this endpoint's parameters.
Fires a Guild Member Update gateway event.
See
https://docs.discord.com/developers/resources/guild#modify-guild-member
editMessage()
editMessage(
rest,channelId,messageId,options):Promise<DiscordMessage>
Edits a message.
Parameters
rest
channelId
The ID of the channel to edit the message in.
messageId
The IDs of the message to edit.
options
The parameters for the edit of the message.
Returns
Promise<DiscordMessage>
An instance of the edited DiscordMessage.
Remarks
If editing another user's message:
- Requires the
MANAGE_MESSAGESpermission. - Only the flags property of the options object parameter can be edited.
Fires a Message Update gateway event.
See
https://docs.discord.com/developers/resources/channel#edit-message
editOriginalInteractionResponse()
editOriginalInteractionResponse(
rest,token,options):Promise<DiscordMessage>
Edits the initial message response to an interaction.
Parameters
rest
token
string
The interaction token to use, provided in the original interaction.
options
The parameters for the edit of the response.
Returns
Promise<DiscordMessage>
An instance of the edited DiscordMessage.
Remarks
Unlike editMessage(), this endpoint allows the bot user to act without needing to see the channel the message is in.
Does not support ephemeral follow-up messages due to these being stateless.
Fires a Message Update event.
See
editOwnVoiceState()
editOwnVoiceState(
rest,guildId,options):Promise<void>
Edits the voice state of the bot user.
Parameters
rest
guildId
The ID of the guild in which to edit the voice state of the bot user.
options
The parameters for the edit of the voice state.
Returns
Promise<void>
Remarks
The channelId property of the options object parameter must point to a stage channel, and the bot user must already have joined it.
If attempting to unmute oneself:
- Requires the
MUTE_MEMBERSpermission.
If attempting to request to speak:
- Requires the
REQUEST_TO_SPEAKpermission.
See
https://docs.discord.com/developers/resources/voice#modify-current-user-voice-state
editRole()
editRole(
rest,guildId,roleId,options,reason?):Promise<DiscordRole>
Edits a role in a guild.
Parameters
rest
guildId
The ID of the guild to edit the role in.
roleId
The ID of the role to edit.
options
The parameters for the edit of the role.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordRole>
An instance of the edited DiscordRole.
Remarks
Requires the MANAGE_ROLES permission.
Fires a Guild Role Update gateway event.
See
https://docs.discord.com/developers/resources/guild#modify-guild-role
editRolePositions()
editRolePositions(
rest,guildId,options,reason?):Promise<DiscordRole[]>
Edits the positions of a set of roles.
Parameters
rest
guildId
The ID of the guild to edit the role positions in.
options
The parameters for the edit of the role positions.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordRole[]>
A collection of DiscordRole objects assorted by role ID.
Remarks
Requires the MANAGE_ROLES permission.
Fires a Guild Role Update gateway event for every role impacted in this change.
See
https://docs.discord.com/developers/resources/guild#modify-guild-role-positions
editScheduledEvent()
editScheduledEvent(
rest,guildId,eventId,options,reason?):Promise<DiscordScheduledEvent>
Edits a scheduled event.
Parameters
rest
guildId
The ID of the guild to edit the scheduled event in.
eventId
The ID of the scheduled event to edit.
options
Partial<EditScheduledEvent>
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordScheduledEvent>
An instance of the edited DiscordScheduledEvent.
Remarks
Requires the MANAGE_EVENTS permission.
To start or end an event, modify the event's status property.
The entity_metadata property is discarded for events whose entity_type is not ScheduledEventEntityType.External.
Fires a Guild Scheduled Event Update gateway event.
See
https://docs.discord.com/developers/resources/guild-scheduled-event#modify-guild-scheduled-event
editStageInstance()
editStageInstance(
rest,channelId,topic,reason?):Promise<DiscordStageInstance>
Edits a stage instance.
Parameters
rest
channelId
The ID of the stage channel the stage instance is associated with.
topic
string
Topic of the Stage instance (1-120 characters).
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordStageInstance>
An instance of the updated DiscordStageInstance.
Remarks
Requires the user to be a moderator of the stage channel.
Fires a Stage Instance Update event.
See
https://docs.discord.com/developers/resources/stage-instance#modify-stage-instance
editUserApplicationRoleConnection()
editUserApplicationRoleConnection(
rest,bearerToken,applicationId,options):Promise<DiscordApplicationRoleConnection>
Edit the current user application role connection for the application.
Parameters
rest
bearerToken
string
The access token of the user
applicationId
The id of the application to edit the role connection
options
The options to edit
metadata
{[key: string]: string; }
platformName
string | null
platformUsername
string | null
Returns
Promise<DiscordApplicationRoleConnection>
Remarks
This requires the role_connections.write scope.
See
https://docs.discord.com/developers/resources/user#update-user-application-role-connection
editUserVoiceState()
editUserVoiceState(
rest,guildId,options):Promise<void>
Edits the voice state of another user.
Parameters
rest
guildId
The ID of the guild in which to edit the voice state of the bot user.
options
The parameters for the edit of the voice state.
Returns
Promise<void>
Remarks
The channelId property of the options object parameter must point to a stage channel, and the user must already have joined it.
Requires the MUTE_MEMBERS permission.
See
https://docs.discord.com/developers/resources/voice#modify-user-voice-state
editWebhook()
editWebhook(
rest,webhookId,options,reason?):Promise<DiscordWebhook>
Edits a webhook.
Parameters
rest
webhookId
The ID of the webhook to edit.
options
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordWebhook>
An instance of the edited DiscordWebhook.
Remarks
Requires the MANAGE_WEBHOOKS permission.
Fires a Webhooks Update gateway event.
See
https://docs.discord.com/developers/resources/webhook#edit-webhook
editWebhookMessage()
editWebhookMessage(
rest,webhookId,token,messageId,options):Promise<DiscordMessage>
Edits a webhook message.
Parameters
rest
webhookId
The ID of the webhook to edit the message of.
token
string
The webhook token, used to edit the message.
messageId
The ID of the message to edit.
options
The parameters for the edit of the message.
Returns
Promise<DiscordMessage>
An instance of the edited DiscordMessage.
Remarks
Fires a Message Update gateway event.
See
https://docs.discord.com/developers/resources/webhook#edit-webhook-message
editWebhookWithToken()
editWebhookWithToken(
rest,webhookId,token,options):Promise<DiscordWebhook>
Edits a webhook using the webhook token, thereby bypassing the need for authentication + permissions.
Parameters
rest
webhookId
The ID of the webhook to edit.
token
string
The webhook token, used to edit the webhook.
options
Omit<ModifyWebhook, "channelId">
Returns
Promise<DiscordWebhook>
An instance of the edited DiscordWebhook.
Remarks
Requires the MANAGE_WEBHOOKS permission.
Fires a Webhooks Update gateway event.
See
https://docs.discord.com/developers/resources/webhook#modify-webhook-with-token
editWelcomeScreen()
editWelcomeScreen(
rest,guildId,options,reason?):Promise<DiscordWelcomeScreen>
Edits a guild's welcome screen.
Parameters
rest
guildId
The ID of the guild to edit the welcome screen of.
options
The parameters for the edit of the welcome screen.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordWelcomeScreen>
An instance of the edited DiscordWelcomeScreen.
Remarks
Requires the MANAGE_GUILD permission.
Fires a Guild Update gateway event.
See
https://docs.discord.com/developers/resources/guild#modify-guild-welcome-screen
editWidgetSettings()
editWidgetSettings(
rest,guildId,options,reason?):Promise<DiscordGuildWidgetSettings>
Edits the settings of a guild's widget.
Parameters
rest
guildId
The ID of the guild to edit the settings of the widget of.
options
channelId
string | null
enabled
boolean
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordGuildWidgetSettings>
An instance of the edited DiscordGuildWidgetSettings.
Remarks
Requires the MANAGE_GUILD permission.
Fires a Guild Update gateway event.
See
https://docs.discord.com/developers/resources/guild#modify-guild-widget
endPoll()
endPoll(
rest,channelId,messageId):Promise<DiscordMessage>
Immediately ends the poll.
Parameters
rest
channelId
The ID of the channel in which the message with the poll lives
messageId
The ID of the message in which the poll lives
Returns
Promise<DiscordMessage>
The message with the expired poll
Remarks
You cannot end polls from other users.
Fires a Message Update gateway event
exchangeToken()
exchangeToken(
rest,clientId,clientSecret,options):Promise<DiscordAccessTokenResponse>
Exchange the information to get a OAuth2 accessToken token
Parameters
rest
clientId
Application's client id
clientSecret
string
application's client secret
options
Camelize<DiscordTokenExchange>
The options to make the exchange with discord
Returns
Promise<DiscordAccessTokenResponse>
executeWebhook()
executeWebhook(
rest,webhookId,token,options):Promise<DiscordMessage|undefined>
Executes a webhook, causing a message to be posted in the channel configured for the webhook.
Parameters
rest
webhookId
The ID of the webhook to execute.
token
string
The webhook token, used to execute the webhook.
options
The parameters for the execution of the webhook.
Returns
Promise<DiscordMessage | undefined>
An instance of the created DiscordMessage, or undefined if the wait property of the options object parameter is set to false.
Remarks
If the webhook channel is a forum channel, you must provide a value for either threadId or threadName.
See
https://docs.discord.com/developers/resources/webhook#execute-webhook
followAnnouncement()
followAnnouncement(
rest,sourceChannelId,targetChannelId,reason?):Promise<DiscordFollowedChannel>
Follows an announcement channel, allowing messages posted within it to be cross-posted into the target channel.
Parameters
rest
sourceChannelId
The ID of the announcement channel to follow.
targetChannelId
The ID of the target channel - the channel to cross-post to.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordFollowedChannel>
An instance of DiscordFollowedChannel.
Remarks
Requires the MANAGE_WEBHOOKS permission in the target channel.
Fires a Webhooks Update gateway event.
See
https://docs.discord.com/developers/resources/channel#follow-announcement-channel
getActiveThreads()
getActiveThreads(
rest,guildId):Promise<DiscordListActiveThreads>
Gets the list of all active threads for a guild.
Parameters
rest
guildId
The ID of the guild to get the threads of.
Returns
Promise<DiscordListActiveThreads>
An instance of DiscordListActiveThreads.
Remarks
Returns both public and private threads.
Threads are ordered by the id property in descending order.
See
https://docs.discord.com/developers/resources/guild#list-active-guild-threads
getApplicationActivityInstance()
getApplicationActivityInstance(
rest,applicationId,instanceId):Promise<DiscordActivityInstance>
Returns a serialized activity instance, if it exists. Useful for preventing unwanted activity sessions.
Parameters
rest
applicationId
The ID of the application
instanceId
string
The ID of the activity instance
Returns
Promise<DiscordActivityInstance>
getApplicationCommandPermission()
getApplicationCommandPermission(
rest,guildId,commandId,options?):Promise<DiscordGuildApplicationCommandPermissions>
Gets the permissions of a guild application command.
Parameters
rest
guildId
The ID of the guild the command is registered in.
commandId
The ID of the command to get the permissions of.
options?
GetApplicationCommandPermissionOptions
The OAuth2 related optional parameters for the endpoint
Returns
Promise<DiscordGuildApplicationCommandPermissions>
An instance of DiscordGuildApplicationCommandPermissions.
Remarks
Then specifying the options object the access token passed-in requires the OAuth2 scope applications.commands.permissions.update
See
getApplicationCommandPermissions()
getApplicationCommandPermissions(
rest,guildId,options?):Promise<DiscordGuildApplicationCommandPermissions[]>
Gets the permissions of all application commands registered in a guild by the ID of the guild and optionally an external application.
Parameters
rest
guildId
The ID of the guild to get the permissions objects of.
options?
GetApplicationCommandPermissionOptions
The OAuth2 related optional parameters for the endpoint
Returns
Promise<DiscordGuildApplicationCommandPermissions[]>
A collection of DiscordGuildApplicationCommandPermissions objects assorted by command ID.
Remarks
Then specifying the options object the access token passed-in requires the OAuth2 scope applications.commands.permissions.update
See
getApplicationEmoji()
getApplicationEmoji(
rest,emojiId):Promise<DiscordEmoji>
Gets an application emoji by its ID.
Parameters
rest
emojiId
The ID of the emoji to get.
Returns
Promise<DiscordEmoji>
An instance of DiscordEmoji.
Remarks
Always includes the user object for the team member that uploaded the emoji from the app's settings, or for the bot user if uploaded using the API.
See
https://docs.discord.com/developers/resources/emoji#get-application-emoji
getApplicationEmojis()
getApplicationEmojis(
rest):Promise<{items:DiscordEmoji[]; }>
Gets the list of emojis for an application.
Parameters
rest
Returns
Promise<{ items: DiscordEmoji[]; }>
An object with the array of DiscordEmoji objects.
Remarks
Always includes the user object for the team member that uploaded the emoji from the app's settings, or for the bot user if uploaded using the API.
See
https://docs.discord.com/developers/resources/emoji#list-application-emojis
getApplicationInfo()
getApplicationInfo(
rest):Promise<DiscordApplication>
Get the applications info
Parameters
rest
Returns
Promise<DiscordApplication>
getAuditLog()
getAuditLog(
rest,guildId,options?):Promise<DiscordAuditLog>
Gets a guild's audit log.
Parameters
rest
guildId
The ID of the guild to get the audit log of.
options?
The parameters for the fetching of the audit log.
Returns
Promise<DiscordAuditLog>
An instance of DiscordAuditLog.
Remarks
Requires the VIEW_AUDIT_LOG permission.
See
https://docs.discord.com/developers/resources/audit-log#get-guild-audit-log
getAutomodRule()
getAutomodRule(
rest,guildId,ruleId):Promise<DiscordAutoModerationRule>
Gets an automod rule by its ID.
Parameters
rest
guildId
The ID of the guild to get the rule of.
ruleId
The ID of the rule to get.
Returns
Promise<DiscordAutoModerationRule>
An instance of DiscordAutoModerationRule.
Remarks
Requires the MANAGE_GUILD permission.
See
https://docs.discord.com/developers/resources/auto-moderation#get-auto-moderation-rule
getAutomodRules()
getAutomodRules(
rest,guildId):Promise<DiscordAutoModerationRule[]>
Gets the list of automod rules for a guild.
Parameters
rest
guildId
The ID of the guild to get the rules from.
Returns
Promise<DiscordAutoModerationRule[]>
A collection of DiscordAutoModerationRule objects assorted by rule ID.
Remarks
Requires the MANAGE_GUILD permission.
See
https://docs.discord.com/developers/resources/auto-moderation#list-auto-moderation-rules-for-guild
getAvailableVoiceRegions()
getAvailableVoiceRegions(
rest):Promise<DiscordVoiceRegion[]>
Gets the list of available voice regions.
Parameters
rest
Returns
Promise<DiscordVoiceRegion[]>
A collection of DiscordVoiceRegion objects assorted by voice region ID.
getBan()
getBan(
rest,guildId,userId):Promise<DiscordBan>
Gets a ban by user ID.
Parameters
rest
guildId
The ID of the guild to get the ban from.
userId
The ID of the user to get the ban for.
Returns
Promise<DiscordBan>
An instance of DiscordBan.
Remarks
Requires the BAN_MEMBERS permission.
See
https://docs.discord.com/developers/resources/guild#get-guild-ban
getBans()
getBans(
rest,guildId,options?):Promise<DiscordBan[]>
Gets the list of bans for a guild.
Parameters
rest
guildId
The ID of the guild to get the list of bans for.
options?
The parameters for the fetching of the list of bans.
Returns
Promise<DiscordBan[]>
A collection of DiscordBan objects assorted by user ID.
Remarks
Requires the BAN_MEMBERS permission.
Users are ordered by their IDs in ascending order.
See
https://docs.discord.com/developers/resources/guild#get-guild-bans
getChannel()
getChannel(
rest,channelId):Promise<DiscordChannel>
Gets a channel by its ID.
Parameters
rest
channelId
The ID of the channel to get.
Returns
Promise<DiscordChannel>
An instance of DiscordChannel.
Remarks
If the channel is a thread, a DiscordThreadMember object is included in the result.
See
https://docs.discord.com/developers/resources/channel#get-channel
getChannelInvites()
getChannelInvites(
rest,channelId):Promise<DiscordInviteMetadata[]>
Gets the list of invites for a channel.
Parameters
rest
channelId
The ID of the channel to get the invites of.
Returns
Promise<DiscordInviteMetadata[]>
A collection of DiscordInviteMetadata objects assorted by invite code.
Remarks
Requires the MANAGE_CHANNELS permission.
Only usable for guild channels.
See
https://docs.discord.com/developers/resources/channel#get-channel-invites
getChannelPins()
getChannelPins(
rest,channelId,options?):Promise<DiscordGetChannelPins>
Retrieves the list of pins in a channel.
Parameters
rest
channelId
The ID of the channel to get the pins for.
options?
The options for the fetching of the pins.
Returns
Promise<DiscordGetChannelPins>
A DiscordGetChannelPins objects
Remarks
Requires the VIEW_CHANNEL permission.
If the user is missing the READ_MESSAGE_HISTORY permission in the channel, then no pins will be returned.
See
https://docs.discord.com/developers/resources/message#get-channel-pins
getChannels()
getChannels(
rest,guildId):Promise<DiscordChannel[]>
Gets the list of channels for a guild.
Parameters
rest
guildId
The ID of the guild to get the channels of.
Returns
Promise<DiscordChannel[]>
A collection of DiscordChannel objects assorted by channel ID.
Remarks
Excludes threads.
See
https://docs.discord.com/developers/resources/guild#get-guild-channels
getChannelWebhooks()
getChannelWebhooks(
rest,channelId):Promise<DiscordWebhook[]>
Gets a list of webhooks for a channel.
Parameters
rest
channelId
The ID of the channel which to get the webhooks of.
Returns
Promise<DiscordWebhook[]>
A collection of DiscordWebhook objects assorted by webhook ID.
Remarks
Requires the MANAGE_WEBHOOKS permission.
See
https://docs.discord.com/developers/resources/webhook#get-channel-webhooks
getCurrentAuthenticationInfo()
getCurrentAuthenticationInfo(
rest,bearerToken):Promise<DiscordCurrentAuthorization>
Get the current authentication info for the authenticated user
Parameters
rest
bearerToken
string
Any OAuth2 derived access token
Returns
Promise<DiscordCurrentAuthorization>
An instance of DiscordCurrentAuthorization
Remarks
The user object is not defined if the scopes do not include identify.
In the user object, if defined, the email is not included if the scopes do not include email
getCurrentMember()
getCurrentMember(
rest,guildId,bearerToken):Promise<DiscordMemberWithUser>
Gets the current member object.
Parameters
rest
guildId
The ID of the guild to get the member object for.
bearerToken
string
The access token of the user
Returns
Promise<DiscordMemberWithUser>
An instance of DiscordMemberWithUser.
Remarks
The access tokens needs the guilds.members.read scope
See
https://docs.discord.com/developers/resources/user#get-current-user-guild-member
getCurrentUser()
getCurrentUser(
rest,bearerToken):Promise<DiscordUser>
Get the current user data.
Parameters
rest
bearerToken
string
The access token of the user
Returns
Promise<DiscordUser>
Remarks
This requires the identify scope.
To get the mail this also requires the email scope
getDmChannel()
getDmChannel(
rest,userId):Promise<DiscordChannel>
Gets or creates a DM channel with a user.
Parameters
rest
userId
The ID of the user to create the DM channel with.
Returns
Promise<DiscordChannel>
An instance of DiscordChannel.
See
https://docs.discord.com/developers/resources/user#create-dm
getEmoji()
getEmoji(
rest,guildId,emojiId):Promise<DiscordEmoji>
Gets an emoji by its ID.
Parameters
rest
guildId
The ID of the guild from which to get the emoji.
emojiId
The ID of the emoji to get.
Returns
Promise<DiscordEmoji>
An instance of DiscordEmoji.
Remarks
Includes the user field if the bot has the MANAGE_GUILD_EXPRESSIONS permission,
or if the bot created the emoji and has the CREATE_GUILD_EXPRESSIONS permission.
See
https://docs.discord.com/developers/resources/emoji#get-guild-emoji
getEmojis()
getEmojis(
rest,guildId):Promise<DiscordEmoji[]>
Gets the list of emojis for a guild.
Parameters
rest
guildId
The ID of the guild which to get the emojis of.
Returns
Promise<DiscordEmoji[]>
A collection of DiscordEmoji objects assorted by emoji ID.
Remarks
Includes user fields if the bot has the CREATE_GUILD_EXPRESSIONS or MANAGE_GUILD_EXPRESSIONS permission.
See
https://docs.discord.com/developers/resources/emoji#list-guild-emojis
getEntitlement()
getEntitlement(
rest,applicationId,entitlementId):Promise<DiscordEntitlement>
Returns an entitlement.
Parameters
rest
applicationId
The id of the application to get the entitlement
entitlementId
The id of the entitlement to get
Returns
Promise<DiscordEntitlement>
getFollowupMessage()
getFollowupMessage(
rest,token,messageId):Promise<DiscordMessage>
Gets a follow-up message to an interaction by the ID of the message.
Parameters
rest
token
string
The interaction token to use, provided in the original interaction.
messageId
The ID of the message to get.
Returns
Promise<DiscordMessage>
An instance of DiscordMessage.
Remarks
Unlike getMessage(), this endpoint allows the bot user to act without:
- Needing to be able to see the contents of the channel that the message is in. (
READ_MESSAGESpermission.) - Requiring the
MESSAGE_CONTENTintent.
Does not support ephemeral follow-up messages due to these being stateless.
See
https://docs.discord.com/developers/interactions/receiving-and-responding#get-followup-message
getGatewayBot()
getGatewayBot(
rest):Promise<DiscordGetGatewayBot>
Get the bots Gateway metadata that can help during the operation of large or sharded bots.
Parameters
rest
Returns
Promise<DiscordGetGatewayBot>
getGlobalApplicationCommand()
getGlobalApplicationCommand(
rest,commandId):Promise<DiscordApplicationCommand>
Gets a global application command by its ID.
Parameters
rest
commandId
The ID of the command to get.
Returns
Promise<DiscordApplicationCommand>
An instance of DiscordApplicationCommand.
See
https://docs.discord.com/developers/interactions/application-commands#get-global-application-command
getGlobalApplicationCommands()
getGlobalApplicationCommands(
rest,options?):Promise<DiscordApplicationCommand[]>
Gets the list of your bot's global application commands.
Parameters
rest
options?
GetGlobalApplicationCommandsOptions
The parameters for the fetching of global application commands
Returns
Promise<DiscordApplicationCommand[]>
A collection of DiscordApplicationCommand objects assorted by command ID.
See
getGroupDmChannel()
getGroupDmChannel(
rest,options):Promise<DiscordChannel>
Create a new group DM channel with multiple users.
Parameters
rest
options
The options for create a new group dm
Returns
Promise<DiscordChannel>
An instance of DiscordChannel.
Remarks
The access tokens require to have the gdm.join scope
This endpoint is limited to 10 active group DMs.
Fires a Channel create gateway event.
See
https://docs.discord.com/developers/resources/user#create-group-dm
getGuild()
getGuild(
rest,guildId,options?):Promise<DiscordGuild>
Gets a guild by its ID.
Parameters
rest
guildId
The ID of the guild to get.
options?
The parameters for the fetching of the guild.
counts?
boolean
Returns
Promise<DiscordGuild>
An instance of DiscordGuild.
See
https://docs.discord.com/developers/resources/guild#get-guild
getGuildApplicationCommand()
getGuildApplicationCommand(
rest,commandId,guildId):Promise<DiscordApplicationCommand>
Gets a guild application command by its ID.
Parameters
rest
commandId
The ID of the command to get.
guildId
The ID of the guild the command is registered in.
Returns
Promise<DiscordApplicationCommand>
An instance of DiscordApplicationCommand.
See
https://docs.discord.com/developers/interactions/application-commands#get-guild-application-command
getGuildApplicationCommands()
getGuildApplicationCommands(
rest,guildId,options?):Promise<DiscordApplicationCommand[]>
Gets the list of application commands registered by your bot in a guild.
Parameters
rest
guildId
The ID of the guild the commands are registered in.
options?
GetGuildApplicationCommandsOptions
The parameters for the fetching of guild application commands
Returns
Promise<DiscordApplicationCommand[]>
A collection of DiscordApplicationCommand objects assorted by command ID.
See
getGuildOnboarding()
getGuildOnboarding(
rest,guildId):Promise<DiscordGuildOnboarding>
Get the guild onboarding
Parameters
rest
guildId
The guild to get the onboarding from
Returns
Promise<DiscordGuildOnboarding>
getGuildPreview()
getGuildPreview(
rest,guildId):Promise<DiscordGuildPreview>
Gets the preview of a guild by a guild's ID.
Parameters
rest
guildId
The ID of the guild to get the preview of.
Returns
Promise<DiscordGuildPreview>
An instance of DiscordGuildPreview.
Remarks
If the bot user is not in the guild, the guild must be discoverable.
See
https://docs.discord.com/developers/resources/guild#get-guild-preview
getGuildRoleMemberCounts()
getGuildRoleMemberCounts(
rest,guildId):Promise<Record<string,number>>
Get guild role member counts
Returns a map of role IDs to the number of members with the role. Does not include the @everyone role.
Parameters
rest
guildId
The ID of the guild to get role member counts for.
Returns
Promise<Record<string, number>>
See
https://docs.discord.com/developers/resources/guild#get-guild-role-member-counts
getGuilds()
getGuilds(
rest,bearerToken?,options?):Promise<Partial<DiscordGuild>[]>
Get the user guilds.
Parameters
rest
bearerToken?
string
The access token of the user, if unspecified the bot token is used instead
options?
The parameters for the fetching of the guild.
Returns
Promise<Partial<DiscordGuild>[]>
An array of partial DiscordGuild.
Remarks
If used with an access token, the token needs to have the guilds scope
See
https://docs.discord.com/developers/resources/user#get-current-user-guilds
getGuildSoundboardSound()
getGuildSoundboardSound(
rest,guildId,soundId):Promise<DiscordSoundboardSound>
Returns a soundboard sound object for the given sound id.
Parameters
rest
guildId
The guild to get the sounds from
soundId
The sound id
Returns
Promise<DiscordSoundboardSound>
Remarks
Includes user fields if the bot has the CREATE_GUILD_EXPRESSIONS or MANAGE_GUILD_EXPRESSIONS permission.
getGuildSticker()
getGuildSticker(
rest,guildId,stickerId):Promise<DiscordSticker>
Returns a sticker object for the given guild and sticker IDs.
Parameters
rest
guildId
The ID of the guild to get
stickerId
The ID of the sticker to get
Returns
Promise<DiscordSticker>
Remarks
Includes the user field if the bot has the CREATE_GUILD_EXPRESSIONS or MANAGE_GUILD_EXPRESSIONS permission.
See
https://docs.discord.com/developers/resources/sticker#get-guild-sticker
getGuildStickers()
getGuildStickers(
rest,guildId):Promise<DiscordSticker[]>
Returns an array of sticker objects for the given guild.
Parameters
rest
guildId
The ID of the guild to get
Returns
Promise<DiscordSticker[]>
A collection of DiscordSticker objects assorted by sticker ID.
Remarks
Includes user fields if the bot has the CREATE_GUILD_EXPRESSIONS or MANAGE_GUILD_EXPRESSIONS permission.
See
https://docs.discord.com/developers/resources/sticker#list-guild-stickers
getGuildTemplate()
getGuildTemplate(
rest,templateCode):Promise<DiscordTemplate>
Gets a template by its code.
Parameters
rest
templateCode
string
The code of the template to get.
Returns
Promise<DiscordTemplate>
An instance of DiscordTemplate.
Remarks
Requires the MANAGE_GUILD permission.
See
https://docs.discord.com/developers/resources/guild-template#get-guild-template
getGuildTemplates()
getGuildTemplates(
rest,guildId):Promise<DiscordTemplate[]>
Gets the list of templates for a guild.
Parameters
rest
guildId
The ID of the guild to get the list of templates for.
Returns
Promise<DiscordTemplate[]>
A collection of DiscordTemplate objects assorted by template code.
Remarks
Requires the MANAGE_GUILD permission.
See
https://docs.discord.com/developers/resources/guild-template#get-guild-templates
getGuildWebhooks()
getGuildWebhooks(
rest,guildId):Promise<DiscordWebhook[]>
Gets the list of webhooks for a guild.
Parameters
rest
guildId
The ID of the guild to get the list of webhooks for.
Returns
Promise<DiscordWebhook[]>
A collection of DiscordWebhook objects assorted by webhook ID.
Remarks
Requires the MANAGE_WEBHOOKS permission.
See
https://docs.discord.com/developers/resources/webhook#get-guild-webhooks
getIntegrations()
getIntegrations(
rest,guildId):Promise<DiscordIntegration[]>
Gets the list of integrations attached to a guild.
Parameters
rest
guildId
The ID of the guild to get the list of integrations from.
Returns
Promise<DiscordIntegration[]>
A collection of DiscordIntegration objects assorted by integration ID.
Remarks
Requires the MANAGE_GUILD permission.
See
https://docs.discord.com/developers/resources/guild#get-guild-integrations
getInvite()
getInvite(
rest,inviteCode,options?):Promise<DiscordInviteMetadata>
Gets an invite to a channel by its invite code.
Parameters
rest
inviteCode
string
The invite code of the invite to get.
options?
The parameters for the fetching of the invite.
Returns
Promise<DiscordInviteMetadata>
An instance of DiscordInviteMetadata.
See
https://docs.discord.com/developers/resources/invite#get-invite
getInvites()
getInvites(
rest,guildId):Promise<DiscordInviteMetadata[]>
Gets the list of invites for a guild.
Parameters
rest
guildId
The ID of the guild to get the invites from.
Returns
Promise<DiscordInviteMetadata[]>
A collection of DiscordInviteMetadata objects assorted by invite code.
Remarks
Requires the MANAGE_GUILD or VIEW_AUDIT_LOG permission.
See
https://docs.discord.com/developers/resources/invite#get-invites
getLobby()
getLobby(
rest,lobbyId):Promise<DiscordLobby>
Returns a lobby object for the specified lobby id, if it exists.
Parameters
rest
lobbyId
The ID of the lobby to get
Returns
Promise<DiscordLobby>
The lobby object
getLobbyMessages()
getLobbyMessages(
rest,bearerToken,lobbyId,options?):Promise<DiscordLobbyMessage[]>
Returns the most recent messages in the specified lobby. The calling user must be a member of the lobby.
Parameters
rest
bearerToken
string
The access token of the user
lobbyId
The ID of the lobby to get the messages from
options?
The options to get the messages
Returns
Promise<DiscordLobbyMessage[]>
Returns an array of lobby message objects
Remarks
Uses Bearer token for authorization with the sdk.social_layer scope.
getMember()
getMember(
rest,guildId,userId):Promise<DiscordMemberWithUser>
Gets the member object by user ID.
Parameters
rest
guildId
The ID of the guild to get the member object for.
userId
The ID of the user to get the member object for.
Returns
Promise<DiscordMemberWithUser>
An instance of DiscordMemberWithUser.
See
https://docs.discord.com/developers/resources/guild#get-guild-member
getMembers()
getMembers(
rest,guildId,options):Promise<DiscordMemberWithUser[]>
Gets the list of members for a guild.
Parameters
rest
guildId
The ID of the guild to get the list of members for.
options
The parameters for the fetching of the members.
Returns
Promise<DiscordMemberWithUser[]>
A collection of DiscordMemberWithUser objects assorted by user ID.
Remarks
Requires the GUILD_MEMBERS intent.
⚠️ It is not recommended to use this endpoint with very large bots. Instead, opt to use fetchMembers():
REST communication only permits 50 requests to be made per second, while gateways allow for up to 120 requests
per minute per shard. For more information, read https://docs.discord.com/developers/topics/rate-limits#rate-limits.
See
- https://docs.discord.com/developers/resources/guild#list-guild-members
- https://docs.discord.com/developers/events/gateway-events#request-guild-members
- https://docs.discord.com/developers/topics/rate-limits#rate-limits
getMessage()
getMessage(
rest,channelId,messageId):Promise<DiscordMessage>
Gets a message from a channel by the ID of the message.
Parameters
rest
channelId
The ID of the channel from which to get the message.
messageId
The ID of the message to get.
Returns
Promise<DiscordMessage>
An instance of DiscordMessage.
Remarks
Requires that the bot user be able to see the contents of the channel in which the message was posted.
If getting a message from a guild channel:
- Requires the
READ_MESSAGE_HISTORYpermission.
See
https://docs.discord.com/developers/resources/channel#get-channel-message
getMessages()
getMessages(
rest,channelId,options?):Promise<DiscordMessage[]>
Gets multiple messages from a channel.
Parameters
rest
channelId
The ID of the channel from which to get the messages.
options?
The parameters for the fetching of the messages.
Returns
Promise<DiscordMessage[]>
Returns an array of DiscordMessage objects from newest to oldest on success.
Remarks
Requires that the bot user be able to see the contents of the channel in which the messages were posted.
If getting a messages from a guild channel:
- Requires the
READ_MESSAGE_HISTORYpermission.
See
https://docs.discord.com/developers/resources/channel#get-channel-messages
getOriginalInteractionResponse()
getOriginalInteractionResponse(
rest,token):Promise<DiscordMessage>
Gets the initial message response to an interaction.
Parameters
rest
token
string
The interaction token to use, provided in the original interaction.
Returns
Promise<DiscordMessage>
An instance of DiscordMessage.
Remarks
Unlike getMessage(), this endpoint allows the bot user to act without:
- Needing to be able to see the contents of the channel that the message is in. (
READ_MESSAGESpermission.) - Requiring the
MESSAGE_CONTENTintent.
Does not support ephemeral follow-up messages due to these being stateless.
See
getOwnVoiceState()
getOwnVoiceState(
rest,guildId):Promise<DiscordVoiceState>
Returns the current user's voice state in the guild.
Parameters
rest
guildId
The ID of the guild to get the voice state from.
Returns
Promise<DiscordVoiceState>
An instance of DiscordVoiceState.
See
https://docs.discord.com/developers/resources/voice#get-current-user-voice-state
getPinnedMessages()
getPinnedMessages(
rest,channelId):Promise<DiscordMessage[]>
Gets the pinned messages for a channel.
Parameters
rest
channelId
The ID of the channel to get the pinned messages for.
Returns
Promise<DiscordMessage[]>
A collection of DiscordMessage objects assorted by message ID.
Remarks
Requires that the bot user be able to see the contents of the channel in which the messages were posted.
If getting a message from a guild channel:
- Requires the
READ_MESSAGE_HISTORYpermission.
See
https://docs.discord.com/developers/resources/message#get-pinned-messages-deprecated
Deprecated
Use getChannelPins instead.
getPollAnswerVoters()
getPollAnswerVoters(
rest,channelId,messageId,answerId,options?):Promise<DiscordGetAnswerVotesResponse>
Get a list of users that voted for this specific answer.
Parameters
rest
channelId
The ID of the channel in which the message with the poll lives
messageId
The ID of the message in which the poll lives
answerId
number
The ID of the answer to get the users that voted that answer
options?
The options for the request
Returns
Promise<DiscordGetAnswerVotesResponse>
The list of users that voted for the specific answer.
getPrivateArchivedThreads()
getPrivateArchivedThreads(
rest,channelId,options?):Promise<DiscordListArchivedThreads>
Gets the list of private archived threads for a channel.
Parameters
rest
channelId
The ID of the channel to get the archived threads for.
options?
The parameters for the fetching of threads.
Returns
Promise<DiscordListArchivedThreads>
An instance of DiscordListArchivedThreads.
Remarks
Requires the READ_MESSAGE_HISTORY permission.
Requires the MANAGE_THREADS permission.
Returns threads of type ChannelTypes.GuildPrivateThread.
Threads are ordered by the archive_timestamp property included in the metadata of the object in descending order.
See
https://docs.discord.com/developers/resources/channel#list-private-archived-threads
getPrivateJoinedArchivedThreads()
getPrivateJoinedArchivedThreads(
rest,channelId,options?):Promise<DiscordListArchivedThreads>
Gets the list of private archived threads the bot is a member of for a channel.
Parameters
rest
channelId
The ID of the channel to get the archived threads for.
options?
The parameters for the fetching of threads.
Returns
Promise<DiscordListArchivedThreads>
An instance of DiscordListArchivedThreads.
Remarks
Requires the READ_MESSAGE_HISTORY permission.
Returns threads of type ChannelTypes.GuildPrivateThread.
Threads are ordered by the id property in descending order.
See
https://docs.discord.com/developers/resources/channel#list-joined-private-archived-threads
getPruneCount()
getPruneCount(
rest,guildId,options?):Promise<DiscordPrunedCount>
Gets the number of members that would be kicked from a guild during pruning.
Parameters
rest
guildId
The ID of the guild to get the prune count of.
options?
The parameters for the fetching of the prune count.
Returns
Promise<DiscordPrunedCount>
A number indicating the number of members that would be kicked.
Remarks
Requires the MANAGE_GUILD and KICK_MEMBERS permissions, unless the guild has the PRUNE_REQUIRES_ADMIN guild feature, in which case it requires the ADMINISTRATOR permission.
See
https://docs.discord.com/developers/resources/guild#get-guild-prune-count
getPublicArchivedThreads()
getPublicArchivedThreads(
rest,channelId,options?):Promise<DiscordListArchivedThreads>
Gets the list of public archived threads for a channel.
Parameters
rest
channelId
The ID of the channel to get the archived threads for.
options?
The parameters for the fetching of threads.
Returns
Promise<DiscordListArchivedThreads>
An instance of DiscordListArchivedThreads.
Remarks
Requires the READ_MESSAGE_HISTORY permission.
If called on a channel of type ChannelTypes.GuildText, returns threads of type ChannelTypes.GuildPublicThread. If called on a channel of type ChannelTypes.GuildNews, returns threads of type ChannelTypes.GuildNewsThread.
Threads are ordered by the archive_timestamp property included in the metadata of the object in descending order.
See
https://docs.discord.com/developers/resources/channel#list-public-archived-threads
getReactions()
getReactions(
rest,channelId,messageId,reaction,options?):Promise<DiscordUser[]>
Gets the list of users that reacted with an emoji to a message.
Parameters
rest
channelId
The ID of the channel the message to get the users for is in.
messageId
The ID of the message to get the users for.
reaction
string
The reaction for which to get the users.
options?
The parameters for the fetching of the users.
Returns
Promise<DiscordUser[]>
A collection of DiscordUser objects assorted by user ID.
See
https://docs.discord.com/developers/resources/channel#get-reactions
getRole()
getRole(
rest,guildId,roleId):Promise<DiscordRole>
Gets a role by id for a guild.
Parameters
rest
guildId
The ID of the guild to get role for.
roleId
The ID of the role.
Returns
Promise<DiscordRole>
A DiscordRole object.
See
https://docs.discord.com/developers/resources/guild#get-guild-role
getRoles()
getRoles(
rest,guildId):Promise<DiscordRole[]>
Gets the list of roles for a guild.
Parameters
rest
guildId
The ID of the guild to get the list of roles for.
Returns
Promise<DiscordRole[]>
A collection of DiscordRole objects assorted by role ID.
Remarks
⚠️ This endpoint should be used sparingly due to DiscordRole objects already being included in guild payloads.
See
https://docs.discord.com/developers/resources/guild#get-guild-roles
getScheduledEvent()
getScheduledEvent(
rest,guildId,eventId,options?):Promise<DiscordScheduledEvent>
Gets a scheduled event by its ID.
Parameters
rest
guildId
The ID of the guild to get the scheduled event from.
eventId
The ID of the scheduled event to get.
options?
The parameters for the fetching of the scheduled event.
withUserCount?
boolean
Returns
Promise<DiscordScheduledEvent>
An instance of DiscordScheduledEvent.
See
https://docs.discord.com/developers/resources/guild-scheduled-event#get-guild-scheduled-event
getScheduledEvents()
getScheduledEvents(
rest,guildId,options?):Promise<DiscordScheduledEvent[]>
Gets the list of scheduled events for a guild.
Parameters
rest
guildId
The ID of the guild to get the scheduled events from.
options?
The parameters for the fetching of the scheduled events.
Returns
Promise<DiscordScheduledEvent[]>
A collection of DiscordScheduledEvent objects assorted by event ID.
See
https://docs.discord.com/developers/resources/guild-scheduled-event#list-scheduled-events-for-guild
getScheduledEventUsers()
getScheduledEventUsers(
rest,guildId,eventId,options?):Promise<object[]>
Gets the list of subscribers to a scheduled event from a guild.
Parameters
rest
guildId
The ID of the guild to get the subscribers to the scheduled event from.
eventId
The ID of the scheduled event to get the subscribers of.
options?
The parameters for the fetching of the subscribers.
Returns
Promise<object[]>
A collection of DiscordUser objects assorted by user ID.
Remarks
Requires the MANAGE_EVENTS permission.
Users are ordered by their IDs in ascending order.
See
https://docs.discord.com/developers/resources/guild-scheduled-event#get-guild-scheduled-event-users
getSessionInfo()
getSessionInfo(
rest):Promise<DiscordGetGatewayBot>
Get the bots Gateway metadata that can help during the operation of large or sharded bots.
Parameters
rest
Returns
Promise<DiscordGetGatewayBot>
getStageInstance()
getStageInstance(
rest,channelId):Promise<DiscordStageInstance>
Gets the stage instance associated with a stage channel, if one exists.
Parameters
rest
channelId
The ID of the stage channel the stage instance is associated with.
Returns
Promise<DiscordStageInstance>
An instance of DiscordStageInstance.
See
https://docs.discord.com/developers/resources/stage-instance#get-stage-instance
getSticker()
getSticker(
rest,stickerId):Promise<DiscordSticker>
Returns a sticker object for the given sticker ID.
Parameters
rest
stickerId
The ID of the sticker to get
Returns
Promise<DiscordSticker>
See
https://docs.discord.com/developers/resources/sticker#get-sticker
getStickerPack()
getStickerPack(
rest,stickerPackId):Promise<DiscordStickerPack>
Returns a sticker pack for the given ID.
Parameters
rest
stickerPackId
Returns
Promise<DiscordStickerPack>
A DiscordStickerPack object.
See
https://docs.discord.com/developers/resources/sticker#get-sticker-pack
getStickerPacks()
getStickerPacks(
rest):Promise<DiscordStickerPack[]>
Returns the list of sticker packs available.
Parameters
rest
Returns
Promise<DiscordStickerPack[]>
A collection of DiscordStickerPack objects assorted by sticker ID.
See
https://docs.discord.com/developers/resources/sticker#list-sticker-packs
getSubscription()
getSubscription(
rest,skuId,subscriptionId):Promise<DiscordSubscription>
Get a subscription by its ID.
Parameters
rest
skuId
The id of the sku of get the subscriptions for
subscriptionId
Returns
Promise<DiscordSubscription>
getTargetUsers()
getTargetUsers(
rest,inviteCode):Promise<string>
Gets the users allowed to see and accept this invite.
Parameters
rest
inviteCode
string
The invite code of the invite to update.
Returns
Promise<string>
CSV file containing the user IDs with the header user_id and each user ID from the original file
Remarks
Requires called to be the inviter, or have MANAGE_GUILD permission, or have VIEW_AUDIT_LOG permission.
See
https://docs.discord.com/developers/resources/invite#get-target-users
getTargetUsersJobStatus()
getTargetUsersJobStatus(
rest,inviteCode):Promise<DiscordTargetUsersJobStatus>
Processing target users from a CSV when creating or updating an invite is done asynchronously. This endpoint allows you to check the status of that job.
Parameters
rest
inviteCode
string
The invite code of the invite to check the target users job status for.
Returns
Promise<DiscordTargetUsersJobStatus>
An object containing the status of the target users job.
Remarks
Requires the caller to be the inviter, or have MANAGE_GUILD permission, or have VIEW_AUDIT_LOG permission.
See
https://docs.discord.com/developers/resources/invite#get-target-users-job-status
getThreadMember()
getThreadMember(
rest,channelId,userId,options?):Promise<DiscordThreadMember>
Gets a thread member by their user ID.
Parameters
rest
channelId
The ID of the thread to get the thread member of.
userId
The user ID of the thread member to get.
options?
The parameters for the fetching of the thread member.
Returns
Promise<DiscordThreadMember>
An instance of DiscordThreadMember.
See
https://docs.discord.com/developers/resources/channel#get-thread-member
getThreadMembers()
getThreadMembers(
rest,channelId,options?):Promise<DiscordThreadMember[]>
Gets the list of thread members for a thread.
Parameters
rest
channelId
The ID of the thread to get the thread members of.
options?
The parameters for the fetching of the thread members.
Returns
Promise<DiscordThreadMember[]>
A collection of DiscordThreadMember assorted by user ID.
Remarks
Requires the application to have the GUILD_MEMBERS privileged intent enabled.
See
https://docs.discord.com/developers/resources/channel#list-thread-members
getUser()
getUser(
rest,id):Promise<DiscordUser>
Get a user's data from the api
Parameters
rest
id
The user's id
Returns
Promise<DiscordUser>
getUserApplicationRoleConnection()
getUserApplicationRoleConnection(
rest,bearerToken,applicationId):Promise<DiscordApplicationRoleConnection>
Get the current user application role connection for the application.
Parameters
rest
bearerToken
string
The access token of the user
applicationId
The id of the application to get the role connection
Returns
Promise<DiscordApplicationRoleConnection>
Remarks
The access token requires the role_connections.write scope.
See
https://docs.discord.com/developers/resources/user#get-user-application-role-connection
getUserConnections()
getUserConnections(
rest,bearerToken):Promise<DiscordConnection[]>
Get the current user connections.
Parameters
rest
bearerToken
string
The access token of the user
Returns
Promise<DiscordConnection[]>
Remarks
This requires the connections scope.
getUserVoiceState()
getUserVoiceState(
rest,guildId,userId):Promise<DiscordVoiceState>
Returns the specified user's voice state in the guild.
Parameters
rest
guildId
The ID of the guild to get the voice state from.
userId
The ID of the user to get the voice state from
Returns
Promise<DiscordVoiceState>
An instance of DiscordVoiceState.
Remarks
If the specified user is connected to a voice channel, the current user must have permission to connect to the channel.
See
https://docs.discord.com/developers/resources/voice#get-user-voice-state
getVanityUrl()
getVanityUrl(
rest,guildId):Promise<DiscordVanityUrl>
Gets information about the vanity url of a guild.
Parameters
rest
guildId
The ID of the guild to get the vanity url information for.
Returns
Promise<DiscordVanityUrl>
An instance of DiscordVanityUrl.
Remarks
Requires the MANAGE_GUILD permission.
The code property will be null if the guild does not have a set vanity url.
See
https://docs.discord.com/developers/resources/guild#get-guild-vanity-url
getVoiceRegions()
getVoiceRegions(
rest,guildId):Promise<DiscordVoiceRegion[]>
Gets the list of voice regions for a guild.
Parameters
rest
guildId
The ID of the guild to get the voice regions for.
Returns
Promise<DiscordVoiceRegion[]>
A collection of DiscordVoiceRegion objects assorted by voice region ID.
See
https://docs.discord.com/developers/resources/guild#get-guild-voice-regions
getWebhook()
getWebhook(
rest,webhookId):Promise<DiscordWebhook>
Gets a webhook by its ID.
Parameters
rest
webhookId
The ID of the webhook to get.
Returns
Promise<DiscordWebhook>
An instance of DiscordWebhook.
Remarks
Requires the MANAGE_WEBHOOKS permission unless the application making the request owns the webhook.
See
https://docs.discord.com/developers/resources/webhook#get-webhook
getWebhookMessage()
getWebhookMessage(
rest,webhookId,token,messageId,options?):Promise<DiscordMessage>
Gets a webhook message by its ID.
Parameters
rest
webhookId
The ID of the webhook to get a message of.
token
string
The webhook token, used to get webhook messages.
messageId
the ID of the webhook message to get.
options?
The parameters for the fetching of the message.
Returns
Promise<DiscordMessage>
An instance of DiscordMessage.
See
https://docs.discord.com/developers/resources/webhook#get-webhook-message
getWebhookWithToken()
getWebhookWithToken(
rest,webhookId,token):Promise<DiscordWebhook>
Gets a webhook using the webhook token, thereby bypassing the need for authentication + permissions.
Parameters
rest
webhookId
The ID of the webhook to get.
token
string
The webhook token, used to get the webhook.
Returns
Promise<DiscordWebhook>
An instance of DiscordWebhook.
See
https://docs.discord.com/developers/resources/webhook#get-webhook-with-token
getWelcomeScreen()
getWelcomeScreen(
rest,guildId):Promise<DiscordWelcomeScreen>
Gets the welcome screen for a guild.
Parameters
rest
guildId
The ID of the guild to get the welcome screen for.
Returns
Promise<DiscordWelcomeScreen>
An instance of DiscordWelcomeScreen.
Remarks
If the welcome screen is not enabled:
- Requires the
MANAGE_GUILDpermission.
See
https://docs.discord.com/developers/resources/guild#get-guild-welcome-screen
getWidget()
getWidget(
rest,guildId):Promise<DiscordGuildWidget>
Gets the guild widget by guild ID.
Parameters
rest
guildId
The ID of the guild to get the widget of.
Returns
Promise<DiscordGuildWidget>
An instance of DiscordGuildWidget.
Remarks
Fires an INVITE_CREATED Gateway event when an invite channel is defined and a new Invite is generated.
See
https://docs.discord.com/developers/resources/guild#get-guild-widget
getWidgetSettings()
getWidgetSettings(
rest,guildId):Promise<DiscordGuildWidgetSettings>
Gets the settings of a guild's widget.
Parameters
rest
guildId
The ID of the guild to get the widget of.
Returns
Promise<DiscordGuildWidgetSettings>
An instance of DiscordGuildWidgetSettings.
Remarks
Requires the MANAGE_GUILD permission.
See
https://docs.discord.com/developers/resources/guild#get-guild-widget-settings
joinThread()
joinThread(
rest,channelId):Promise<void>
Adds the bot user to a thread.
Parameters
rest
channelId
The ID of the thread to add the bot user to.
Returns
Promise<void>
Remarks
Requires the thread not be archived.
Fires a Thread Members Update gateway event.
See
https://docs.discord.com/developers/resources/channel#join-thread
kickMember()
kickMember(
rest,guildId,userId,reason?):Promise<void>
Kicks a member from a guild.
Parameters
rest
guildId
The ID of the guild to kick the member from.
userId
The user ID of the member to kick from the guild.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Remarks
Requires the KICK_MEMBERS permission.
Fires a Guild Member Remove gateway event.
See
https://docs.discord.com/developers/resources/guild#remove-guild-member
leaveGuild()
leaveGuild(
rest,guildId):Promise<void>
Leaves a guild.
Parameters
rest
guildId
The ID of the guild to leave.
Returns
Promise<void>
Remarks
Fires a Guild Delete event.
See
https://docs.discord.com/developers/resources/user#leave-guild
leaveLobby()
leaveLobby(
rest,lobbyId,bearerToken):Promise<void>
Removes the current user from the specified lobby. It is safe to call this even if the user is no longer a member of the lobby, but will fail if the lobby does not exist.
Parameters
rest
lobbyId
The ID of the lobby to remove the user from
bearerToken
string
The access token of the user
Returns
Promise<void>
Nothing
Remarks
This requires a bearer token for authorization
leaveThread()
leaveThread(
rest,channelId):Promise<void>
Removes the bot user from a thread.
Parameters
rest
channelId
The ID of the thread to remove the bot user from.
Returns
Promise<void>
Remarks
Requires the thread not be archived.
Fires a Thread Members Update gateway event.
See
https://docs.discord.com/developers/resources/channel#leave-thread
linkChannelToLobby()
linkChannelToLobby(
rest,lobbyId,bearerToken,options):Promise<DiscordLobby>
Links an existing text channel to a lobby.
Parameters
rest
lobbyId
The ID of the lobby to link the channel to
bearerToken
string
The access token of the user
options
The options to link the channel to the lobby
Returns
Promise<DiscordLobby>
The updated lobby object
Remarks
Uses bearer token for authorization and the user must be a lobby member with the CanLinkLobby lobby member flag.
listApplicationRoleConnectionsMetadataRecords()
listApplicationRoleConnectionsMetadataRecords(
rest,applicationId):Promise<DiscordApplicationRoleConnectionMetadata[]>
Returns a list of application role connection metadata objects for the given application.
Parameters
rest
applicationId
The application to get the role connections from
Returns
Promise<DiscordApplicationRoleConnectionMetadata[]>
A list of application role connection metadata objects
listDefaultSoundboardSounds()
listDefaultSoundboardSounds(
rest):Promise<DiscordSoundboardSound[]>
Returns an array of soundboard sound objects that can be used by all users.
Parameters
rest
Returns
Promise<DiscordSoundboardSound[]>
listEntitlements()
listEntitlements(
rest,applicationId,options?):Promise<DiscordEntitlement[]>
Returns all entitlements for a given app, active and expired.
Parameters
rest
applicationId
The id of the application to get the entitlements
options?
The optional query params for the endpoint
Returns
Promise<DiscordEntitlement[]>
listGuildSoundboardSounds()
listGuildSoundboardSounds(
rest,guildId):Promise<{items:DiscordSoundboardSound[]; }>
Returns a list of the guild's soundboard sounds.
Parameters
rest
guildId
The guild to get the sounds from
Returns
Promise<{ items: DiscordSoundboardSound[]; }>
Remarks
Includes user fields if the bot has the CREATE_GUILD_EXPRESSIONS or MANAGE_GUILD_EXPRESSIONS permission.
listSkus()
listSkus(
rest,applicationId):Promise<DiscordSku[]>
Returns all SKUs for a given application
Parameters
rest
applicationId
The id of the application to get the SKUs
Returns
Promise<DiscordSku[]>
listSubscriptions()
listSubscriptions(
rest,skuId,options?):Promise<DiscordSubscription[]>
Returns all subscriptions containing the SKU, filtered by user.
Parameters
rest
skuId
The id of the sku of get the subscriptions for
options?
Returns
Promise<DiscordSubscription[]>
modifyGuildIncidentActions()
modifyGuildIncidentActions(
rest,guildId,options):Promise<DiscordIncidentsData>
Modifies the incident actions of the guild.
Parameters
rest
guildId
The guild to edit the incident actions from
options
The options for the incident actions
Returns
Promise<DiscordIncidentsData>
Remarks
Requires the MANAGE_GUILD permission.
modifyGuildSoundboardSound()
modifyGuildSoundboardSound(
rest,guildId,soundId,options,reason?):Promise<DiscordSoundboardSound>
Modify the given soundboard sound.
Parameters
rest
guildId
The guild to create the sounds in
soundId
The sound id to update
options
The options to update the sound
reason?
string
The audit log reason
Returns
Promise<DiscordSoundboardSound>
Remarks
Fires a Guild Soundboard Sound Update Gateway event.
For sounds created by the current user, requires either the CREATE_GUILD_EXPRESSIONS or MANAGE_GUILD_EXPRESSIONS permission.
For other sounds, requires the MANAGE_GUILD_EXPRESSIONS permission.
modifyLobby()
modifyLobby(
rest,lobbyId,options):Promise<DiscordLobby>
Modifies the specified lobby with new values, if provided.
Parameters
rest
lobbyId
The ID of the lobby to modify
options
The options to modify the lobby
Returns
Promise<DiscordLobby>
The modified lobby
pinMessage()
pinMessage(
rest,channelId,messageId,reason?):Promise<void>
Pins a message in a channel.
Parameters
rest
channelId
The ID of the channel where the message is to be pinned.
messageId
The ID of the message to pin.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Remarks
Requires the PIN_MESSAGES permission.
Fires a Channel Pins Update event.
See
https://docs.discord.com/developers/resources/message#pin-message
pruneMembers()
pruneMembers(
rest,guildId,options,reason?):Promise<{pruned:number|null; }>
Initiates the process of pruning inactive members.
Parameters
rest
guildId
The ID of the guild to prune the members of.
options
The parameters for the pruning of members.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<{ pruned: number | null; }>
A number indicating how many members were pruned.
Remarks
Requires the MANAGE_GUILD and KICK_MEMBERS permissions, unless the guild has the PRUNE_REQUIRES_ADMIN guild feature, in which case it requires the ADMINISTRATOR permission.
❗ Requests to this endpoint will time out for large guilds. To prevent this from happening, set the BeginGuildPrune.computePruneCount property of the options object parameter to false. This will begin the process of pruning, and immediately return undefined, rather than wait for the process to complete before returning the actual count of members that have been kicked.
⚠️ By default, this process will not remove members with a role. To include the members who have a particular subset of roles, specify the role(s) in the includeRoles property of the options object parameter.
Fires a Guild Member Remove gateway event for every member kicked.
See
https://docs.discord.com/developers/resources/guild#begin-guild-prune
publishMessage()
publishMessage(
rest,channelId,messageId):Promise<DiscordMessage>
Cross-posts a message posted in an announcement channel to subscribed channels.
Parameters
rest
channelId
The ID of the announcement channel.
messageId
The ID of the message to cross-post.
Returns
Promise<DiscordMessage>
An instance of the cross-posted DiscordMessage.
Remarks
Requires the SEND_MESSAGES permission.
If not cross-posting own message:
- Requires the
MANAGE_MESSAGESpermission.
Fires a Message Create event in the guilds the subscribed channels are in.
See
https://docs.discord.com/developers/resources/channel#crosspost-message
removeDmRecipient()
removeDmRecipient(
rest,channelId,userId):Promise<void>
Removes a member from a Group DM.
Parameters
rest
channelId
The ID of the channel to remove the recipient user of.
userId
The user ID of the user to remove.
Returns
Promise<void>
See
https://docs.discord.com/developers/resources/channel#group-dm-remove-recipient
removeMemberFromLobby()
removeMemberFromLobby(
rest,lobbyId,userId):Promise<void>
Removes the provided user from the specified lobby. It is safe to call this even if the user is no longer a member of the lobby, but will fail if the lobby does not exist.
Parameters
rest
lobbyId
The ID of the lobby to remove the user from
userId
The ID of the user to remove from the lobby
Returns
Promise<void>
Nothing
removeRole()
removeRole(
rest,guildId,userId,roleId,reason?):Promise<void>
Removes a role from a member.
Parameters
rest
guildId
The ID of the guild the member to remove the role from is in.
userId
The user ID of the member to remove the role from.
roleId
The ID of the role to remove from the member.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Remarks
Requires the MANAGE_ROLES permission.
Fires a Guild Member Update gateway event.
See
https://docs.discord.com/developers/resources/guild#remove-guild-member-role
removeThreadMember()
removeThreadMember(
rest,channelId,userId):Promise<void>
Removes a member from a thread.
Parameters
rest
channelId
The ID of the thread to remove the thread member of.
userId
The user ID of the thread member to remove.
Returns
Promise<void>
Remarks
If the thread is of type ChannelTypes.GuildPrivateThread, requires to be the creator of the thread.
Otherwise, requires the MANAGE_THREADS permission.
Requires the thread not be archived.
Fires a Thread Members Update gateway event.
See
https://docs.discord.com/developers/resources/channel#remove-thread-member
revokeToken()
revokeToken(
rest,clientId,clientSecret,options):Promise<void>
Revoke an access_token
Parameters
rest
clientId
Application's client id
clientSecret
string
application's client secret
options
The options to revoke the access_token
token
string
tokenTypeHint?
"refresh_token" | "access_token"
Returns
Promise<void>
searchGuildMessages()
searchGuildMessages(
rest,guildId,options?):Promise<DiscordSearchGuildMessages|DiscordSearchGuildMessagesIndexing>
Search messages in a guild.
Parameters
rest
guildId
options?
Returns
Promise<DiscordSearchGuildMessages | DiscordSearchGuildMessagesIndexing>
Remarks
Requires READ_MESSAGE_HISTORY and is restricted by the MESSAGE_CONTENT intent.
See
https://docs.discord.com/developers/resources/message#search-guild-messages
searchMembers()
searchMembers(
rest,guildId,query,options?):Promise<DiscordMemberWithUser[]>
Gets the list of members whose usernames or nicknames start with a provided string.
Parameters
rest
guildId
The ID of the guild to search in.
query
string
The string to match usernames or nicknames against.
options?
Omit<SearchMembers, "query">
The parameters for searching through the members.
Returns
Promise<DiscordMemberWithUser[]>
A collection of DiscordMember objects assorted by user ID.
See
https://docs.discord.com/developers/resources/guild#search-guild-members
sendFollowupMessage()
sendFollowupMessage(
rest,token,options):Promise<DiscordMessage>
Sends a follow-up message to an interaction.
Parameters
rest
token
string
The interaction token to use, provided in the original interaction.
options
The parameters for the creation of the message.
Returns
Promise<DiscordMessage>
An instance of the created DiscordMessage.
Remarks
⚠️ Interaction tokens are only valid for 15 minutes.
By default, mentions are suppressed. To enable mentions, pass a mention object with the callback data.
Unlike sendMessage(), this endpoint allows the bot user to act without:
- Needing to be able to see the contents of the channel that the message is in. (
READ_MESSAGESpermission.) - Requiring the
MESSAGE_CONTENTintent.
Apps are limited to 5 followup messages per interaction if it was initiated from a user-installed app and isn't installed in the server You can check if it was initiated from a user-installed app that isn't installed in the server by checking if authorizingIntegrationOwners only contains UserInstall.
Fires a Message Create event.
See
https://docs.discord.com/developers/interactions/receiving-and-responding#create-followup-message
sendInteractionResponse()
sendInteractionResponse(
rest,interactionId,token,options,params?):Promise<void|DiscordInteractionCallbackResponse>
Sends a response to an interaction.
Parameters
rest
interactionId
The ID of the interaction to respond to.
token
string
The interaction token to use, provided in the original interaction.
options
The parameters for the creation of the message.
params?
The query parameters for the response of the callback
Returns
Promise<void | DiscordInteractionCallbackResponse>
Nothing or the DiscordInteractionCallbackResponse if withResponse param is true
Remarks
⚠️ Interaction tokens are only valid for 15 minutes.
By default, mentions are suppressed. To enable mentions, pass a mention object with the callback data.
Unlike sendMessage(), this endpoint allows the bot user to act without:
- Needing to be able to see the contents of the channel that the message is in. (
READ_MESSAGESpermission.) - Requiring the
MESSAGE_CONTENTintent.
Fires a Message Create event.
See
sendLobbyMessage()
sendLobbyMessage(
rest,bearerToken,lobbyId,options):Promise<DiscordLobbyMessage>
Sends a message to the specified lobby. The calling user must be a member of the lobby.
Parameters
rest
bearerToken
string
The access token of the user
lobbyId
The ID of the lobby to send the message to
options
The options to send the message
Returns
Promise<DiscordLobbyMessage>
Returns the created lobby message object.
Remarks
Uses Bearer token for authorization with the sdk.social_layer scope.
If the lobby has a linked channel, the message is also forwarded to that channel. If forwarding fails (for example, due to AutoMod), the lobby message is still delivered to other lobby members.
sendMessage()
sendMessage(
rest,channelId,options):Promise<DiscordMessage>
Sends a message to a channel.
Parameters
rest
channelId
The ID of the channel to send the message in.
options
The parameters for the creation of the message.
Returns
Promise<DiscordMessage>
An instance of the created DiscordMessage.
Remarks
Requires that the bot user be able to see the contents of the channel the message is to be sent in.
If sending a message to a guild channel:
- Requires the
SEND_MESSAGESpermission.
If sending a TTS message:
- Requires the
SEND_TTS_MESSAGESpermission.
If sending a message as a reply to another message:
- Requires the
READ_MESSAGE_HISTORYpermission. - The message being replied to cannot be a system message.
⚠️ The maximum size of a request (accounting for any attachments and message content) for bot users is 8 MiB.
Fires a Message Create gateway event.
See
https://docs.discord.com/developers/resources/channel#create-message
sendSoundboardSound()
sendSoundboardSound(
rest,channelId,options):Promise<void>
Send a soundboard sound to a voice channel the user is connected to.
Parameters
rest
channelId
The id of the voice channel
options
Returns
Promise<void>
Remarks
Fires a Voice Channel Effect Send Gateway event.
Requires the SPEAK and USE_SOUNDBOARD permissions, and also the USE_EXTERNAL_SOUNDS permission if the sound is from a different server.
Additionally, requires the user to be connected to the voice channel, having a voice state without deaf, self_deaf, mute, or suppress enabled.
setVoiceChannelStatus()
setVoiceChannelStatus(
rest,channelId,options,reason?):Promise<void>
Set a voice channel’s status
Parameters
rest
channelId
The ID of the channel to set the status of.
options
The parameters for the status of the voice channel.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Nothing
Remarks
Requires the SET_VOICE_CHANNEL_STATUS permission, and additionally the MANAGE_CHANNELS permission if the current user is not connected to the voice channel.
Fires a Voice Channel Status Update Gateway event.
See
https://docs.discord.com/developers/resources/channel#set-voice-channel-status
startThreadWithMessage()
startThreadWithMessage(
rest,channelId,messageId,options,reason?):Promise<DiscordChannel>
Creates a thread, using an existing message as its point of origin.
Parameters
rest
channelId
The ID of the channel in which to create the thread.
messageId
The ID of the message to use as the thread's point of origin.
options
The parameters to use for the creation of the thread.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordChannel>
An instance of the created DiscordChannel.
Remarks
If called on a channel of type ChannelTypes.GuildText, creates a ChannelTypes.GuildPublicThread. If called on a channel of type ChannelTypes.GuildNews, creates a ChannelTypes.GuildNewsThread. Does not work on channels of type ChannelTypes.GuildForum.
The ID of the created thread will be the same as the ID of the source message.
Fires a Thread Create gateway event.
See
https://docs.discord.com/developers/resources/channel#start-thread-from-message
startThreadWithoutMessage()
startThreadWithoutMessage(
rest,channelId,options,reason?):Promise<DiscordChannel>
Creates a thread without using a message as the thread's point of origin.
Parameters
rest
channelId
The ID of the channel in which to create the thread.
options
The parameters to use for the creation of the thread.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<DiscordChannel>
An instance of the created Thread.
Remarks
Creating a private thread requires the server to be boosted.
Fires a Thread Create gateway event.
See
https://docs.discord.com/developers/resources/channel#start-thread-without-message
syncGuildTemplate()
syncGuildTemplate(
rest,guildId):Promise<DiscordTemplate>
Synchronises a template with the current state of a guild.
Parameters
rest
guildId
The ID of the guild to synchronise a template of.
Returns
Promise<DiscordTemplate>
An instance of the edited DiscordTemplate.
Remarks
Requires the MANAGE_GUILD permission.
Fires a Guild Update gateway event.
See
https://docs.discord.com/developers/resources/guild-template#get-guild-templates
triggerTypingIndicator()
triggerTypingIndicator(
rest,channelId):Promise<void>
Triggers a typing indicator for the specified channel, which expires after 10 seconds.
Parameters
rest
channelId
The ID of the channel in which to trigger the typing indicator.
Returns
Promise<void>
Remarks
Generally bots should not use this route. However, if a bot is responding to a command and expects the computation to take a few seconds, this endpoint may be called to let the user know that the bot is processing their message.
Fires a Typing Start gateway event.
See
https://docs.discord.com/developers/resources/channel#trigger-typing-indicator
unbanMember()
unbanMember(
rest,guildId,userId,reason?):Promise<void>
Unbans a user from a guild.
Parameters
rest
guildId
The ID of the guild to unban the user in.
userId
The ID of the user to unban.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Remarks
Requires the BAN_MEMBERS permission.
Fires a Guild Ban Remove gateway event.
See
https://docs.discord.com/developers/resources/guild#remove-guild-ban
unlinkChannelToLobby()
unlinkChannelToLobby(
rest,lobbyId,bearerToken):Promise<DiscordLobby>
Unlinks any currently linked channels from the specified lobby.
Parameters
rest
lobbyId
The ID of the lobby to unlink the channel from
bearerToken
string
The access token of the user
Returns
Promise<DiscordLobby>
The updated lobby object
Remarks
Uses bearer token for authorization and the user must be a lobby member with the CanLinkLobby lobby member flag.
unpinMessage()
unpinMessage(
rest,channelId,messageId,reason?):Promise<void>
Unpin a message in a channel.
Parameters
rest
channelId
The ID of the channel where the message is pinned.
messageId
The ID of the message to unpin.
reason?
string
An optional reason for the action, to be included in the audit log.
Returns
Promise<void>
Remarks
Requires the PIN_MESSAGES permission.
Fires a Channel Pins Update event.
See
https://docs.discord.com/developers/resources/message#unpin-message
updateApplicationRoleConnectionsMetadataRecords()
updateApplicationRoleConnectionsMetadataRecords(
rest,applicationId,options):Promise<DiscordApplicationRoleConnectionMetadata[]>
Updates and returns a list of application role connection metadata objects for the given application.
Parameters
rest
applicationId
The application to get the role connections from
options
object[]
The options to update the role connections
Returns
Promise<DiscordApplicationRoleConnectionMetadata[]>
A list of application role connection metadata objects
Remarks
An application can have a maximum of 5 metadata records.
updateLobbyMessageModerationMetadata()
updateLobbyMessageModerationMetadata(
rest,lobbyId,messageId,options):Promise<void>
Sets the moderation metadata for a lobby message. The metadata is app-scoped and delivered to active game clients via the Social SDK as a realtime message update.
Parameters
rest
lobbyId
The ID of the lobby to set the moderation metadata
messageId
The ID of the message to set the moderation metadata
options
Record<string, string>
The moderation metadata to set
Returns
Promise<void>
Remarks
Uses Bot token for authorization.
For the options: Free-form key–value pairs describing the moderation decision. Up to 5 keys; key length <= 1024 characters; value length <= 2000 characters
See
https://discord.com/developers/docs/game-sdk/social-sdk/chat-moderation#server-side-chat-moderation for the full moderation flow.
updateTargetUsers()
updateTargetUsers(
rest,inviteCode,targetUsersFile):Promise<void>
Updates the users allowed to see and accept this invite.
Parameters
rest
inviteCode
string
The invite code of the invite to update.
targetUsersFile
Blob
A CSV file with a single column of user IDs for all the users able to accept this invite
Returns
Promise<void>
Remarks
Requires the caller to be the inviter or have the MANAGE_GUILD permission.
Uploading a file with invalid user IDs will result in a 400 with the invalid IDs described.
See
https://docs.discord.com/developers/resources/invite#update-target-users
upsertGlobalApplicationCommands()
upsertGlobalApplicationCommands(
rest,commands,options?):Promise<DiscordApplicationCommand[]>
Re-registers the list of global application commands, overwriting the previous commands completely.
Parameters
rest
commands
The list of commands to use to overwrite the previous list.
options?
UpsertGlobalApplicationCommandOptions
Additional options for the endpoint.
Returns
Promise<DiscordApplicationCommand[]>
A collection of DiscordApplicationCommand objects assorted by command ID.
Remarks
❗ Commands that are not present in the commands array will be deleted.
⚠️ Commands that do not already exist will count towards the daily limit of 200 new commands.
When using the bearer token the token needs the applications.commands.update scope and must be a Client grant token.
You will be able to update only your own application commands
See
upsertGuildApplicationCommands()
upsertGuildApplicationCommands(
rest,guildId,commands,options?):Promise<DiscordApplicationCommand[]>
Re-registers the list of application commands registered in a guild, overwriting the previous commands completely.
Parameters
rest
guildId
The ID of the guild whose list of commands to overwrite.
commands
The list of commands to use to overwrite the previous list.
options?
UpsertGuildApplicationCommandOptions
Additional options for the endpoint.
Returns
Promise<DiscordApplicationCommand[]>
A collection of DiscordApplicationCommand objects assorted by command ID.
Remarks
❗ Commands that are not present in the commands array will be deleted.
⚠️ Commands that do not already exist will count towards the daily limit of 200 new commands.
When using the bearer token the token needs the applications.commands.update scope and must be a Client grant token.
You will be able to update only your own application commands