Skip to main content
Module

x/harmony/mod.ts>RESTEndpoints

An easy to use Discord API Library for Deno.
Latest
class RESTEndpoints
Re-export
import { RESTEndpoints } from "https://deno.land/x/harmony@v2.9.0/mod.ts";

Constructors

new
RESTEndpoints(rest: RESTManager)

Methods

addGuildMember(guildId: string, userId: string): Promise<MemberPayload | undefined>

Adds a user to the guild, provided you have a valid oauth2 access token for the user with the guilds.join scope. Returns a 201 Created with the guild member as the body, or 204 No Content if the user is already a member of the guild. Fires a Guild Member Add Gateway event. For guilds with Membership Screening enabled, this endpoint will default to adding new members as pending in the guild member object. Members that are pending will have to complete membership screening before they become full members that can talk.

addGuildMemberRole(
guildId: string,
userId: string,
roleId: string,
): Promise<void>

Adds a role to a guild member. Requires the MANAGE_ROLES permission. Returns a 204 empty response on success. Fires a Guild Member Update Gateway event.

addPinnedChannelMessage(channelId: string, messageId: string): Promise<void>

Pin a message in a channel. Requires the MANAGE_MESSAGES permission. Returns a 204 empty response on success.

addUserToThread(channelId: string, userId: string): Promise<undefined>

Adds another user to a thread. Requires the ability to send messages in the thread. Also requires the thread is not archived. Returns a 204 empty response on success. Fires a Thread Members Update Gateway event.

beginGuildPrune(guildId: string, payload: GuildBeginPrunePayload): Promise<void>

Begin a prune operation. Requires the KICK_MEMBERS permission. Returns an object with one 'pruned' key indicating the number of members that were removed in the prune operation. For large guilds it's recommended to set the compute_prune_count option to false, forcing 'pruned' to null. Fires multiple Guild Member Remove Gateway events. By default, prune will not remove users with roles. You can optionally include specific roles in your prune by providing the include_roles parameter. Any inactive user that has a subset of the provided role(s) will be included in the prune and users with additional roles will not.

bulkDeleteMessages(channelId: string, payload: string[]): Promise<void>

Delete multiple messages in a single request. This endpoint can only be used on guild channels and requires the MANAGE_MESSAGES permission. Returns a 204 empty response on success. Fires a Message Delete Bulk Gateway event. Any message IDs given that do not exist or are invalid will count towards the minimum and maximum message count (currently 2 and 100 respectively).

Takes a list of application commands, overwriting existing commands that are registered globally for this application. Updates will be available in all guilds after 1 hour. Returns 200 and a list of ApplicationCommand objects. Commands that do not already exist will count toward daily application command create limits.

bulkOverwriteGuildApplicationCommands(
applicationId: string,
guildId: string,
): Promise<ApplicationCommandPayload[]>

Takes a list of application commands, overwriting existing commands for the guild. Returns 200 and a list of ApplicationCommand objects.

consumeSKU(
applicationId: string,
entitlementId: string,
payload: unknown,
): Promise<unknown>

Marks a given entitlement for the user as consumed, meaning it will no longer be returned in an entitlements check. Ensure the user was granted whatever items the entitlement was for before consuming it!

createChannelInvite(channelId: string, payload?: Partial<InvitePayload>): Promise<InvitePayload>

Create a new invite object for the channel. Only usable for guild channels. Requires the CREATE_INSTANT_INVITE permission. All JSON parameters for this route are optional, however the request body is not. If you are not sending any fields, you still have to send an empty JSON object ({}). Returns an invite object. Fires an Invite Create Gateway event.

createDM(payload: { recipient_id: string; }): Promise<ChannelPayload>

Create a new DM channel with a user. Returns a DM channel object.

createFollowupMessage(
applicationId: string,
interactionToken: string,
): Promise<MessagePayload>

Create a followup message for an Interaction. Functions the same as Execute Webhook, but wait is always true, and flags can be set to 64 in the body to send an ephemeral message.

createGlobalApplicationCommand(applicationId: string, payload: unknown): Promise<ApplicationCommandPayload>
createGroupDM(payload: { access_tokens: string[]; nicks: Dict<string>; }): Promise<ChannelPayload>

Create a new group DM channel with multiple users. Returns a DM channel object. This endpoint was intended to be used with the now-deprecated GameBridge SDK. DMs created with this endpoint will not be shown in the Discord client

createGuild(payload: Partial<GuildPayload>): Promise<GuildPayload>

Create a new guild. Returns a guild object on success. Fires a Guild Create Gateway event.

createGuildApplicationCommand(
applicationId: string,
guildId: string,
): Promise<ApplicationCommandPayload>
createGuildBan(
guildId: string,
userId: string,
): Promise<void>

Create a guild ban, and optionally delete previous messages sent by the banned user. Requires the BAN_MEMBERS permission. Returns a 204 empty response on success. Fires a Guild Ban Add Gateway event.

createGuildChannel(guildId: string, payload: GuildCreateChannelPayload): Promise<ChannelPayload>

Create a new channel object for the guild. Requires the MANAGE_CHANNELS permission. If setting permission overwrites, only permissions your bot has in the guild can be allowed/denied. Setting MANAGE_ROLES permission in channels is only possible for guild administrators. Returns the new channel object on success. Fires a Channel Create Gateway event.

createGuildEmoji(guildId: string, payload: CreateEmojiPayload): Promise<EmojiPayload>

Create a new emoji for the guild. Requires the MANAGE_EMOJIS permission. Returns the new emoji object on success. Fires a Guild Emojis Update Gateway event.

createGuildFromTemplate(templateCode: string, payload: Partial<GuildPayload>): Promise<GuildPayload>

Create a new guild based on a template. Returns a guild object on success. Fires a Guild Create Gateway event.

createGuildRole(guildId: string, payload: GuildCreateRolePayload): Promise<RolePayload>

Create a new role for the guild. Requires the MANAGE_ROLES permission. Returns the new role object on success. Fires a Guild Role Create Gateway event. All JSON params are optional.

Create a new sticker for the guild. Send a multipart/form-data body. Requires the MANAGE_EMOJIS_AND_STICKERS permission. Returns the new sticker object on success.

createGuildTemplate(guildId: string, payload: { name: string; description?: string | null; }): Promise<TemplatePayload>

Creates a template for the guild. Requires the MANAGE_GUILD permission. Returns the created template object on success.

createInteractionResponse(
interactionId: string,
interactionToken: string,
): Promise<void>

Create a response to an Interaction from the gateway. Takes an Interaction response.

createMessage(channelId: string, payload: CreateMessagePayload): Promise<MessagePayload>
createPurchaseDiscount(
skuId: string,
userId: string,
payload: unknown,
): Promise<unknown>

Creates a discount for the given user on their next purchase of the given SKU. You should call this endpoint from your backend server just before calling StartPurchase for the SKU you wish to discount. The user will then see a discounted price for that SKU at time of payment. The discount is automatically consumed after successful purchase or if the TTL expires.

createReaction(
channelId: string,
messageId: string,
emoji: string,
): Promise<void>

Create a reaction for the message. This endpoint requires the 'READ_MESSAGE_HISTORY' permission to be present on the current user. Additionally, if nobody else has reacted to the message using this emoji, this endpoint requires the 'ADD_REACTIONS' permission to be present on the current user. Returns a 204 empty response on success. The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji.

createWebhook(channelId: string, payload: { name?: string; avatar?: string; }): Promise<WebhookPayload>

Create a new webhook. Requires the MANAGE_WEBHOOKS permission. Returns a webhook object on success. Webhook names follow our naming restrictions that can be found in our Usernames and Nicknames documentation, with the following additional stipulations:

  • Webhook names cannot be: 'clyde'
crosspostMessage(channelId: string, messageId: string): Promise<MessagePayload>

Crosspost a message in a News Channel to following channels. This endpoint requires the 'SEND_MESSAGES' permission, if the current user sent the message, or additionally the 'MANAGE_MESSAGES' permission, for all other messages, to be present for the current user. Returns a message object.

deleteAllReactions(channelId: string, messageId: string): Promise<void>

Deletes all reactions on a message. This endpoint requires the 'MANAGE_MESSAGES' permission to be present on the current user. Fires a Message Reaction Remove All Gateway event.

deleteAllReactionsForEmoji(
channelId: string,
messageId: string,
emoji: string,
): Promise<void>

Deletes all the reactions for a given emoji on a message. This endpoint requires the MANAGE_MESSAGES permission to be present on the current user. Fires a Message Reaction Remove Emoji Gateway event. The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji.

deleteChannel(channelId: string): Promise<void>

Delete a channel, or close a private message. Requires the MANAGE_CHANNELS permission for the guild. Deleting a category does not delete its child channels; they will have their parent_id removed and a Channel Update Gateway event will fire for each of them. Returns a channel object on success. Fires a Channel Delete Gateway event.

deleteChannelPermission(channelId: string, overwriteId: string): Promise<void>

Delete a channel permission overwrite for a user or role in a channel. Only usable for guild channels. Requires the MANAGE_ROLES permission. Returns a 204 empty response on success. For more information about permissions, see permissions

deleteFollowupMessage(
applicationId: string,
interactionToken: string,
messageId: string,
): Promise<void>

Deletes a followup message for an Interaction. Returns 204 on success.

deleteGlobalApplicationCommand(applicationId: string, commandId: string): Promise<void>

Deletes a global command. Returns 204.

deleteGuild(guildId: string): Promise<void>

Delete a guild permanently. User must be owner. Returns 204 No Content on success. Fires a Guild Delete Gateway event.

deleteGuildApplicationCommand(
applicationId: string,
guildId: string,
commandId: string,
): Promise<void>

Delete a guild command. Returns 204 on success.

deleteGuildEmoji(guildId: string, emojiId: string): Promise<void>

Delete the given emoji. Requires the MANAGE_EMOJIS permission. Returns 204 No Content on success. Fires a Guild Emojis Update Gateway event.

deleteGuildIntegration(guildId: string, integrationId: string): Promise<void>

Delete the attached integration object for the guild. Deletes any associated webhooks and kicks the associated bot if there is one. Requires the MANAGE_GUILD permission. Returns a 204 empty response on success. Fires a Guild Integrations Update Gateway event.

deleteGuildRole(guildId: string, roleId: string): Promise<void>

Delete a guild role. Requires the MANAGE_ROLES permission. Returns a 204 empty response on success. Fires a Guild Role Delete Gateway event.

deleteGuildSticker(
guildID: string,
stickerID: string,
reason?: string,
): Promise<void>

Delete the given sticker. Requires the MANAGE_EMOJIS_AND_STICKERS permission. Returns 204 No Content on success.

deleteGuildTemplate(guildId: string, templateCode: string): Promise<void>

Deletes the template. Requires the MANAGE_GUILD permission. Returns the deleted template object on success.

deleteInvite(inviteCode: string): Promise<void>

Delete an invite. Requires the MANAGE_CHANNELS permission on the channel this invite belongs to, or MANAGE_GUILD to remove any invite across the guild. Returns an invite object on success. Fires a Invite Delete Gateway event.

deleteMessage(channelId: string, messageId: string): Promise<void>

Delete a message. If operating on a guild channel and trying to delete a message that was not sent by the current user, this endpoint requires the MANAGE_MESSAGES permission. Returns a 204 empty response on success. Fires a Message Delete Gateway event.

deleteOriginalInteractionResponse(applicationId: string, interactionToken: string): Promise<void>

Deletes the initial Interaction response. Returns 204 on success.

deleteOwnReaction(
channelId: string,
messageId: string,
emoji: string,
): Promise<void>

Delete a reaction the current user has made for the message. Returns a 204 empty response on success. The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji.

deletePinnedChannelMessage(channelId: string, messageId: string): Promise<void>

Delete a pinned message in a channel. Requires the MANAGE_MESSAGES permission. Returns a 204 empty response on success.

deletePurchaseDiscount(skuId: string, userId: string): Promise<unknown>

Deletes the currently active discount on the given SKU for the given user. You do not need to call this after a user has made a discounted purchase; successful discounted purchases will automatically remove the discount for that user for subsequent purchases.

deleteTestEntitlement(applicationId: string, entitlementId: string): Promise<unknown>

Deletes a test entitlement for an application. You can only delete entitlements that were "purchased" in developer test mode; these are entitlements of type == TestModePurchase. You cannot use this route to delete arbitrary entitlements that users actually purchased.

deleteUserReaction(
channelId: string,
messageId: string,
emoji: string,
userId: string,
): Promise<void>

Deletes another user's reaction. This endpoint requires the 'MANAGE_MESSAGES' permission to be present on the current user. Returns a 204 empty response on success. The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji.

deleteWebhook(webhookId: string): Promise<void>

Delete a webhook permanently. Requires the MANAGE_WEBHOOKS permission. Returns a 204 NO CONTENT response on success.

deleteWebhookWithToken(webhookId: string, webhookToken: string): Promise<void>

Same as above, except this call does not require authentication.

editChannelPermissions(
channelId: string,
overwriteId: string,
): Promise<void>

Edit the channel permission overwrites for a user or role in a channel. Only usable for guild channels. Requires the MANAGE_ROLES permission. Only permissions your bot has in the guild or channel can be allowed/denied (unless your bot has a MANAGE_ROLES overwrite in the channel). Returns a 204 empty response on success. For more information about permissions, see permissions.

editFollowupMessage(
applicationId: string,
interactionToken: string,
messageId: string,
): Promise<MessagePayload>

Edits a followup message for an Interaction. Functions the same as Edit Webhook Message.

editGlobalApplicationCommand(
applicationId: string,
commandId: string,
): Promise<ApplicationCommandPayload>
editGuildApplicationCommand(
applicationId: string,
guildId: string,
commandId: string,
): Promise<ApplicationCommandPayload>
editMessage(
channelId: string,
messageId: string,
): Promise<MessagePayload>

Edit a previously sent message. The fields content, embed, allowed_mentions and flags can be edited by the original message author. Other users can only edit flags and only if they have the MANAGE_MESSAGES permission in the corresponding channel. When specifying flags, ensure to include all previously set flags/bits in addition to ones that you are modifying. Only flags documented in the table below may be modified by users (unsupported flag changes are currently ignored without error). Returns a message object. Fires a Message Update Gateway event.

editOriginalInteractionResponse(
applicationId: string,
interactionToken: string,
): Promise<MessagePayload>

Edits the initial Interaction response. Functions the same as Edit Webhook Message.

editWebhookMessage(
webhookId: string,
webhookToken: string,
messageId: string,
): Promise<MessagePayload>

Edits a previously-sent webhook message from the same token. Returns a message object on success.

executeGitHubCompatibleWebhook(
webhookId: string,
webhookToken: string,
payload: unknown,
): Promise<MessagePayload>
executeSlackCompatibleWebhook(
webhookId: string,
webhookToken: string,
payload: unknown,
): Promise<MessagePayload>
executeWebhook(
webhookId: string,
webhookToken: string,
): Promise<MessagePayload>
followNewsChannel(channelId: string): Promise<FollowedChannel>

Follow a News Channel to send messages to a target channel. Requires the MANAGE_WEBHOOKS permission in the target channel. Returns a followed channel object.

getActiveThreads(channelId: string, params?: { before?: string; limit?: number; }): Promise<{ threads: ThreadChannelPayload[]; members: ThreadMemberPayload[]; has_more: boolean; }>

Returns all active threads in the channel, including public and private threads. Threads are ordered by their id, in descending order. Requires the READ_MESSAGE_HISTORY permission.

getChannel(channelId: string): Promise<ChannelPayload>

Get a channel by ID. Returns a channel object.

getChannelInvites(channelId: string): Promise<InviteWithMetadataPayload>

Returns a list of invite objects (with invite metadata) for the channel. Only usable for guild channels. Requires the MANAGE_CHANNELS permission.

getChannelMessage(channelId: string, messageId: string): Promise<MessagePayload>

Returns a specific message in the channel. If operating on a guild channel, this endpoint requires the 'READ_MESSAGE_HISTORY' permission to be present on the current user. Returns a message object on success.

getChannelMessages(channelId: string): Promise<MessagePayload[]>

Returns the messages for a channel. If operating on a guild channel, this endpoint requires the VIEW_CHANNEL permission to be present on the current user. If the current user is missing the 'READ_MESSAGE_HISTORY' permission in the channel then this will return no messages (since they cannot read the message history). Returns an array of message objects on success.

getChannelWebhooks(channelId: string): Promise<WebhookPayload[]>

Returns a list of channel webhook objects. Requires the MANAGE_WEBHOOKS permission.

Returns the bot's OAuth2 application object without flags.

Returns info about the current authorization. Requires authentication with a bearer token.

Returns the user object of the requester's account. For OAuth2, this requires the identify scope, which will return the object without an email, and optionally the email scope, which returns the object with an email.

getCurrentUserGuilds(): Promise<Partial<GuildPayload>>

Returns a list of partial guild objects the current user is a member of. Requires the guilds OAuth2 scope.

getEntitlement(applicationId: string, entitlementId: string): Promise<unknown>

Fetch an entitlement by its ID. This may be useful in confirming that a user has a given entitlement that another call or the SDK says they do.

getEntitlements(applicationId: string): Promise<unknown>

Gets entitlements for a given user. You can use this on your game backend to check entitlements of an arbitrary user, or perhaps in an administrative panel for your support team.

getGateway(): Promise<{ url: string; }>
getGlobalApplicationCommand(applicationId: string, commandId: string): Promise<ApplicationCommandPayload[]>

Fetch a global command for your application. Returns an ApplicationCommand object.

Fetch all of the global commands for your application. Returns an array of ApplicationCommand objects.

getGuild(guildId: string): Promise<GuildPayload>

Returns the guild object for the given id. If with_counts is set to true, this endpoint will also return approximate_member_count and approximate_presence_count for the guild.

getGuildApplicationCommand(
applicationId: string,
guildId: string,
commandId: string,
): Promise<ApplicationCommandPayload>

Fetch a guild command for your application. Returns an ApplicationCommand object.

getGuildApplicationCommands(applicationId: string, guildId: string): Promise<ApplicationCommandPayload[]>

Fetch all of the guild commands for your application for a specific guild. Returns an array of ApplicationCommand objects.

getGuildAuditLog(guildId: string, params: { userId?: string; actionType?: AuditLogEvents; before?: string; limit?: number; }): Promise<AuditLogPayload>

Returns an audit log object for the guild. Requires the 'VIEW_AUDIT_LOG' permission.

getGuildBan(guildId: string, userId: string): Promise<GuildBanPayload>

Returns a ban object for the given user or a 404 not found if the ban cannot be found. Requires the BAN_MEMBERS permission.

getGuildBans(guildId: string): Promise<GuildBanPayload[]>

Returns a list of ban objects for the users banned from this guild. Requires the BAN_MEMBERS permission.

getGuildChannels(guildId: string): Promise<ChannelPayload[]>

Returns a list of guild channel objects.

getGuildEmoji(guildId: string, emojiId: string): Promise<EmojiPayload>

Returns an emoji object for the given guild and emoji IDs.

getGuildIntegrations(guildId: string): Promise<GuildIntegrationPayload[]>

Returns a list of integration objects for the guild. Requires the MANAGE_GUILD permission.

getGuildInvites(guildId: string): Promise<InviteWithMetadataPayload[]>

Returns a list of invite objects (with invite metadata) for the guild. Requires the MANAGE_GUILD permission.

getGuildMember(guildId: string, userId: string): Promise<MemberPayload>

Returns a guild member object for the specified user.

getGuildPreview(guildId: string): Promise<GuildPreviewPayload>

Returns the guild preview object for the given id. If the user is not in the guild, then the guild must be Discoverable.

getGuildPruneCount(guildId: string): Promise<GuildPruneCountPayload>

Returns an object with one 'pruned' key indicating the number of members that would be removed in a prune operation. Requires the KICK_MEMBERS permission. By default, prune will not remove users with roles. You can optionally include specific roles in your prune by providing the include_roles parameter. Any inactive user that has a subset of the provided role(s) will be counted in the prune and users with additional roles will not.

getGuildRoles(guildId: string): Promise<RolePayload[]>

Returns a list of role objects for the guild.

getGuildSticker(guildID: string, stickerID: string): Promise<MessageStickerPayload>

Returns a sticker object for the given guild and sticker IDs. Includes the user field if the bot has the MANAGE_EMOJIS_AND_STICKERS permission.

getGuildStickers(guildID: string): Promise<MessageStickerPayload[]>

Returns an array of sticker objects for the given guild. Includes user fields if the bot has the MANAGE_EMOJIS_AND_STICKERS permission.

getGuildTemplates(guildId: string): Promise<TemplatePayload[]>

Returns an array of template objects. Requires the MANAGE_GUILD permission.

getGuildVanityURL(guildId: string): Promise<Partial<InviteWithMetadataPayload>>

Returns a partial invite object for guilds with that feature enabled. Requires the MANAGE_GUILD permission. code will be null if a vanity url for the guild is not set.

getGuildVoiceRegions(guildId: string): Promise<VoiceRegion[]>

Returns a list of voice region objects for the guild. Unlike the similar /voice route, this returns VIP servers when the guild is VIP-enabled.

getGuildWebhooks(guildId: string): Promise<WebhookPayload[]>

Returns a list of guild webhook objects. Requires the MANAGE_WEBHOOKS permission.

getGuildWidget(guildId: string): Promise<any>

Returns the widget for the guild.

getGuildWidgetImage(guildId: string): string

Returns a PNG image widget for the guild. Requires no permissions or authentication.

getGuildWidgetSettings(guildId: string): Promise<GuildWidgetPayload>

Returns a guild widget object. Requires the MANAGE_GUILD permission.

getInvite(inviteCode: string): Promise<InvitePayload>

Returns an invite object for the given code.

getJoinedPrivateArchivedThreads(channelId: string, params?: { before?: string; limit?: number; }): Promise<{ threads: ThreadChannelPayload[]; members: ThreadMemberPayload[]; has_more: boolean; }>

Returns archived threads in the channel that are of type PRIVATE_THREAD, and the user has joined. Threads are ordered by their id, in descending order. Requires the READ_MESSAGE_HISTORY permission.

getPinnedMessages(channelId: string): Promise<MessagePayload[]>

Returns all pinned messages in the channel as an array of message objects.

getPrivateArchivedThreads(channelId: string, params?: { before?: string; limit?: number; }): Promise<{ threads: ThreadChannelPayload[]; members: ThreadMemberPayload[]; has_more: boolean; }>

Returns archived threads in the channel that are of type PRIVATE_THREAD. Threads are ordered by archive_timestamp, in descending order. Requires both the READ_MESSAGE_HISTORY and MANAGE_THREADS permissions.

getPublicArchivedThreads(channelId: string, params?: { before?: string; limit?: number; }): Promise<{ threads: ThreadChannelPayload[]; members: ThreadMemberPayload[]; has_more: boolean; }>

Returns archived threads in the channel that are public. When called on a GUILD_TEXT channel, returns threads of type PUBLIC_THREAD. When called on a GUILD_NEWS channel returns threads of type NEWS_THREAD. Threads are ordered by archive_timestamp, in descending order. Requires the READ_MESSAGE_HISTORY permission.

getReactions(
channelId: string,
messageId: string,
emoji: string,
): Promise<UserPayload[]>

Get a list of users that reacted with this emoji. Returns an array of user objects on success. The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji.

getSKUs(applicationId: string): Promise<unknown>

Get all SKUs for an application.

getSticker(stickerID: string): Promise<MessageStickerPayload>

Returns a sticker object for the given sticker ID.

Returns the list of sticker packs available to Nitro subscribers.

getTemplate(templateCode: string): Promise<TemplatePayload>

Returns a template object for the given code.

getThreadMembers(channelId: string): Promise<ThreadMemberPayload[]>

Returns array of thread members objects that are members of the thread.

getUser(userId: string): Promise<UserPayload>

Returns a user object for a given user ID.

getUserConnections(): Promise<unknown[]>

Returns a list of connection objects. Requires the connections OAuth2 scope.

Returns a list of DM channel objects. For bots, this is no longer a supported method of getting recent DMs, and will return an empty array.

getWebhook(webhookId: string): Promise<WebhookPayload[]>

Returns the new webhook object for the given id.

getWebhookWithToken(webhookId: string, webhookToken: string): Promise<WebhookPayload>

Same as above, except this call does not require authentication and returns no user in the webhook object.

groupDmAddRecipient(channelId: string, userId: string): Promise<unknown>

Adds a recipient to a Group DM using their access token

groupDmRemoveRecipient(channelId: string, userId: string): Promise<void>

Removes a recipient from a Group DM

joinThread(channelId: string): Promise<undefined>

Adds the current user to a thread. Returns a 204 empty response on success. Also requires the thread is not archived. Fires a Thread Members Update Gateway event.

leaveGuild(guildId: string): Promise<void>

Leave a guild. Returns a 204 empty response on success.

leaveThread(channelId: string): Promise<void>

Removes the current user from a thread. Returns a 204 empty response on success. Fires a Thread Members Update Gateway event.

listGuildEmojis(guildId: string): Promise<EmojiPayload[]>

Returns a list of emoji objects for the given guild.

listGuildMembers(guildId: string, params: { limit?: number; after?: string; }): Promise<MemberPayload[]>

Returns a list of guild member objects that are members of the guild.

Returns an array of voice region objects that can be used when creating servers.

modifyChannel(channelId: string, payload: Partial<ChannelPayload>): Promise<ChannelPayload>

Update a channel's settings. Requires the MANAGE_CHANNELS permission for the guild. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. Fires a Channel Update Gateway event. If modifying a category, individual Channel Update events will fire for each child channel that also changes. If modifying permission overwrites, the MANAGE_ROLES permission is required. Only permissions your bot has in the guild or channel can be allowed/denied (unless your bot has a MANAGE_ROLES overwrite in the channel). All JSON parameters are optional.

modifyCurrentUser(payload: { username?: string; avatar?: string | null; }): Promise<UserPayload>

Modify the requester's user account settings. Returns a user object on success.

modifyCurrentUserNick(guildId: string, payload: { nick?: string | null; }): Promise<string>

Modifies the nickname of the current user in a guild. Returns a 200 with the nickname on success. Fires a Guild Member Update Gateway event.

modifyGuild(guildId: string, payload: Partial<GuildPayload>): Promise<GuildPayload>

Modify a guild's settings. Requires the MANAGE_GUILD permission. Returns the updated guild object on success. Fires a Guild Update Gateway event.

modifyGuildChannelPositions(guildId: string, payload: Array<{ id: string; position: number; }>): Promise<void>

Modify the positions of a set of channel objects for the guild. Requires MANAGE_CHANNELS permission. Returns a 204 empty response on success. Fires multiple Channel Update Gateway events.

modifyGuildEmoji(
guildId: string,
emojiId: string,
payload: Partial<EmojiPayload>,
): Promise<EmojiPayload>

Modify the given emoji. Requires the MANAGE_EMOJIS permission. Returns the updated emoji object on success. Fires a Guild Emojis Update Gateway event.

modifyGuildMember(
guildId: string,
userId: string,
payload: Partial<MemberPayload>,
): Promise<MemberPayload>

Modify attributes of a guild member. Returns a 200 OK with the guild member as the body. Fires a Guild Member Update Gateway event. If the channel_id is set to null, this will force the target user to be disconnected from voice.

modifyGuildRole(
guildId: string,
roleId: string,
): Promise<RolePayload>

Modify a guild role. Requires the MANAGE_ROLES permission. Returns the updated role on success. Fires a Guild Role Update Gateway event.

modifyGuildRolePositions(guildId: string, payload: Array<{ id: string; position: number; }>): Promise<RolePayload[]>

Modify the positions of a set of role objects for the guild. Requires the MANAGE_ROLES permission. Returns a list of all of the guild's role objects on success. Fires multiple Guild Role Update Gateway events. This endpoint takes a JSON array of parameters in the following format:

modifyGuildSticker(
guildID: string,
stickerID: string,
options: Partial<ModifyGuildStickerOptions>,
): Promise<MessageStickerPayload>

Modify the given sticker. Requires the MANAGE_EMOJIS_AND_STICKERS permission. Returns the updated sticker object on success.

modifyGuildTemplate(
guildId: string,
templateCode: string,
payload: Partial<TemplatePayload>,
): Promise<TemplatePayload>

Modifies the template's metadata. Requires the MANAGE_GUILD permission. Returns the template object on success.

modifyGuildWidget(guildId: string, payload: Partial<GuildWidgetPayload>): Promise<GuildWidgetPayload>

Modify a guild widget object for the guild. All attributes may be passed in with JSON and modified. Requires the MANAGE_GUILD permission. Returns the updated guild widget object.

modifyWebhook(webhookId: string, payload: { name?: string; avatar?: string | null; }): Promise<WebhookPayload>

Modify a webhook. Requires the MANAGE_WEBHOOKS permission. Returns the updated webhook object on success.

modifyWebhookWithToken(
webhookId: string,
webhookToken: string,
payload: { name?: string; avatar?: string | null; },
): Promise<WebhookPayload>

Same as above, except this call does not require authentication, does not accept a channel_id parameter in the body, and does not return a user in the webhook object.

removeGuildBan(guildId: string, userId: string): Promise<void>

Remove the ban for a user. Requires the BAN_MEMBERS permissions. Returns a 204 empty response on success. Fires a Guild Ban Remove Gateway event.

removeGuildMember(guildId: string, userId: string): Promise<void>

Remove a member from a guild. Requires KICK_MEMBERS permission. Returns a 204 empty response on success. Fires a Guild Member Remove Gateway event.

removeGuildMemberRole(
guildId: string,
userId: string,
roleId: string,
): Promise<void>

Removes a role from a guild member. Requires the MANAGE_ROLES permission. Returns a 204 empty response on success. Fires a Guild Member Update Gateway event.

removeUserFromThread(channelId: string, userId: string): Promise<void>

Removes another user from a thread. Requires the MANAGE_THREADS permission or that you are the creator of the thread. Also requires the thread is not archived. Returns a 204 empty response on success. Fires a Thread Members Update Gateway event.

searchGuildMembers(guildId: string, params: { query: string; limit?: number; }): Promise<MemberPayload[]>

Returns a list of guild member objects whose username or nickname starts with a provided string.

startPrivateThread(channelId: string, payload: CreateThreadPayload): Promise<ThreadChannelPayload>

Creates a new private thread. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. Fires a Thread Create Gateway event.

startPublicThread(
channelId: string,
messageId: string,
): Promise<ThreadChannelPayload>

Creates a new public thread from an existing message. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. Fires a Thread Create Gateway event.

startPublicThreadFromMessage(
channelId: string,
messageId: string,
): Promise<ThreadChannelPayload>

Creates a new thread from an existing message. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. Fires a Thread Create Gateway event.

Creates a new thread from an existing message. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters. Fires a Thread Create Gateway event.

syncGuildTemplate(guildId: string, templateCode: string): Promise<TemplatePayload>

Syncs the template to the guild's current state. Requires the MANAGE_GUILD permission. Returns the template object on success.

triggerTypingIndicator(channelId: string): Promise<void>

Post a typing indicator for the specified channel. Generally bots should not implement 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. Returns a 204 empty response on success. Fires a Typing Start Gateway event.