Class Rest

The rest manager. Used for making rest requests to the Discord API.

Hierarchy

  • RestRequests
    • Rest

Constructors

Properties

Accessors

Methods

addGuildMember addGuildMemberRole addThreadMember beginGuildPrune bulkDeleteMessages bulkOverwriteGlobalApplicationCommands bulkOverwriteGuildApplicationCommands createAutoModerationRule createChannelInvite createDM createFollowupMessage createGlobalApplicationCommand createGuild createGuildApplicationCommand createGuildBan createGuildChannel createGuildEmoji createGuildRole createGuildScheduledEvent createGuildSticker createInteractionResponse createMessage createReaction createStageInstance createWebhook crosspostMessage deleteAllReactions deleteAllReactionsForEmoji deleteAutoModerationRule deleteChannel deleteChannelPermission deleteFollowupMessage deleteGlobalApplicationCommand deleteGuild deleteGuildApplicationCommand deleteGuildEmoji deleteGuildIntegration deleteGuildRole deleteGuildScheduledEvent deleteGuildSticker deleteInvite deleteMessage deleteOriginalInteractionResponse deleteOwnReaction deleteStageInstance deleteUserReaction deleteWebhook deleteWebhookMessage deleteWebhookWithToken editApplicationCommandPermissions editChannelPermissions editFollowupMessage editGlobalApplicationCommand editGuildApplicationCommand editMessage editOriginalInteractionResponse editWebhookMessage executeWebhook followNewsChannel getApplicationCommandPermissions getAutoModerationRule getChannel getChannelInvites getChannelMessage getChannelMessages getChannelWebhooks getCurrentAuthorizationInformation getCurrentBotApplicationInformation getCurrentUser getCurrentUserGuildMember getCurrentUserGuilds getFollowupMessage getGateway getGatewayBot getGlobalApplicationCommand getGlobalApplicationCommands getGuild getGuildApplicationCommand getGuildApplicationCommandPermissions getGuildApplicationCommands getGuildAuditLog getGuildBan getGuildBans getGuildChannels getGuildEmoji getGuildIntegrations getGuildInvites getGuildMember getGuildPreview getGuildPruneCount getGuildRoles getGuildScheduledEvent getGuildScheduledEventUsers getGuildSticker getGuildVanityURL getGuildVoiceRegions getGuildWebhooks getGuildWelcomeScreen getGuildWidget getGuildWidgetSettings getInvite getOriginalInteractionResponse getPinnedMessages getReactions getStageInstance getSticker getUser getUserConnections getWebhook getWebhookMessage getWebhookWithToken groupDMAddRecipient groupDMRemoveRecipient joinThread leaveGuild leaveThread listActiveThreads listAutoModerationRulesForGuild listGuildEmojis listGuildMembers listGuildStickers listJoinedPrivateArchivedThreads listNitroStickerPacks listPrivateArchivedThreads listPublicArchivedThreads listScheduledEventsForGuild listThreadMembers listVoiceRegions make modifyAutoModerationRule modifyChannel modifyCurrentMember modifyCurrentUser modifyCurrentUserVoiceState modifyGuild modifyGuildChannelPositions modifyGuildEmoji modifyGuildMFALevel modifyGuildMember modifyGuildRole modifyGuildRolePositions modifyGuildScheduledEvent modifyGuildSticker modifyGuildWelcomeScreen modifyGuildWidget modifyStageInstance modifyUserVoiceState modifyWebhook modifyWebhookWithToken pinMessage removeGuildBan removeGuildMember removeGuildMemberRole removeThreadMember request searchGuildMembers startThreadFromMessage startThreadInForumChannel startThreadWithoutMessage sweepBuckets triggerTypingIndicator unpinMessage

Constructors

Properties

bucketSweepInterval: null | Timer = null

The interval used for sweeping inactive buckets.

buckets: null | ExtendedMap<`${string}(${string})`, RestBucket> = null

Rate limit buckets. Each bucket's key is it's ID.

globalLeft: null | number = null

The amount of requests left in the global rate limit bucket.

globalResetAt: null | number = null

A unix millisecond timestamp at which the global rate limit resets.

options: Required<RestOptions> & RestRequestOptions

Options for the rest manager.

responseCodeTally: Record<string, number> = {}

A tally of the number of responses that returned a specific response code. Note that response codes aren't included if they were never received.

routeHashCache: null | ExtendedMap<`GET;${string}` | `POST;${string}` | `DELETE;${string}` | `PATCH;${string}` | `PUT;${string}`, string> = null

Cached route rate limit bucket hashes. Keys are cached route hashes, with their values being their corresponding RestBucketHash bucket hash.

system: "Rest" = ...

The system string used for logging.

Accessors

  • get responseCodeRatio(): Record<string, number>
  • Get the ratio of response codes. Each code's value is the percentage it was received (0 to 100). Note that response codes aren't included if they were never received.

    Returns Record<string, number>

Methods

  • Parameters

    • guildId: string

      The guild ID.

    • userId: string

      The user ID.

    • body: RESTPutAPIGuildMemberJSONBody

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIGuildMember>

  • Parameters

    • guildId: string

      The guild ID.

    • userId: string

      The user ID.

    • roleId: string

      The role ID.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • guildId: string

      The guild ID.

    • body: RESTPostAPIGuildPruneJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTPostAPIGuildPruneResult>

  • Parameters

    • channelId: string

      The channel ID.

    • body: RESTPostAPIChannelMessagesBulkDeleteJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • applicationId: string

      The application ID.

    • body: RESTPutAPIApplicationCommandsJSONBody

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTPutAPIApplicationCommandsResult>

  • Parameters

    • applicationId: string

      The application ID.

    • guildId: string

      The guild ID.

    • body: RESTPutAPIApplicationGuildCommandsJSONBody

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTPutAPIApplicationGuildCommandsResult>

  • Parameters

    • guildId: string

      The guild ID.

    • body: RESTPostAPIAutoModerationRuleJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIAutoModerationRule>

  • Parameters

    • channelId: string

      The channel ID.

    • body: RESTPostAPIChannelInviteJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIExtendedInvite>

  • Parameters

    • applicationId: string

      The application ID.

    • interactionToken: string

      The interaction token.

    • body: FormData | APIInteractionResponseCallbackData

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIMessage>

  • Parameters

    • applicationId: string

      The application ID.

    • body: RESTPostAPIApplicationCommandsJSONBody

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIApplicationCommand>

  • Parameters

    • applicationId: string

      The application ID.

    • guildId: string

      The guild ID.

    • body: RESTPostAPIApplicationGuildCommandsJSONBody

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTPostAPIApplicationGuildCommandsResult>

  • Parameters

    • guildId: string

      The guild ID.

    • userId: string

      The user ID.

    • body: RESTPutAPIGuildBanJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • guildId: string

      The guild ID.

    • body: RESTPostAPIGuildChannelJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIChannel>

  • Parameters

    • guildId: string

      The guild ID.

    • body: RESTPostAPIGuildEmojiJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIEmoji>

  • Parameters

    • guildId: string

      The guild ID.

    • body: RESTPostAPIGuildRoleJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIRole>

  • Parameters

    • guildId: string

      The guild ID.

    • body: RESTPostAPIGuildScheduledEventJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIGuildScheduledEvent>

  • Parameters

    • guildId: string

      The guild ID.

    • body: FormData

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APISticker>

  • Parameters

    • interactionId: string

      The interaction ID.

    • interactionToken: string

      The interaction token.

    • body: FormData | APIInteractionResponse

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • channelId: string

      The channel ID.

    • body: FormData | RESTPostAPIChannelMessageJSONBody

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIMessage>

  • Parameters

    • channelId: string

      The channel ID.

    • messageId: string

      The message ID.

    • emoji: string

      The emoji's identifier.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • body: RESTPostAPIStageInstanceJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIStageInstance>

  • Parameters

    • channelId: string

      The channel ID.

    • body: RESTPostAPIChannelWebhookJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIWebhook>

  • Parameters

    • channelId: string

      The channel ID.

    • messageId: string

      The message ID.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIMessage>

  • Parameters

    • channelId: string

      The channel ID.

    • messageId: string

      The message ID.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • channelId: string

      The channel ID.

    • messageId: string

      The message ID.

    • emoji: string

      The emoji's identifier.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • guildId: string

      The guild ID.

    • autoModerationRuleId: string

      The auto moderation rule ID.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • channelId: string

      The channel ID.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIChannel>

  • Parameters

    • channelId: string

      The channel ID.

    • overwriteId: string

      The overwrite's ID.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • applicationId: string

      The application ID.

    • interactionToken: string

      The interaction token.

    • messageId: string

      The message ID.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • applicationId: string

      The application ID.

    • commandId: string

      The command ID.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • applicationId: string

      The application ID.

    • guildId: string

      The guild ID.

    • commandId: string

      The command ID.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • guildId: string

      The guild ID.

    • emoji: string

      The emoji's identifier.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • guildId: string

      The guild ID.

    • integrationId: string

      The integration ID.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • guildId: string

      The guild ID.

    • roleId: string

      The role ID.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • guildId: string

      The guild ID.

    • stickerId: string

      The sticker ID.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • inviteCode: string

      The invite code.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIInvite>

  • Parameters

    • channelId: string

      The channel ID.

    • messageId: string

      The message ID.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • applicationId: string

      The application ID.

    • interactionToken: string

      The interaction token.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • channelId: string

      The channel ID.

    • messageId: string

      The message ID.

    • emoji: string

      The emoji's identifier.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • channelId: string

      The channel ID.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • channelId: string

      The channel ID.

    • messageId: string

      The message ID.

    • emoji: string

      The emoji's identifier.

    • userId: string

      The user ID.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • webhookId: string

      The webhook ID.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • webhookId: string

      The webhook ID.

    • token: string

      The webhook's token.

    • messageId: string

      The message ID.

    • Optional threadId: string

      The thread ID.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • webhookId: string

      The webhook ID.

    • token: string
    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • applicationId: string

      The application ID.

    • guildId: string

      The guild ID.

    • commandId: string

      The command ID.

    • body: RESTPutAPIApplicationCommandPermissionsJSONBody

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIGuildApplicationCommandPermissions>

  • Parameters

    • channelId: string

      The channel ID.

    • overwriteId: string

      The overwrite ID.

    • body: RESTPutAPIChannelPermissionJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • applicationId: string

      The application ID.

    • interactionToken: string

      The interaction token.

    • messageId: string

      The message ID.

    • body: FormData | RESTPatchAPIWebhookWithTokenMessageJSONBody

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIMessage>

  • Parameters

    • applicationId: string

      The application ID.

    • commandId: string

      The command ID.

    • body: RESTPatchAPIApplicationCommandJSONBody

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIApplicationCommand>

  • Parameters

    • applicationId: string

      The application ID.

    • guildId: string

      The guild ID.

    • commandId: string

      The command ID.

    • body: RESTPatchAPIApplicationGuildCommandJSONBody

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTPatchAPIApplicationGuildCommandResult>

  • Parameters

    • channelId: string

      The channel ID.

    • messageId: string

      The message ID.

    • body: FormData | RESTPatchAPIChannelMessageJSONBody

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIMessage>

  • Parameters

    • applicationId: string

      The application ID.

    • interactionToken: string

      The interaction token.

    • body: FormData | RESTPatchAPIWebhookWithTokenMessageJSONBody

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIMessage>

  • Parameters

    • webhookId: string

      The webhook ID.

    • token: string

      The webhook's token.

    • messageId: string

      The message ID.

    • body: FormData | RESTPatchAPIWebhookWithTokenMessageJSONBody
    • Optional threadId: string

      The thread ID.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIMessage>

  • Type Parameters

    • T extends boolean = false

    Parameters

    • webhookId: string

      The webhook ID.

    • token: string

      The webhook's token.

    • body: FormData | RESTPostAPIWebhookWithTokenJSONBody

      Request body.

    • Optional wait: T

      If the response should wait until server confirmation.

    • Optional threadId: string

      The thread ID.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<T extends true
        ? APIMessage
        : never>

  • Parameters

    • channelId: string

      The channel ID.

    • body: RESTPostAPIChannelFollowersJSONBody

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIFollowedChannel>

  • Parameters

    • applicationId: string

      The application ID.

    • guildId: string

      The guild ID.

    • commandId: string

      The command ID.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIGuildApplicationCommandPermissions>

  • Parameters

    • guildId: string

      The guild ID.

    • autoModerationRuleId: string

      The auto moderation rule ID.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIAutoModerationRule>

  • Parameters

    Returns Promise<RESTGetAPIChannelInvitesResult>

  • Parameters

    • channelId: string

      The channel ID.

    • messageId: string

      The message ID.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIMessage>

  • Parameters

    • channelId: string

      The channel ID.

    • query: RESTGetAPIChannelMessagesQuery

      Request query.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTGetAPIChannelMessagesResult>

  • Parameters

    Returns Promise<RESTGetAPIChannelWebhooksResult>

  • Parameters

    Returns Promise<RESTGetAPIOAuth2CurrentAuthorizationResult>

  • Parameters

    Returns Promise<RESTGetAPIOAuth2CurrentApplicationResult>

  • Parameters

    • query: RESTGetAPICurrentUserGuildsQuery

      Request query.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTGetAPICurrentUserGuildsResult>

  • Parameters

    • applicationId: string

      The application ID.

    • interactionToken: string

      The interaction token.

    • messageId: string

      The message ID.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIMessage>

  • Parameters

    • applicationId: string

      The application ID.

    • commandId: string

      The command ID.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIApplicationCommand>

  • Parameters

    • applicationId: string

      The application ID.

    • query: RESTGetAPIApplicationCommandsQuery

      Request query.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTGetAPIApplicationCommandsResult>

  • Parameters

    • applicationId: string

      The application ID.

    • guildId: string

      The guild ID.

    • commandId: string

      The command ID.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTGetAPIApplicationGuildCommandResult>

  • Parameters

    • applicationId: string

      The application ID.

    • guildId: string

      The guild ID.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTGetAPIGuildApplicationCommandsPermissionsResult>

  • Parameters

    • applicationId: string

      The application ID.

    • guildId: string

      The guild ID.

    • query: RESTGetAPIApplicationCommandsQuery

      Request query.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTGetAPIApplicationGuildCommandsResult>

  • Parameters

    • guildId: string

      The guild ID.

    • query: RESTGetAPIAuditLogQuery

      Request query.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIAuditLog>

  • Parameters

    • guildId: string

      The guild ID.

    • query: RESTGetAPIGuildBansQuery

      Request query.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTGetAPIGuildBansResult>

  • Parameters

    Returns Promise<RESTGetAPIGuildIntegrationsResult>

  • Parameters

    • guildId: string

      The guild ID.

    • query: RESTGetAPIGuildPruneCountQuery

      Request query.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTGetAPIGuildPruneCountResult>

  • Parameters

    • guildId: string

      The guild ID.

    • eventId: string

      The event ID.

    • query: RESTGetAPIGuildScheduledEventQuery

      Request query.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIGuildScheduledEvent>

  • Parameters

    • guildId: string

      The guild ID.

    • eventId: string

      The event ID.

    • query: RESTGetAPIGuildScheduledEventUsersQuery

      Request query.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTGetAPIGuildScheduledEventUsersResult>

  • Parameters

    Returns Promise<RESTGetAPIGuildVoiceRegionsResult>

  • Parameters

    • applicationId: string

      The application ID.

    • interactionToken: string

      The interaction token.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIMessage>

  • Parameters

    • channelId: string

      The channel ID.

    • messageId: string

      The message ID.

    • emoji: string

      The emoji's identifier.

    • query: RESTGetAPIChannelMessageReactionUsersQuery

      Request query.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTGetAPIChannelMessageReactionUsersResult>

  • Parameters

    • webhookId: string

      The webhook ID.

    • token: string

      The webhook's token.

    • messageId: string

      The message ID.

    • Optional threadId: string

      The thread ID.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIMessage>

  • Parameters

    • webhookId: string

      The webhook ID.

    • token: string

      The webhook's token.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTGetAPIWebhookWithTokenResult>

  • Parameters

    • channelId: string

      The channel ID.

    • userId: string

      The user ID.

    • body: RESTPutAPIChannelRecipientJSONBody

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<unknown>

  • Parameters

    • channelId: string

      The channel ID.

    • userId: string

      The user ID.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<unknown>

  • Parameters

    Returns Promise<RESTGetAPIAutoModerationRulesResult>

  • Parameters

    • guildId: string

      The guild ID.

    • query: RESTGetAPIGuildMembersQuery

      Request query.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTGetAPIGuildMembersResult>

  • Parameters

    • channelId: string

      The channel ID.

    • query: RESTGetAPIChannelThreadsArchivedQuery

      Request query.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTGetAPIChannelUsersThreadsArchivedResult>

  • Parameters

    • channelId: string

      The channel ID.

    • query: RESTGetAPIChannelThreadsArchivedQuery

      Request query.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTGetAPIChannelUsersThreadsArchivedResult>

  • Parameters

    • channelId: string

      The channel ID.

    • query: RESTGetAPIChannelThreadsArchivedQuery

      Request query.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTGetAPIChannelUsersThreadsArchivedResult>

  • Parameters

    • guildId: string

      The guild ID.

    • query: RESTGetAPIGuildScheduledEventsQuery

      Request query.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTGetAPIGuildScheduledEventsResult>

  • Parameters

    Returns Promise<RESTGetAPIChannelThreadMembersResult>

  • Internal

    The internal rest make method. Used by rest buckets, and the Rest#request() method if rate limits are turned off. Only use this method if you know exactly what you are doing.

    Parameters

    • method: RestMethod

      The request's method.

    • route: `/${string}`

      The requests's route, relative to the base Discord API URL. (Example: /channels/123456789000000000)

    • options: RestRequestData

      Request options.

    Returns Promise<RestInternalRestResponse>

    The full undici response.

  • Parameters

    • guildId: string

      The guild ID.

    • autoModerationRuleId: string

      The auto moderation rule ID.

    • body: RESTPatchAPIAutoModerationRuleJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIAutoModerationRule>

  • Parameters

    • channelId: string

      The channel ID.

    • body: RESTPatchAPIChannelJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIChannel>

  • Parameters

    • guildId: string

      The guild ID.

    • body: RESTPatchAPICurrentGuildMemberJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIGuildMember>

  • Parameters

    • guildId: string

      The guild ID.

    • body: RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • guildId: string

      The guild ID.

    • body: RESTPatchAPIGuildJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIGuild>

  • Parameters

    • guildId: string

      The guild ID.

    • body: RESTPatchAPIGuildChannelPositionsJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • guildId: string

      The guild ID.

    • body: RESTPatchAPIGuildEmojiJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIEmoji>

  • Parameters

    • guildId: string

      The guild ID.

    • body: RESTPostAPIGuildsMFAJSONBody

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTPostAPIGuildsMFAJSONBody>

  • Parameters

    • guildId: string

      The guild ID.

    • userId: string

      The user ID.

    • body: RESTPatchAPIGuildMemberJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIGuildMember>

  • Parameters

    • guildId: string

      The guild ID.

    • roleId: string

      The role ID.

    • body: RESTPatchAPIGuildRoleJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIRole>

  • Parameters

    • guildId: string

      The guild ID.

    • body: RESTPatchAPIGuildRolePositionsJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTPatchAPIGuildRolePositionsResult>

  • Parameters

    • guildId: string

      The guild ID.

    • eventId: string

      The event ID.

    • body: RESTPatchAPIGuildScheduledEventJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIGuildScheduledEvent>

  • Parameters

    • guildId: string

      The guild ID.

    • stickerId: string

      The sticker ID.

    • body: RESTPatchAPIGuildStickerJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APISticker>

  • Parameters

    • guildId: string

      The guild ID.

    • body: RESTPatchAPIGuildWelcomeScreenJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIGuildWelcomeScreen>

  • Parameters

    • guildId: string

      The guild ID.

    • body: AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Partial<APIGuildWidgetSettings>>

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIGuildWidgetSettings>

  • Parameters

    • channelId: string

      The channel ID.

    • body: RESTPatchAPIStageInstanceJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIStageInstance>

  • Parameters

    • guildId: string

      The guild ID.

    • userId: string

      The user ID.

    • body: RESTPatchAPIGuildVoiceStateUserJSONBody

      Request body.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • webhookId: string

      The webhook ID.

    • body: RESTPatchAPIWebhookJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIWebhook>

  • Parameters

    • webhookId: string

      The webhook ID.

    • token: string

      The webhook's token.

    • body: RESTPatchAPIWebhookWithTokenJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTGetAPIWebhookWithTokenResult>

  • Parameters

    • channelId: string

      The channel ID.

    • messageId: string

      The message ID.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • guildId: string

      The guild ID.

    • userId: string

      The user ID.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • guildId: string

      The guild ID.

    • userId: string

      The user ID.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Parameters

    • guildId: string

      The guild ID.

    • userId: string

      The user ID.

    • roleId: string

      The role ID.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

  • Make a rest request.

    Parameters

    • method: RestMethod

      The request's method.

    • route: `/${string}`

      The requests's route, relative to the base Discord API URL. (Example: /channels/123456789000000000)

    • options: RestRequestData = {}

      Request options.

    Returns Promise<any>

    Response body.

  • Parameters

    • guildId: string

      The guild ID.

    • query: RESTGetAPIGuildMembersSearchQuery

      Request query.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<RESTGetAPIGuildMembersSearchResult>

  • Parameters

    • channelId: string

      The channel ID.

    • messageId: string

      The message ID.

    • body: RESTPostAPIChannelMessagesThreadsJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIChannel>

  • See

    Discord API Reference

    Todo

    PR in discord-api-types for proper return type.

    Parameters

    • channelId: string

      The channel ID.

    • body: FormData | RESTPostAPIGuildForumThreadsJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIChannel>

  • Parameters

    • channelId: string

      The channel ID.

    • body: RESTPostAPIChannelThreadsJSONBody

      Request body.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<APIChannel>

  • Cleans up inactive buckets without active local rate limits. Useful for manually preventing potentially fatal memory leaks in large bots.

    Returns void

  • Parameters

    • channelId: string

      The channel ID.

    • messageId: string

      The message ID.

    • Optional reason: string

      The value for the X-Audit-Log-Reason header.

    • Optional options: RestRequestOptions

      Request options.

    Returns Promise<never>

Generated using TypeDoc