@discordeno/rest 22.0.1-next.4d5acdb → 22.0.1-next.4dc2c2f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import type { AddDmRecipientOptions, AddGuildMemberOptions, AddLobbyMember, AtLeastOne, BeginGuildPrune, BigString, Camelize, CreateApplicationCommand, CreateApplicationEmoji, CreateAutoModerationRuleOptions, CreateChannelInvite, CreateForumPostWithMessage, CreateGlobalApplicationCommandOptions, CreateGroupDmOptions, CreateGuildApplicationCommandOptions, CreateGuildBan, CreateGuildBulkBan, CreateGuildChannel, CreateGuildEmoji, CreateGuildRole, CreateGuildSoundboardSound, CreateGuildStickerOptions, CreateLobby, CreateMessageOptions, CreateScheduledEvent, CreateStageInstance, CreateTemplate, CreateTestEntitlement, CreateWebhook, DeleteWebhookMessageOptions, DiscordAccessTokenResponse, DiscordActivityInstance, DiscordApplication, DiscordApplicationCommand, DiscordApplicationCommandPermissions, DiscordApplicationRoleConnection, DiscordApplicationRoleConnectionMetadata, DiscordAuditLog, DiscordAutoModerationRule, DiscordBan, DiscordBulkBan, DiscordChannel, DiscordConnection, DiscordCurrentAuthorization, DiscordEmoji, DiscordEntitlement, DiscordFollowedChannel, DiscordGetAnswerVotesResponse, DiscordGetChannelPins, DiscordGetGatewayBot, DiscordGuild, DiscordGuildApplicationCommandPermissions, DiscordGuildOnboarding, DiscordGuildPreview, DiscordGuildWidget, DiscordGuildWidgetSettings, DiscordIncidentsData, DiscordIntegration, DiscordInteractionCallbackResponse, DiscordInvite, DiscordInviteMetadata, DiscordListActiveThreads, DiscordListArchivedThreads, DiscordLobby, DiscordLobbyMember, DiscordMember, DiscordMemberWithUser, DiscordMessage, DiscordPrunedCount, DiscordRole, DiscordScheduledEvent, DiscordSku, DiscordSoundboardSound, DiscordStageInstance, DiscordSticker, DiscordStickerPack, DiscordSubscription, DiscordTemplate, DiscordThreadMember, DiscordTokenExchange, DiscordTokenRevocation, DiscordUser, DiscordVanityUrl, DiscordVoiceRegion, DiscordVoiceState, DiscordWebhook, DiscordWelcomeScreen, EditApplication, EditAutoModerationRuleOptions, EditBotMemberOptions, EditChannelPermissionOverridesOptions, EditGuildOnboarding, EditGuildRole, EditGuildStickerOptions, EditMessage, EditOwnVoiceState, EditScheduledEvent, EditUserVoiceState, EditWebhookMessageOptions, ExecuteWebhook, FileContent, GetApplicationCommandPermissionOptions, GetBans, GetChannelPinsOptions, GetEntitlements, GetGlobalApplicationCommandsOptions, GetGuildApplicationCommandsOptions, GetGuildAuditLog, GetGuildPruneCountQuery, GetInvite, GetMessagesOptions, GetPollAnswerVotes, GetReactions, GetScheduledEvents, GetScheduledEventUsers, GetThreadMember, GetUserGuilds, GetWebhookMessageOptions, InteractionCallbackData, InteractionCallbackOptions, InteractionResponse, LinkChannelToLobby, ListArchivedThreads, ListGuildMembers, ListSkuSubscriptionsOptions, ListThreadMembers, ModifyApplicationEmoji, ModifyChannel, ModifyGuild, ModifyGuildChannelPositions, ModifyGuildEmoji, ModifyGuildIncidentActions, ModifyGuildMember, ModifyGuildSoundboardSound, ModifyGuildTemplate, ModifyGuildWelcomeScreen, ModifyLobby, ModifyRolePositions, ModifyWebhook, SearchMembers, SendSoundboardSound, StartThreadWithMessage, StartThreadWithoutMessage, UpsertGlobalApplicationCommandOptions, UpsertGuildApplicationCommandOptions } from '@discordeno/types';
1
+ import type { BigString, Camelize, FileContent } from '@discordeno/types';
2
2
  import type { logger } from '@discordeno/utils';
3
+ import type { RestEndpoints } from './endpoints.js';
3
4
  import type { InvalidRequestBucket } from './invalidBucket.js';
4
5
  import type { Queue } from './queue.js';
5
6
  import type { RestRoutes } from './typings/routes.js';
@@ -15,7 +16,6 @@ export interface CreateRestManagerOptions {
15
16
  proxy?: {
16
17
  /**
17
18
  * The base url to connect to. If you create a proxy rest, that url would go here.
18
- * IT SHOULD NOT END WITH A /
19
19
  * @default https://discord.com/api
20
20
  */
21
21
  baseUrl: string;
@@ -40,6 +40,25 @@ export interface CreateRestManagerOptions {
40
40
  * This value is actually required if you want to use `updateTokenQueues`
41
41
  */
42
42
  updateBearerTokenEndpoint?: string;
43
+ /**
44
+ * Whether an attempt that failed without producing a response should be re-sent to the proxy.
45
+ *
46
+ * @remarks
47
+ * This covers both an attempt that hit {@link CreateRestManagerOptions.requestTimeout | requestTimeout} and one whose
48
+ * connection failed. Neither tells us whether the proxy got the request: the timeout only aborts our side of the
49
+ * connection while the proxy keeps processing (it may simply be queued behind a rate limit), and a socket that dies
50
+ * once the request is on the wire may still have delivered it. `fetch` gives no way to tell those apart from never
51
+ * having connected at all, so re-sending can execute non-idempotent requests twice (e.g. duplicate channel creates).
52
+ *
53
+ * Only enable this when re-sending a request to your proxy is safe, for example by attaching an idempotency
54
+ * key to each request that the proxy tracks in a store of your choosing (in memory, redis, ...) so a
55
+ * re-sent request is recognized and executed only once. Discordeno does not provide such a mechanism.
56
+ *
57
+ * Bounded by {@link RestManager.maxRetryCount} and {@link RestManager.maxProxyRetryCount}.
58
+ *
59
+ * @default false
60
+ */
61
+ retryRequests?: boolean;
43
62
  };
44
63
  /**
45
64
  * The api versions which can be used to make requests.
@@ -53,8 +72,30 @@ export interface CreateRestManagerOptions {
53
72
  logger?: Pick<typeof logger, 'debug' | 'info' | 'warn' | 'error' | 'fatal'>;
54
73
  /** Events for the rest manager */
55
74
  events?: Partial<RestManagerEvents>;
75
+ /**
76
+ * The maximum time in milliseconds a single request attempt may take before it is aborted.
77
+ *
78
+ * @remarks
79
+ * This is a total deadline for each attempt (it also covers reading the response body), not a per-chunk timeout.
80
+ * When talking to Discord directly, a timed-out attempt is retried through the queue up to
81
+ * {@link RestManager.maxRetryCount} times before failing. Without it, a connection that stalls after connecting
82
+ * could keep a queue from ever progressing.
83
+ *
84
+ * When a `proxy` is configured, a timed-out attempt is NOT retried: the proxy keeps processing the request after
85
+ * the timeout aborts our side of the connection (it may simply be queued behind a rate limit), so re-sending it
86
+ * could execute it twice. If re-sending against your proxy is safe, `proxy.retryRequests` opts back into it.
87
+ *
88
+ * Because it is a total deadline rather than a per-chunk one, a slow but healthy request (e.g. uploading a
89
+ * large attachment over a slow connection) can legitimately exceed it and be aborted/retried. Raise this value
90
+ * for upload-heavy bots if you see such requests timing out.
91
+ *
92
+ * Set to `0` to disable it and rely on the runtime's default fetch timeouts.
93
+ *
94
+ * @default 30000 // 30 seconds
95
+ */
96
+ requestTimeout?: number;
56
97
  }
57
- export interface RestManager {
98
+ export interface RestManager extends RestEndpoints {
58
99
  /** The bot token which will be used to make requests. */
59
100
  token: string;
60
101
  /** The application id. Normally this is not required for recent bots but old bot's application id is sometimes different from the bot id so it is required for those bots. */
@@ -79,8 +120,37 @@ export interface RestManager {
79
120
  authorizationHeader: string;
80
121
  /** The endpoint to use for `updateTokenQueues` when working with a rest proxy */
81
122
  updateBearerTokenEndpoint?: string;
123
+ /** Whether a proxied attempt that failed without producing a response is re-sent to the proxy. Only safe when re-sending against the proxy is. Defaults to false. */
124
+ retryProxiedRequests: boolean;
82
125
  /** The maximum amount of times a request should be retried. Defaults to Infinity */
83
126
  maxRetryCount: number;
127
+ /**
128
+ * The maximum amount of times a proxied request should be re-sent. Defaults to 15.
129
+ *
130
+ * @remarks
131
+ * This has its own limit because {@link RestManager.maxRetryCount} is Infinity by default, which would keep every request alive for as
132
+ * long as the proxy stays down.
133
+ *
134
+ * Each further attempt waits {@link RestManager.proxyRetryDelayStep} longer than the one before it, so the defaults span about 30 seconds
135
+ * in total, enough to sit out a proxy being restarted or redeployed.
136
+ *
137
+ * Whichever of the two is lower applies. Only used when {@link RestManager.retryProxiedRequests} is enabled.
138
+ */
139
+ maxProxyRetryCount: number;
140
+ /**
141
+ * How much longer to wait before each further re-send to a proxy, in milliseconds. Defaults to 250.
142
+ *
143
+ * @remarks
144
+ * The nth attempt waits n times this (250ms, then 500ms, then 750ms, ...), so a proxy that is down isn't hammered in a tight loop while
145
+ * still being checked often enough to notice it coming back.
146
+ *
147
+ * An attempt that timed out already sat out {@link RestManager.requestTimeout}, so it is re-sent right away without this delay.
148
+ *
149
+ * Only used when {@link RestManager.retryProxiedRequests} is enabled.
150
+ */
151
+ proxyRetryDelayStep: number;
152
+ /** The maximum time in milliseconds a single request attempt may take before it is aborted. Timed-out attempts are only retried when talking to Discord directly, or through a proxy when `retryProxiedRequests` is enabled. Defaults to 30000 (30 seconds). Set to 0 to disable. */
153
+ requestTimeout: number;
84
154
  /** Whether or not the manager is rate limited globally across all requests. Defaults to false. */
85
155
  globallyRateLimited: boolean;
86
156
  /** Whether or not the rate limited paths are being processed to allow requests to be made once time is up. Defaults to false. */
@@ -110,6 +180,8 @@ export interface RestManager {
110
180
  changeToDiscordFormat: (obj: any) => any;
111
181
  /** Creates the request body and headers that are necessary to send a request. Will handle different types of methods and everything necessary for discord. */
112
182
  createRequestBody: (method: RequestMethods, options?: CreateRequestBodyOptions) => RequestBody;
183
+ /** Fills in the message and the cause of the error that is given to the user when a request fails. The error itself is created by the caller because of how stack traces get calculated. */
184
+ createRequestError: (error: Error, reason: RestRequestRejection) => Error;
113
185
  /** This will create a infinite loop running in 1 seconds using tail recursion to keep rate limits clean. When a rate limit resets, this will remove it so the queue can proceed. */
114
186
  processRateLimitedPaths: () => void;
115
187
  /** Processes the rate limit headers and determines if it needs to be rate limited and returns the bucket id if available */
@@ -132,2884 +204,56 @@ export interface RestManager {
132
204
  delete: (url: string, options?: Omit<MakeRequestOptions, 'body'>) => Promise<void>;
133
205
  /** Make a patch request to the api. */
134
206
  patch: <T = void>(url: string, options?: MakeRequestOptions) => Promise<Camelize<T>>;
207
+ }
208
+ export type RequestMethods = 'GET' | 'POST' | 'DELETE' | 'PATCH' | 'PUT';
209
+ export type ApiVersions = 9 | 10;
210
+ export interface CreateRequestBodyOptions {
211
+ headers?: Record<string, string>;
212
+ body?: any;
213
+ unauthorized?: boolean;
214
+ reason?: string;
215
+ files?: FileContent[];
135
216
  /**
136
- * Adds a reaction to a message.
137
- *
138
- * @param channelId - The ID of the channel the message to add a reaction to is in.
139
- * @param messageId - The ID of the message to add a reaction to.
140
- * @param reaction - The reaction to add to the message.
141
- * @returns
142
- *
143
- * @remarks
144
- * Requires the `READ_MESSAGE_HISTORY` permission.
145
- *
146
- * If nobody else has reacted to the message:
147
- * - Requires the `ADD_REACTIONS` permission.
148
- *
149
- * Fires a _Message Reaction Add_ gateway event.
150
- *
151
- * @see {@link https://discord.com/developers/docs/resources/channel#create-reaction}
152
- */
153
- addReaction: (channelId: BigString, messageId: BigString, reaction: string) => Promise<void>;
154
- /**
155
- * Adds multiple a reaction to a message.
156
- *
157
- * This function uses the `addReaction()` helper behind the scenes.
158
- *
159
- * @param channelId - The ID of the channel the message to add reactions to is in.
160
- * @param messageId - The ID of the message to add the reactions to.
161
- * @param reactions - The reactions to add to the message.
162
- * @param ordered - Whether the reactions must be added in order or not.
163
- *
164
- * @remarks
165
- * Requires the `READ_MESSAGE_HISTORY` permission.
166
- *
167
- * If nobody else has reacted to the message:
168
- * - Requires the `ADD_REACTIONS` permission.
169
- *
170
- * Fires a _Message Reaction Add_ gateway event for every reaction added.
171
- */
172
- addReactions: (channelId: BigString, messageId: BigString, reactions: string[], ordered?: boolean) => Promise<void>;
173
- /**
174
- * Adds a role to a member.
175
- *
176
- * @param guildId - The ID of the guild the member to add the role to is in.
177
- * @param userId - The user ID of the member to add the role to.
178
- * @param roleId - The ID of the role to add to the member.
179
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
180
- *
181
- * @remarks
182
- * Requires the `MANAGE_ROLES` permission.
183
- *
184
- * Fires a _Guild Member Update_ gateway event.
185
- *
186
- * @see {@link https://discord.com/developers/docs/resources/guild#add-guild-member-role}
187
- */
188
- addRole: (guildId: BigString, userId: BigString, roleId: BigString, reason?: string) => Promise<void>;
189
- /**
190
- * Adds a member to a thread.
191
- *
192
- * @param channelId - The ID of the thread to add the member to.
193
- * @param userId - The user ID of the member to add to the thread.
194
- *
195
- * @remarks
196
- * Requires the ability to send messages in the thread.
197
- * Requires the thread not be archived.
198
- *
199
- * Fires a _Thread Members Update_ gateway event.
200
- *
201
- * @see {@link https://discord.com/developers/docs/resources/channel#add-thread-member}
202
- */
203
- addThreadMember: (channelId: BigString, userId: BigString) => Promise<void>;
204
- /**
205
- * Adds a recipient to a group DM.
206
- *
207
- * @param channelId - The ID of the group dm to add the user to.
208
- * @param userId - The user ID of the user to add to the group dm.
209
- * @param options - The options for adding the user
210
- *
211
- * @remarks
212
- * Requires an OAuth2 access token with the `gdm.join` scope
213
- *
214
- * @see {@link https://discord.com/developers/docs/resources/channel#group-dm-add-recipient}
215
- */
216
- addDmRecipient: (channelId: BigString, userId: BigString, options: AddDmRecipientOptions) => Promise<void>;
217
- /**
218
- * Adds a member to a guild.
219
- *
220
- * @param guildId - The ID of the thread to add the member to.
221
- * @param userId - The user ID of the member to add to the thread.
222
- * @param options - The options for the add of a guild member
223
- *
224
- * @remarks
225
- * Requires the bot to be in the specified server
226
- * Requires an OAuth2 access token with the `guilds.join` scope
227
- *
228
- * Fires a _Guild Member Add_ gateway event.
229
- *
230
- * @see {@link https://discord.com/developers/docs/resources/guild#add-guild-member}
231
- */
232
- addGuildMember: (guildId: BigString, userId: BigString, options: AddGuildMemberOptions) => Promise<void>;
233
- /**
234
- * Creates an automod rule in a guild.
235
- *
236
- * @param guildId - The ID of the guild to create the rule in.
237
- * @param options - The parameters for the creation of the rule.
238
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
239
- * @returns An instance of the created {@link DiscordAutoModerationRule}.
240
- *
241
- * @remarks
242
- * Requires the `MANAGE_GUILD` permission.
243
- *
244
- * Fires an _Auto Moderation Rule Create_ gateway event.
245
- *
246
- * @see {@link https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule}
247
- */
248
- createAutomodRule: (guildId: BigString, options: CreateAutoModerationRuleOptions, reason?: string) => Promise<Camelize<DiscordAutoModerationRule>>;
249
- /**
250
- * Creates a channel within a guild.
251
- *
252
- * @param guildId - The ID of the guild to create the channel within.
253
- * @param options - The parameters for the creation of the channel.
254
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
255
- * @returns An instance of the created {@link DiscordChannel}.
256
- *
257
- * @remarks
258
- * Requires the `MANAGE_CHANNELS` permission.
259
- *
260
- * If setting permission overwrites, only the permissions the bot user has in the guild can be allowed or denied.
261
- *
262
- * Setting the `MANAGE_ROLES` permission is only possible for guild administrators.
263
- *
264
- * Fires a _Channel Create_ gateway event.
265
- *
266
- * @see {@link https://discord.com/developers/docs/resources/guild#create-guild-channel}
267
- */
268
- createChannel: (guildId: BigString, options: CreateGuildChannel, reason?: string) => Promise<Camelize<DiscordChannel>>;
269
- /**
270
- * Creates an emoji in a guild.
271
- *
272
- * @param guildId - The ID of the guild in which to create the emoji.
273
- * @param options - The parameters for the creation of the emoji.
274
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
275
- * @returns An instance of the created {@link DiscordEmoji}.
276
- *
277
- * @remarks
278
- * Requires the `CREATE_GUILD_EXPRESSIONS` permission.
279
- *
280
- * Emojis have a maximum file size of 256 kilobits. Attempting to upload a larger emoji will cause the route to return 400 Bad Request.
281
- *
282
- * Fires a _Guild Emojis Update_ gateway event.
283
- *
284
- * @see {@link https://discord.com/developers/docs/resources/emoji#create-guild-emoji}
285
- */
286
- createEmoji: (guildId: BigString, options: CreateGuildEmoji, reason?: string) => Promise<Camelize<DiscordEmoji>>;
287
- /**
288
- * Creates an emoji for the application.
289
- *
290
- * @param options - The parameters for the creation of the emoji.
291
- * @returns An instance of the created {@link DiscordEmoji}.
292
- *
293
- * @see {@link https://discord.com/developers/docs/resources/emoji#create-application-emoji}
294
- */
295
- createApplicationEmoji: (options: CreateApplicationEmoji) => Promise<Camelize<DiscordEmoji>>;
296
- /**
297
- * Creates a new thread in a forum channel or media channel, and sends a message within the created thread.
298
- *
299
- * @param channelId - The ID of the forum channel to create the thread within.
300
- * @param options - The parameters for the creation of the thread.
301
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
302
- * @returns An instance of {@link DiscordChannel} with a nested {@link DiscordChannel} object.
303
- *
304
- * @remarks
305
- * Requires the `CREATE_MESSAGES` permission.
306
- *
307
- * Fires a _Thread Create_ gateway event.
308
- * Fires a _Message Create_ gateway event.
309
- *
310
- * @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel}
311
- */
312
- createForumThread: (channelId: BigString, options: CreateForumPostWithMessage, reason?: string) => Promise<Camelize<DiscordChannel>>;
313
- /**
314
- * Creates an application command accessible globally; across different guilds and channels.
315
- *
316
- * @param command - The command to create.
317
- * @param options - Additional options for the endpoint
318
- * @returns An instance of the created {@link DiscordApplicationCommand}.
319
- *
320
- * @remarks
321
- * ⚠️ Creating a command with the same name as an existing command for your application will overwrite the old command.
322
- * ⚠️ Global commands once created are cached for periods of __an hour__, so changes made to existing commands will take an hour to surface.
323
- * ⚠️ You can only create up to 200 _new_ commands daily.
324
- *
325
- * When using the bearer token the token needs the `applications.commands.update` scope and must be a `Client grant` token.
326
- * You will be able to update only your own application commands
327
- *
328
- * @see {@link https://discord.com/developers/docs/interactions/application-commands#create-global-application-command}
329
- */
330
- createGlobalApplicationCommand: (command: CreateApplicationCommand, options?: CreateGlobalApplicationCommandOptions) => Promise<Camelize<DiscordApplicationCommand>>;
331
- /**
332
- * Creates an application command only accessible in a specific guild.
333
- *
334
- * @param command - The command to create.
335
- * @param guildId - The ID of the guild to create the command for.
336
- * @param options - Additional options for the endpoint
337
- * @returns An instance of the created {@link DiscordApplicationCommand}.
338
- *
339
- * @remarks
340
- * ⚠️ Creating a command with the same name as an existing command for your application will overwrite the old command.
341
- * ⚠️ You can only create up to 200 _new_ commands daily.
342
- *
343
- * When using the bearer token the token needs the `applications.commands.update` scope and must be a `Client grant` token.
344
- * You will be able to update only your own application commands
345
- *
346
- * @see {@link https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command}
347
- */
348
- createGuildApplicationCommand: (command: CreateApplicationCommand, guildId: BigString, options?: CreateGuildApplicationCommandOptions) => Promise<Camelize<DiscordApplicationCommand>>;
349
- /**
350
- * Create a new sticker for the guild.
351
- *
352
- * @param guildId The ID of the guild to get
353
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
354
- * @return A {@link DiscordSticker}
355
- *
356
- * @remarks
357
- * Requires the `CREATE_GUILD_EXPRESSIONS` permission.
358
- * Fires a Guild Stickers Update Gateway event.
359
- * Every guilds has five free sticker slots by default, and each Boost level will grant access to more slots.
360
- * Lottie stickers can only be uploaded on guilds that have either the `VERIFIED` and/or the `PARTNERED` guild feature.
361
- *
362
- * @see {@link https://discord.com/developers/docs/resources/sticker#create-guild-sticker}
363
- */
364
- createGuildSticker: (guildId: BigString, options: CreateGuildStickerOptions, reason?: string) => Promise<Camelize<DiscordSticker>>;
365
- /**
366
- * Creates a template from a guild.
367
- *
368
- * @param guildId - The ID of the guild to create the template from.
369
- * @param options - The parameters for the creation of the template.
370
- * @returns An instance of the created {@link DiscordTemplate}.
371
- *
372
- * @remarks
373
- * Requires the `MANAGE_GUILD` permission.
374
- *
375
- * Fires a _Guild Update_ gateway event.
376
- *
377
- * @see {@link https://discord.com/developers/docs/resources/guild-template#create-guild-template}
378
- */
379
- createGuildTemplate: (guildId: BigString, options: CreateTemplate) => Promise<Camelize<DiscordTemplate>>;
380
- /**
381
- * Creates an invite to a channel in a guild.
382
- *
383
- * @param channelId - The ID of the channel to create the invite to.
384
- * @param options - The parameters for the creation of the invite.
385
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
386
- * @returns An instance of the created {@link DiscordInvite}.
387
- *
388
- * @remarks
389
- * Requires the `CREATE_INSTANT_INVITE` permission.
390
- *
391
- * Fires an _Invite Create_ gateway event.
392
- *
393
- * @privateRemarks
394
- * The request body is not optional, and an empty JSON object must be sent regardless of whether any fields are being transmitted.
395
- *
396
- * @see {@link https://discord.com/developers/docs/resources/channel#create-channel-invite}
397
- */
398
- createInvite: (channelId: BigString, options?: CreateChannelInvite, reason?: string) => Promise<Camelize<DiscordInvite>>;
399
- /**
400
- * Creates a role in a guild.
401
- *
402
- * @param guildId - The ID of the guild to create the role in.
403
- * @param options - The parameters for the creation of the role.
404
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
405
- * @returns An instance of the created {@link DiscordRole}.
406
- *
407
- * @remarks
408
- * Requires the `MANAGE_ROLES` permission.
409
- *
410
- * Fires a _Guild Role Create_ gateway event.
411
- *
412
- * @see {@link https://discord.com/developers/docs/resources/guild#create-guild-role}
413
- */
414
- createRole: (guildId: BigString, options: CreateGuildRole, reason?: string) => Promise<Camelize<DiscordRole>>;
415
- /**
416
- * Creates a scheduled event in a guild.
417
- *
418
- * @param guildId - The ID of the guild to create the scheduled event in.
419
- * @param options - The parameters for the creation of the scheduled event.
420
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
421
- * @returns An instance of the created {@link DiscordScheduledEvent}.
422
- *
423
- * @remarks
424
- * Requires the `MANAGE_EVENTS` permission.
425
- *
426
- * A guild can only have a maximum of 100 events with a status of {@link ScheduledEventStatus}.Active or {@link ScheduledEventStatus}.Scheduled (inclusive).
427
- *
428
- * Fires a _Guild Scheduled Event Create_ gateway event.
429
- *
430
- * @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event}
431
- */
432
- createScheduledEvent: (guildId: BigString, options: CreateScheduledEvent, reason?: string) => Promise<Camelize<DiscordScheduledEvent>>;
433
- /**
434
- * Creates a stage instance associated with a stage channel.
435
- *
436
- * @param options - The parameters for the creation of the stage instance.
437
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
438
- * @returns An instance of the created {@link DiscordStageInstance}.
439
- *
440
- * @remarks
441
- * Requires the user to be a moderator of the stage channel.
442
- *
443
- * Fires a _Stage Instance Create_ gateway event.
444
- *
445
- * @see {@link https://discord.com/developers/docs/resources/stage-instance#create-stage-instance}
446
- */
447
- createStageInstance: (options: CreateStageInstance, reason?: string) => Promise<Camelize<DiscordStageInstance>>;
448
- /**
449
- * Creates a webhook.
450
- *
451
- * @param channelId - The ID of the channel to create the webhook in.
452
- * @param options - The parameters for the creation of the webhook.
453
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
454
- * @returns An instance of the created {@link DiscordWebhook}.
455
- *
456
- * @remarks
457
- * Requires the `MANAGE_WEBHOOKS` permission.
458
- *
459
- * ⚠️ The webhook name must not contain the substrings 'clyde', or 'discord' (case-insensitive).
460
- *
461
- * Fires a _Webhooks Update_ gateway event.
462
- *
463
- * @see {@link https://discord.com/developers/docs/resources/webhook#create-webhook}
464
- */
465
- createWebhook: (channelId: BigString, options: CreateWebhook, reason?: string) => Promise<Camelize<DiscordWebhook>>;
466
- /**
467
- * Deletes an automod rule.
468
- *
469
- * @param guildId - The ID of the guild to delete the rule from.
470
- * @param ruleId - The ID of the automod rule to delete.
471
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
472
- *
473
- * @remarks
474
- * Requires the `MANAGE_GUILD` permission.
475
- *
476
- * Fires an _Auto Moderation Rule Delete_ gateway event.
477
- *
478
- * @see {@link https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule}
479
- */
480
- deleteAutomodRule: (guildId: BigString, ruleId: BigString, reason?: string) => Promise<void>;
481
- /**
482
- * Deletes a channel from within a guild.
483
- *
484
- * @param channelId - The ID of the channel to delete.
485
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
486
- * @returns nothing
487
- *
488
- * @remarks
489
- * For community guilds, the _Rules_, _Guidelines_ and _Community Update_ channels cannot be deleted.
490
- *
491
- * If the channel is a thread:
492
- * - Requires the `MANAGE_THREADS` permission.
493
- *
494
- * - Fires a _Thread Delete_ gateway event.
495
- *
496
- * Otherwise:
497
- * - Requires the `MANAGE_CHANNELS` permission.
498
- *
499
- * - ⚠️ Deleting a category channel does not delete its child channels.
500
- * Instead, they will have their `parent_id` property removed, and a `Channel Update` gateway event will fire for each of them.
501
- *
502
- * - Fires a _Channel Delete_ gateway event.
503
- *
504
- * @see {@link https://discord.com/developers/docs/resources/channel#deleteclose-channel}
505
- */
506
- deleteChannel: (channelId: BigString, reason?: string) => Promise<void>;
507
- /**
508
- * Deletes a permission override for a user or role in a channel.
509
- *
510
- * @param channelId - The ID of the channel to delete the permission override of.
511
- * @param overwriteId - The ID of the permission override to delete.
512
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
513
- *
514
- * @remarks
515
- * Requires the `MANAGE_ROLES` permission.
516
- *
517
- * Fires a _Channel Update_ gateway event.
518
- *
519
- * @see {@link https://discord.com/developers/docs/resources/channel#delete-channel-permission}
520
- */
521
- deleteChannelPermissionOverride: (channelId: BigString, overwriteId: BigString, reason?: string) => Promise<void>;
522
- /**
523
- * Deletes an emoji from a guild.
524
- *
525
- * @param guildId - The ID of the guild from which to delete the emoji.
526
- * @param id - The ID of the emoji to delete.
527
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
528
- *
529
- * @remarks
530
- * For emojis created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
531
- * For other emojis, requires the `MANAGE_GUILD_EXPRESSIONS` permission.
532
- *
533
- * Fires a _Guild Emojis Update_ gateway event.
534
- *
535
- * @see {@link https://discord.com/developers/docs/resources/emoji#delete-guild-emoji}
536
- */
537
- deleteEmoji: (guildId: BigString, id: BigString, reason?: string) => Promise<void>;
538
- /**
539
- * Deletes an emoji from the application.
540
- *
541
- * @param id - The ID of the emoji to delete.
542
- *
543
- * @see {@link https://discord.com/developers/docs/resources/emoji#delete-application-emoji}
544
- */
545
- deleteApplicationEmoji: (id: BigString) => Promise<void>;
546
- /**
547
- * Deletes a follow-up message to an interaction.
548
- *
549
- * @param token - The interaction token to use, provided in the original interaction.
550
- * @param messageId - The ID of the message to delete.
217
+ * An `AbortSignal` to cancel the request.
551
218
  *
552
219
  * @remarks
553
- * Unlike `deleteMessage()`, this endpoint allows the bot user to act without needing to see the channel the message is in.
554
- *
555
- * Fires a _Message Delete_ event.
556
- *
557
- * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#delete-followup-message}
558
- */
559
- deleteFollowupMessage: (token: string, messageId: BigString) => Promise<void>;
560
- /**
561
- * Deletes an application command registered globally.
562
- *
563
- * @param commandId - The ID of the command to delete.
564
- *
565
- * @see {@link https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command}
566
- */
567
- deleteGlobalApplicationCommand: (commandId: BigString) => Promise<void>;
568
- /**
569
- * Deletes an application command registered in a guild.
570
- *
571
- * @param guildId - The ID of the guild to delete the command from.
572
- * @param commandId - The ID of the command to delete from the guild.
573
- *
574
- * @see {@link https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command}
220
+ * Aborting rejects a request that is still waiting in the queue right away and guarantees it is never sent.
221
+ * An attempt that is already in flight gets its connection cancelled as well, though that cannot recall it:
222
+ * Discord (or the proxy) may have received it and may still process it, only the response is discarded.
223
+ * This lets a rest proxy drop requests that nobody is waiting on anymore (client disconnect, deadline)
224
+ * instead of leaving them in the queue.
575
225
  */
576
- deleteGuildApplicationCommand: (commandId: BigString, guildId: BigString) => Promise<void>;
226
+ signal?: AbortSignal;
227
+ }
228
+ export type MakeRequestOptions = Omit<CreateRequestBodyOptions, 'method'> & Pick<SendRequestOptions, 'runThroughQueue'>;
229
+ export interface RequestBody {
230
+ headers: Record<string, string>;
231
+ body?: string | FormData;
232
+ method: RequestMethods;
233
+ }
234
+ export interface SendRequestOptions {
235
+ /** The route to send the request to. */
236
+ route: string;
237
+ /** The method to use for sending the request. */
238
+ method: RequestMethods;
239
+ /** The amount of times this request has been retried. */
240
+ retryCount: number;
241
+ /** Handler to retry a request should it be rate limited. */
242
+ retryRequest?: (options: SendRequestOptions) => Promise<void>;
243
+ /** Resolve handler when a request succeeds. */
244
+ resolve: (value: RestRequestResponse) => void;
245
+ /** Reject handler when a request fails. */
246
+ reject: (value: RestRequestRejection) => void;
247
+ /** If this request has a bucket id which it falls under for rate limit */
248
+ bucketId?: string;
577
249
  /**
578
- * Delete a new sticker for the guild.
579
- *
580
- * @param guildId The ID of the guild to get
581
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
582
- * @return A {@link DiscordSticker}
250
+ * The simplified url of this request, as `rest.simplifyUrl` returned it when the request was first handled.
583
251
  *
584
252
  * @remarks
585
- * For stickers created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
586
- * For other stickers, requires the `MANAGE_GUILD_EXPRESSIONS` permission.
587
- * Fires a Guild Stickers Update Gateway event.
588
- * Every guilds has five free sticker slots by default, and each Boost level will grant access to more slots.
589
- * Lottie stickers can only be uploaded on guilds that have either the `VERIFIED` and/or the `PARTNERED` guild feature.
590
- *
591
- * @see {@link https://discord.com/developers/docs/resources/sticker#delete-guild-sticker}
253
+ * The simplified url of a message delete depends on how old the message is, so it has to be kept instead of being worked out again later,
254
+ * or the key the queue was found under and the key its response is credited to stop matching once the message crosses one of those ages.
592
255
  */
593
- deleteGuildSticker: (guildId: BigString, stickerId: BigString, reason?: string) => Promise<void>;
594
- /**
595
- * Deletes a template from a guild.
596
- *
597
- * @param guildId - The ID of the guild to delete the template from.
598
- * @param templateCode - The code of the template to delete.
599
- *
600
- * @remarks
601
- * Requires the `MANAGE_GUILD` permission.
602
- *
603
- * Fires a _Guild Update_ gateway event.
604
- *
605
- * @see {@link https://discord.com/developers/docs/resources/guild-template#delete-guild-template}
606
- */
607
- deleteGuildTemplate: (guildId: BigString, templateCode: string) => Promise<void>;
608
- /**
609
- * Deletes an integration attached to a guild.
610
- *
611
- * @param guildId - The ID of the guild from which to delete the integration.
612
- * @param integrationId - The ID of the integration to delete from the guild.
613
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
614
- *
615
- * @remarks
616
- * Requires the `MANAGE_GUILD` permission.
617
- *
618
- * Deletes all webhooks associated with the integration, and kicks the associated bot if there is one.
619
- *
620
- * Fires a _Guild Integrations Update_ gateway event.
621
- * Fires a _Integration Delete_ gateway event.
622
- *
623
- * @see {@link https://discord.com/developers/docs/resources/guild#delete-guild-integration}
624
- */
625
- deleteIntegration: (guildId: BigString, integrationId: BigString, reason?: string) => Promise<void>;
626
- /**
627
- * Deletes an invite to a channel.
628
- *
629
- * @param inviteCode - The invite code of the invite to delete.
630
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
631
- *
632
- * @remarks
633
- * Requires the `MANAGE_CHANNELS` permission.
634
- *
635
- * Fires an _Invite Delete_ gateway event.
636
- *
637
- * @see {@link https://discord.com/developers/docs/resources/channel#delete-channel-invite}
638
- */
639
- deleteInvite: (inviteCode: string, reason?: string) => Promise<void>;
640
- /**
641
- * Deletes a message from a channel.
642
- *
643
- * @param channelId - The ID of the channel to delete the message from.
644
- * @param messageId - The ID of the message to delete from the channel.
645
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
646
- *
647
- * @remarks
648
- * If not deleting own message:
649
- * - Requires the `MANAGE_MESSAGES` permission.
650
- *
651
- * Fires a _Message Delete_ gateway event.
652
- *
653
- * @see {@link https://discord.com/developers/docs/resources/channel#delete-message}
654
- */
655
- deleteMessage: (channelId: BigString, messageId: BigString, reason?: string) => Promise<void>;
656
- /**
657
- * Deletes multiple messages from a channel.
658
- *
659
- * @param channelId - The ID of the channel to delete the messages from.
660
- * @param messageIds - The IDs of the messages to delete from the channel.
661
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
662
- *
663
- * @remarks
664
- * Requires the `MANAGE_MESSAGES` permission.
665
- *
666
- * ⚠️ Messages older than 2 weeks old cannot be deleted.
667
- *
668
- * Fires a _Message Delete Bulk_ gateway event.
669
- *
670
- * @see {@link https://discord.com/developers/docs/resources/channel#bulk-delete-messages}
671
- */
672
- deleteMessages: (channelId: BigString, messageIds: BigString[], reason?: string) => Promise<void>;
673
- /**
674
- * Deletes the initial message response to an interaction.
675
- *
676
- * @param token - The interaction token to use, provided in the original interaction.
677
- *
678
- * @remarks
679
- * Unlike `deleteMessage()`, this endpoint allows the bot user to act without needing to see the channel the message is in.
680
- *
681
- * Fires a _Message Delete_ event.
682
- *
683
- * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response}
684
- */
685
- deleteOriginalInteractionResponse: (token: string) => Promise<void>;
686
- /**
687
- * Deletes a reaction added by the bot user from a message.
688
- *
689
- * @param channelId - The ID of the channel the message to delete the reaction from is in.
690
- * @param messageId - The ID of the message to delete the reaction from.
691
- * @param reaction - The reaction to delete from the message.
692
- *
693
- * @remarks
694
- * Requires the `READ_MESSAGE_HISTORY` permission.
695
- *
696
- * Fires a _Message Reaction Remove_ gateway event.
697
- *
698
- * @see {@link https://discord.com/developers/docs/resources/channel#delete-own-reaction}
699
- */
700
- deleteOwnReaction: (channelId: BigString, messageId: BigString, reaction: string) => Promise<void>;
701
- /**
702
- * Deletes all reactions for all emojis from a message.
703
- *
704
- * @param channelId - The ID of the channel the message to delete the reactions from is in.
705
- * @param messageId - The ID of the message to delete the reactions from.
706
- *
707
- * @remarks
708
- * Requires the `READ_MESSAGE_HISTORY` permission.
709
- *
710
- * Requires the `MANAGE_MESSAGES` permission.
711
- *
712
- * Fires a _Message Reaction Remove All_ gateway event.
713
- *
714
- * @see {@link https://discord.com/developers/docs/resources/channel#delete-all-reactions}
715
- */
716
- deleteReactionsAll: (channelId: BigString, messageId: BigString) => Promise<void>;
717
- /**
718
- * Deletes all reactions for an emoji from a message.
719
- *
720
- * @param channelId - The ID of the channel the message to delete the reactions from is in.
721
- * @param messageId - The ID of the message to delete the reactions from.
722
- * @param reaction - The reaction to remove from the message.
723
- *
724
- * @remarks
725
- * Requires the `READ_MESSAGE_HISTORY` permission.
726
- *
727
- * Requires the `MANAGE_MESSAGES` permission.
728
- *
729
- * Fires a _Message Reaction Remove Emoji_ gateway event.
730
- *
731
- * @see {@link https://discord.com/developers/docs/resources/channel#delete-all-reactions-for-emoji}
732
- */
733
- deleteReactionsEmoji: (channelId: BigString, messageId: BigString, reaction: string) => Promise<void>;
734
- /**
735
- * Deletes a role from a guild.
736
- *
737
- * @param guildId - The ID of the guild to delete the role from.
738
- * @param roleId - The ID of the role to delete.
739
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
740
- *
741
- * @remarks
742
- * Requires the `MANAGE_ROLES` permission.
743
- *
744
- * Fires a _Guild Role Delete_ gateway event.
745
- *
746
- * @see {@link https://discord.com/developers/docs/resources/guild#delete-guild-role}
747
- */
748
- deleteRole: (guildId: BigString, roleId: BigString, reason?: string) => Promise<void>;
749
- /**
750
- * Deletes a scheduled event from a guild.
751
- *
752
- * @param guildId - The ID of the guild to delete the scheduled event from.
753
- * @param eventId - The ID of the scheduled event to delete.
754
- *
755
- * @remarks
756
- * Requires the `MANAGE_EVENTS` permission.
757
- *
758
- * Fires a _Guild Scheduled Event Delete_ gateway event.
759
- *
760
- * @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event}
761
- */
762
- deleteScheduledEvent: (guildId: BigString, eventId: BigString) => Promise<void>;
763
- /**
764
- * Deletes the stage instance associated with a stage channel, if one exists.
765
- *
766
- * @param channelId - The ID of the stage channel the stage instance is associated with.
767
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
768
- *
769
- * @remarks
770
- * Requires the user to be a moderator of the stage channel.
771
- *
772
- * Fires a _Stage Instance Delete_ gateway event.
773
- *
774
- * @see {@link https://discord.com/developers/docs/resources/stage-instance#delete-stage-instance}
775
- */
776
- deleteStageInstance: (channelId: BigString, reason?: string) => Promise<void>;
777
- /**
778
- * Deletes a user's reaction from a message.
779
- *
780
- * @param channelId - The ID of the channel the message to delete the reaction from is in.
781
- * @param messageId - The ID of the message to delete the reaction from.
782
- * @param userId - The ID of the user whose reaction to delete.
783
- * @param reaction - The reaction to delete from the message.
784
- *
785
- * @remarks
786
- * Requires the `READ_MESSAGE_HISTORY` permission.
787
- *
788
- * Requires the `MANAGE_MESSAGES` permission.
789
- *
790
- * Fires a _Message Reaction Remove_ gateway event.
791
- *
792
- * @see {@link https://discord.com/developers/docs/resources/channel#delete-user-reaction}
793
- */
794
- deleteUserReaction: (channelId: BigString, messageId: BigString, userId: BigString, reaction: string) => Promise<void>;
795
- /**
796
- * Deletes a webhook.
797
- *
798
- * @param webhookId - The ID of the webhook to delete.
799
- *
800
- * @remarks
801
- * Requires the `MANAGE_WEBHOOKS` permission.
802
- *
803
- * Fires a _Webhooks Update_ gateway event.
804
- *
805
- * @see {@link https://discord.com/developers/docs/resources/webhook#delete-webhook}
806
- */
807
- deleteWebhook: (webhookId: BigString, reason?: string) => Promise<void>;
808
- /**
809
- * Deletes a webhook message.
810
- *
811
- * @param webhookId - The ID of the webhook to delete the message belonging to.
812
- * @param token - The webhook token, used to manage the webhook.
813
- * @param messageId - The ID of the message to delete.
814
- * @param options - The parameters for the deletion of the message.
815
- *
816
- * @remarks
817
- * Fires a _Message Delete_ gateway event.
818
- *
819
- * @see {@link https://discord.com/developers/docs/resources/webhook#delete-webhook}
820
- */
821
- deleteWebhookMessage: (webhookId: BigString, token: string, messageId: BigString, options?: DeleteWebhookMessageOptions) => Promise<void>;
822
- /**
823
- * Deletes a webhook message using the webhook token, thereby bypassing the need for authentication + permissions.
824
- *
825
- * @param webhookId - The ID of the webhook to delete the message belonging to.
826
- * @param token - The webhook token, used to delete the webhook.
827
- *
828
- * @remarks
829
- * Fires a _Message Delete_ gateway event.
830
- *
831
- * @see {@link https://discord.com/developers/docs/resources/webhook#delete-webhook-with-token}
832
- */
833
- deleteWebhookWithToken: (webhookId: BigString, token: string) => Promise<void>;
834
- /**
835
- * Edits the permissions for a guild application command.
836
- *
837
- * @param guildId - The ID of the guild the command is registered in.
838
- * @param commandId - The ID of the command to edit the permissions of.
839
- * @param bearerToken - The bearer token to use to make the request.
840
- * @param options - The parameters for the edit of the command permissions.
841
- * @returns An instance of the edited {@link DiscordGuildApplicationCommandPermissions}.
842
- *
843
- * @remarks
844
- * 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.
845
- *
846
- * @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions}
847
- */
848
- editApplicationCommandPermissions: (guildId: BigString, commandId: BigString, bearerToken: string, options: Camelize<DiscordApplicationCommandPermissions>[]) => Promise<Camelize<DiscordGuildApplicationCommandPermissions>>;
849
- /**
850
- * Edits an automod rule.
851
- *
852
- * @param guildId - The ID of the guild to edit the rule in.
853
- * @param ruleId - The ID of the rule to edit.
854
- * @param options - The parameters for the edit of the rule.
855
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
856
- * @returns An instance of the edited {@link DiscordAutoModerationRule}.
857
- *
858
- * @remarks
859
- * Requires the `MANAGE_GUILD` permission.
860
- *
861
- * Fires an _Auto Moderation Rule Update_ gateway event.
862
- *
863
- * @see {@link https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule}
864
- */
865
- editAutomodRule: (guildId: BigString, ruleId: BigString, options: Partial<EditAutoModerationRuleOptions>, reason?: string) => Promise<Camelize<DiscordAutoModerationRule>>;
866
- /**
867
- * Modifies the bot's username, avatar or banner.
868
- * NOTE: username: if changed may cause the bot's discriminator to be randomized.
869
- */
870
- editBotProfile: (options: {
871
- username?: string;
872
- botAvatarURL?: string | null;
873
- botBannerURL?: string | null;
874
- }) => Promise<Camelize<DiscordUser>>;
875
- /**
876
- * Edits a channel's settings.
877
- *
878
- * @param channelId - The ID of the channel to edit.
879
- * @param options - The parameters for the edit of the channel.
880
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
881
- * @returns An instance of the edited {@link DiscordChannel}.
882
- *
883
- * @remarks
884
- * If editing a channel of type {@link ChannelTypes}.GroupDm:
885
- * - Fires a _Channel Update_ gateway event.
886
- *
887
- * If editing a thread channel:
888
- * - Requires the `MANAGE_THREADS` permission __unless__ if setting the `archived` property to `false` when the `locked` property is also `false`, in which case only the `SEND_MESSAGES` permission is required.
889
- *
890
- * - Fires a _Thread Update_ gateway event.
891
- *
892
- * If editing a guild channel:
893
- * - Requires the `MANAGE_CHANNELS` permission.
894
- *
895
- * - If modifying permission overrides:
896
- * - Requires the `MANAGE_ROLES` permission.
897
- *
898
- * - 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.
899
- *
900
- * - If modifying a channel of type {@link ChannelTypes}.GuildCategory:
901
- * - Fires a _Channel Update_ gateway event for each child channel impacted in this change.
902
- * - Otherwise:
903
- * - Fires a _Channel Update_ gateway event.
904
- */
905
- editChannel: (channelId: BigString, options: ModifyChannel, reason?: string) => Promise<Camelize<DiscordChannel>>;
906
- /**
907
- * Edits the permission overrides for a user or role in a channel.
908
- *
909
- * @param channelId - The ID of the channel to edit the permission overrides of.
910
- * @param options - The permission override.
911
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
912
- *
913
- * @remarks
914
- * Requires the `MANAGE_ROLES` permission.
915
- *
916
- * 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.
917
- *
918
- * Fires a _Channel Update_ gateway event.
919
- *
920
- * @see {@link https://discord.com/developers/docs/resources/channel#edit-channel-permissions}
921
- */
922
- editChannelPermissionOverrides: (channelId: BigString, options: EditChannelPermissionOverridesOptions, reason?: string) => Promise<void>;
923
- /**
924
- * Edits the positions of a set of channels in a guild.
925
- *
926
- * @param guildId - The ID of the guild in which to edit the positions of the channels.
927
- * @param channelPositions - A set of objects defining the updated positions of the channels.
928
- *
929
- * @remarks
930
- * Requires the `MANAGE_CHANNELS` permission.
931
- *
932
- * Fires a _Channel Update_ gateway event for every channel impacted in this change.
933
- *
934
- * @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions}
935
- */
936
- editChannelPositions: (guildId: BigString, channelPositions: ModifyGuildChannelPositions[]) => Promise<void>;
937
- /**
938
- * Edits an emoji.
939
- *
940
- * @param guildId - The ID of the guild in which to edit the emoji.
941
- * @param id - The ID of the emoji to edit.
942
- * @param options - The parameters for the edit of the emoji.
943
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
944
- * @returns An instance of the updated {@link DiscordEmoji}.
945
- *
946
- * @remarks
947
- * For emojis created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
948
- * For other emojis, requires the `MANAGE_GUILD_EXPRESSIONS` permission.
949
- *
950
- * Fires a `Guild Emojis Update` gateway event.
951
- *
952
- * @see {@link https://discord.com/developers/docs/resources/emoji#modify-guild-emoji}
953
- */
954
- editEmoji: (guildId: BigString, id: BigString, options: ModifyGuildEmoji, reason?: string) => Promise<Camelize<DiscordEmoji>>;
955
- /**
956
- * Edits an application emoji.
957
- *
958
- * @param id - The ID of the emoji to edit.
959
- * @param options - The parameters for the edit of the emoji.
960
- * @returns An instance of the updated {@link DiscordEmoji}.
961
- *
962
- * @see {@link https://discord.com/developers/docs/resources/emoji#modify-application-emoji}
963
- */
964
- editApplicationEmoji: (id: BigString, options: ModifyApplicationEmoji) => Promise<Camelize<DiscordEmoji>>;
965
- /**
966
- * Edits a follow-up message to an interaction.
967
- *
968
- * @param token - The interaction token to use, provided in the original interaction.
969
- * @param messageId - The ID of the message to edit.
970
- * @param options - The parameters for the edit of the message.
971
- * @returns An instance of the edited {@link DiscordMessage}.
972
- *
973
- * @remarks
974
- * Unlike `editMessage()`, this endpoint allows the bot user to act without needing to see the channel the message is in.
975
- *
976
- * Does not support ephemeral follow-up messages due to these being stateless.
977
- *
978
- * Fires a _Message Update_ event.
979
- *
980
- * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message}
981
- */
982
- editFollowupMessage: (token: string, messageId: BigString, options: InteractionCallbackData) => Promise<Camelize<DiscordMessage>>;
983
- /**
984
- * Edits a global application command.
985
- *
986
- * @param commandId - The ID of the command to edit.
987
- * @param options - The parameters for the edit of the command.
988
- * @returns An instance of the edited {@link DiscordApplicationCommand}.
989
- *
990
- * @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command}
991
- */
992
- editGlobalApplicationCommand: (commandId: BigString, options: CreateApplicationCommand) => Promise<Camelize<DiscordApplicationCommand>>;
993
- /**
994
- * Edits a guild's settings.
995
- *
996
- * @param guildId - The ID of the guild to edit.
997
- * @param options - The parameters for the edit of the guild.
998
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
999
- * @returns An instance of the edited {@link DiscordGuild}.
1000
- *
1001
- * @remarks
1002
- * Requires the `MANAGE_GUILD` permission.
1003
- *
1004
- * If attempting to add or remove the {@link GuildFeatures}.Community feature:
1005
- * - Requires the `ADMINISTRATOR` permission.
1006
- *
1007
- * Fires a _Guild Update_ gateway event.
1008
- *
1009
- * @see {@link https://discord.com/developers/docs/resources/guild#modify-guild}
1010
- */
1011
- editGuild: (guildId: BigString, options: ModifyGuild, reason?: string) => Promise<Camelize<DiscordGuild>>;
1012
- /**
1013
- * Edits an application command registered in a guild.
1014
- *
1015
- * @param guildId - The ID of the guild the command is registered in.
1016
- * @param commandId - The ID of the command to edit.
1017
- * @param options - The parameters for the edit of the command.
1018
- * @returns An instance of the edited {@link DiscordApplicationCommand}.
1019
- *
1020
- * @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command}
1021
- */
1022
- editGuildApplicationCommand: (commandId: BigString, guildId: BigString, options: CreateApplicationCommand) => Promise<Camelize<DiscordApplicationCommand>>;
1023
- /**
1024
- * Edit the given sticker.
1025
- *
1026
- * @param guildId The ID of the guild to get
1027
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
1028
- * @return A {@link DiscordSticker}
1029
- *
1030
- * @remarks
1031
- * For stickers created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
1032
- * For other stickers, requires the `MANAGE_GUILD_EXPRESSIONS` permission.
1033
- * Fires a Guild Stickers Update Gateway event.
1034
- *
1035
- * @see {@link https://discord.com/developers/docs/resources/sticker#modify-guild-sticker}
1036
- */
1037
- editGuildSticker: (guildId: BigString, stickerId: BigString, options: AtLeastOne<EditGuildStickerOptions>, reason?: string) => Promise<Camelize<DiscordSticker>>;
1038
- /**
1039
- * Edits a template's settings.
1040
- *
1041
- * @param guildId - The ID of the guild to edit a template of.
1042
- * @param templateCode - The code of the template to edit.
1043
- * @param options - The parameters for the edit of the template.
1044
- * @returns An instance of the edited {@link DiscordTemplate}.
1045
- *
1046
- * @remarks
1047
- * Requires the `MANAGE_GUILD` permission.
1048
- *
1049
- * Fires a _Guild Update_ gateway event.
1050
- *
1051
- * @see {@link https://discord.com/developers/docs/resources/guild-template#modify-guild-template}
1052
- */
1053
- editGuildTemplate: (guildId: BigString, templateCode: string, options: ModifyGuildTemplate) => Promise<Camelize<DiscordTemplate>>;
1054
- /**
1055
- * Edits a message.
1056
- *
1057
- * @param channelId - The ID of the channel to edit the message in.
1058
- * @param messageId - The IDs of the message to edit.
1059
- * @param options - The parameters for the edit of the message.
1060
- * @returns An instance of the edited {@link DiscordMessage}.
1061
- *
1062
- * @remarks
1063
- * If editing another user's message:
1064
- * - Requires the `MANAGE_MESSAGES` permission.
1065
- * - Only the {@link EditMessage.flags | flags} property of the options object parameter can be edited.
1066
- *
1067
- * Fires a _Message Update_ gateway event.
1068
- *
1069
- * @see {@link https://discord.com/developers/docs/resources/channel#edit-message}
1070
- */
1071
- editMessage: (channelId: BigString, messageId: BigString, options: EditMessage) => Promise<Camelize<DiscordMessage>>;
1072
- /**
1073
- * Edits the initial message response to an interaction.
1074
- *
1075
- * @param token - The interaction token to use, provided in the original interaction.
1076
- * @param options - The parameters for the edit of the response.
1077
- * @returns An instance of the edited {@link DiscordMessage}.
1078
- *
1079
- * @remarks
1080
- * Unlike `editMessage()`, this endpoint allows the bot user to act without needing to see the channel the message is in.
1081
- *
1082
- * Does not support ephemeral follow-up messages due to these being stateless.
1083
- *
1084
- * Fires a _Message Update_ event.
1085
- *
1086
- * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response}
1087
- */
1088
- editOriginalInteractionResponse: (token: string, options: InteractionCallbackData) => Promise<Camelize<DiscordMessage>>;
1089
- /**
1090
- * Edits the voice state of the bot user.
1091
- *
1092
- * @param guildId - The ID of the guild in which to edit the voice state of the bot user.
1093
- * @param options - The parameters for the edit of the voice state.
1094
- *
1095
- * @remarks
1096
- * The {@link EditOwnVoiceState.channelId | channelId} property of the options object parameter must point to a stage channel, and the bot user must already have joined it.
1097
- *
1098
- * If attempting to unmute oneself:
1099
- * - Requires the `MUTE_MEMBERS` permission.
1100
- *
1101
- * If attempting to request to speak:
1102
- * - Requires the `REQUEST_TO_SPEAK` permission.
1103
- *
1104
- * @see {@link https://discord.com/developers/docs/resources/voice#modify-current-user-voice-state}
1105
- */
1106
- editOwnVoiceState: (guildId: BigString, options: EditOwnVoiceState) => Promise<void>;
1107
- /**
1108
- * Edits a role in a guild.
1109
- *
1110
- * @param guildId - The ID of the guild to edit the role in.
1111
- * @param roleId - The ID of the role to edit.
1112
- * @param options - The parameters for the edit of the role.
1113
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
1114
- * @returns An instance of the edited {@link DiscordRole}.
1115
- *
1116
- * @remarks
1117
- * Requires the `MANAGE_ROLES` permission.
1118
- *
1119
- * Fires a _Guild Role Update_ gateway event.
1120
- *
1121
- * @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-role}
1122
- */
1123
- editRole: (guildId: BigString, roleId: BigString, options: EditGuildRole, reason?: string) => Promise<Camelize<DiscordRole>>;
1124
- /**
1125
- * Edits the positions of a set of roles.
1126
- *
1127
- * @param guildId - The ID of the guild to edit the role positions in.
1128
- * @param options - The parameters for the edit of the role positions.
1129
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
1130
- * @returns A collection of {@link DiscordRole} objects assorted by role ID.
1131
- *
1132
- * @remarks
1133
- * Requires the `MANAGE_ROLES` permission.
1134
- *
1135
- * Fires a _Guild Role Update_ gateway event for every role impacted in this change.
1136
- *
1137
- * @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-role-positions}
1138
- */
1139
- editRolePositions: (guildId: BigString, options: ModifyRolePositions[], reason?: string) => Promise<Camelize<DiscordRole>[]>;
1140
- /**
1141
- * Edits a scheduled event.
1142
- *
1143
- * @param guildId - The ID of the guild to edit the scheduled event in.
1144
- * @param eventId - The ID of the scheduled event to edit.
1145
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
1146
- * @returns An instance of the edited {@link DiscordScheduledEvent}.
1147
- *
1148
- * @remarks
1149
- * Requires the `MANAGE_EVENTS` permission.
1150
- *
1151
- * To start or end an event, modify the event's `status` property.
1152
- *
1153
- * The `entity_metadata` property is discarded for events whose `entity_type` is not {@link ScheduledEventEntityType}.External.
1154
- *
1155
- * Fires a _Guild Scheduled Event Update_ gateway event.
1156
- *
1157
- * @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event}
1158
- */
1159
- editScheduledEvent: (guildId: BigString, eventId: BigString, options: Partial<EditScheduledEvent>, reason?: string) => Promise<Camelize<DiscordScheduledEvent>>;
1160
- /**
1161
- * Edits a stage instance.
1162
- *
1163
- * @param channelId - The ID of the stage channel the stage instance is associated with.
1164
- * @param topic - Topic of the Stage instance (1-120 characters).
1165
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
1166
- * @returns An instance of the updated {@link DiscordStageInstance}.
1167
- *
1168
- * @remarks
1169
- * Requires the user to be a moderator of the stage channel.
1170
- *
1171
- * Fires a _Stage Instance Update_ event.
1172
- *
1173
- * @see {@link https://discord.com/developers/docs/resources/stage-instance#modify-stage-instance}
1174
- */
1175
- editStageInstance: (channelId: BigString, topic: string, reason?: string) => Promise<Camelize<DiscordStageInstance>>;
1176
- /**
1177
- * Edits the voice state of another user.
1178
- *
1179
- * @param guildId - The ID of the guild in which to edit the voice state of the bot user.
1180
- * @param options - The parameters for the edit of the voice state.
1181
- *
1182
- * @remarks
1183
- * The {@link EditOwnVoiceState.channelId | channelId} property of the options object parameter must point to a stage channel, and the user must already have joined it.
1184
- *
1185
- * Requires the `MUTE_MEMBERS` permission.
1186
- *
1187
- * @see {@link https://discord.com/developers/docs/resources/voice#modify-user-voice-state}
1188
- */
1189
- editUserVoiceState: (guildId: BigString, options: EditUserVoiceState) => Promise<void>;
1190
- /**
1191
- * Edit the current user application role connection for the application.
1192
- *
1193
- * @param bearerToken - The access token of the user
1194
- * @param applicationId - The id of the application to edit the role connection
1195
- * @param options - The options to edit
1196
- * @returns {DiscordApplicationRoleConnection}
1197
- *
1198
- * @remarks
1199
- * This requires the `role_connections.write` scope.
1200
- *
1201
- * @see {@link https://discord.com/developers/docs/resources/user#update-user-application-role-connection}
1202
- */
1203
- editUserApplicationRoleConnection: (bearerToken: string, applicationId: BigString, options: Camelize<DiscordApplicationRoleConnection>) => Promise<Camelize<DiscordApplicationRoleConnection>>;
1204
- /**
1205
- * Edits a webhook.
1206
- *
1207
- * @param webhookId - The ID of the webhook to edit.
1208
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
1209
- * @returns An instance of the edited {@link DiscordWebhook}.
1210
- *
1211
- * @remarks
1212
- * Requires the `MANAGE_WEBHOOKS` permission.
1213
- *
1214
- * Fires a _Webhooks Update_ gateway event.
1215
- *
1216
- * @see {@link https://discord.com/developers/docs/resources/webhook#edit-webhook}
1217
- */
1218
- editWebhook: (webhookId: BigString, options: ModifyWebhook, reason?: string) => Promise<Camelize<DiscordWebhook>>;
1219
- /**
1220
- * Edits a webhook message.
1221
- *
1222
- * @param webhookId - The ID of the webhook to edit the message of.
1223
- * @param token - The webhook token, used to edit the message.
1224
- * @param messageId - The ID of the message to edit.
1225
- * @param options - The parameters for the edit of the message.
1226
- * @returns An instance of the edited {@link DiscordMessage}.
1227
- *
1228
- * @remarks
1229
- * Fires a _Message Update_ gateway event.
1230
- *
1231
- * @see {@link https://discord.com/developers/docs/resources/webhook#edit-webhook-message}
1232
- */
1233
- editWebhookMessage: (webhookId: BigString, token: string, messageId: BigString, options: EditWebhookMessageOptions) => Promise<Camelize<DiscordMessage>>;
1234
- /**
1235
- * Edits a webhook using the webhook token, thereby bypassing the need for authentication + permissions.
1236
- *
1237
- * @param webhookId - The ID of the webhook to edit.
1238
- * @param token - The webhook token, used to edit the webhook.
1239
- * @returns An instance of the edited {@link DiscordWebhook}.
1240
- *
1241
- * @remarks
1242
- * Requires the `MANAGE_WEBHOOKS` permission.
1243
- *
1244
- * Fires a _Webhooks Update_ gateway event.
1245
- *
1246
- * @see {@link https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token}
1247
- */
1248
- editWebhookWithToken: (webhookId: BigString, token: string, options: Omit<ModifyWebhook, 'channelId'>) => Promise<Camelize<DiscordWebhook>>;
1249
- /**
1250
- * Edits a guild's welcome screen.
1251
- *
1252
- * @param guildId - The ID of the guild to edit the welcome screen of.
1253
- * @param options - The parameters for the edit of the welcome screen.
1254
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
1255
- * @returns An instance of the edited {@link DiscordWelcomeScreen}.
1256
- *
1257
- * @remarks
1258
- * Requires the `MANAGE_GUILD` permission.
1259
- *
1260
- * Fires a _Guild Update_ gateway event.
1261
- *
1262
- * @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen}
1263
- */
1264
- editWelcomeScreen: (guildId: BigString, options: ModifyGuildWelcomeScreen, reason?: string) => Promise<Camelize<DiscordWelcomeScreen>>;
1265
- /**
1266
- * Edits the settings of a guild's widget.
1267
- *
1268
- * @param guildId - The ID of the guild to edit the settings of the widget of.
1269
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
1270
- * @returns An instance of the edited {@link DiscordGuildWidgetSettings}.
1271
- *
1272
- * @remarks
1273
- * Requires the `MANAGE_GUILD` permission.
1274
- *
1275
- * Fires a _Guild Update_ gateway event.
1276
- *
1277
- * @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-widget}
1278
- */
1279
- editWidgetSettings: (guildId: BigString, options: Camelize<DiscordGuildWidgetSettings>, reason?: string) => Promise<Camelize<DiscordGuildWidgetSettings>>;
1280
- /**
1281
- * Executes a webhook, causing a message to be posted in the channel configured for the webhook.
1282
- *
1283
- * @param webhookId - The ID of the webhook to execute.
1284
- * @param token - The webhook token, used to execute the webhook.
1285
- * @param options - The parameters for the execution of the webhook.
1286
- * @returns An instance of the created {@link DiscordMessage}, or `undefined` if the {@link ExecuteWebhook.wait | wait} property of the options object parameter is set to `false`.
1287
- *
1288
- * @remarks
1289
- * If the webhook channel is a forum channel, you must provide a value for either `threadId` or `threadName`.
1290
- *
1291
- * @see {@link https://discord.com/developers/docs/resources/webhook#execute-webhook}
1292
- */
1293
- executeWebhook: (webhookId: BigString, token: string, options: ExecuteWebhook) => Promise<Camelize<DiscordMessage> | undefined>;
1294
- /**
1295
- * Follows an announcement channel, allowing messages posted within it to be cross-posted into the target channel.
1296
- *
1297
- * @param sourceChannelId - The ID of the announcement channel to follow.
1298
- * @param targetChannelId - The ID of the target channel - the channel to cross-post to.
1299
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
1300
- * @returns An instance of {@link DiscordFollowedChannel}.
1301
- *
1302
- * @remarks
1303
- * Requires the `MANAGE_WEBHOOKS` permission in the __target channel__.
1304
- *
1305
- * Fires a _Webhooks Update_ gateway event.
1306
- *
1307
- * @see {@link https://discord.com/developers/docs/resources/channel#follow-announcement-channel}
1308
- */
1309
- followAnnouncement: (sourceChannelId: BigString, targetChannelId: BigString, reason?: string) => Promise<Camelize<DiscordFollowedChannel>>;
1310
- /**
1311
- * Gets the list of all active threads for a guild.
1312
- *
1313
- * @param guildId - The ID of the guild to get the threads of.
1314
- * @returns An instance of {@link DiscordListActiveThreads}.
1315
- *
1316
- * @remarks
1317
- * Returns both public and private threads.
1318
- *
1319
- * Threads are ordered by the `id` property in descending order.
1320
- *
1321
- * @see {@link https://discord.com/developers/docs/resources/guild#list-active-guild-threads}
1322
- */
1323
- getActiveThreads: (guildId: BigString) => Promise<Camelize<DiscordListActiveThreads>>;
1324
- /** Get the applications info */
1325
- getApplicationInfo: () => Promise<Camelize<DiscordApplication>>;
1326
- /**
1327
- * Edit properties of the app associated with the requesting bot user.
1328
- *
1329
- * @remarks
1330
- * Only properties that are passed will be updated.
1331
- */
1332
- editApplicationInfo: (body: EditApplication) => Promise<Camelize<DiscordApplication>>;
1333
- /**
1334
- * Get the current authentication info for the authenticated user
1335
- *
1336
- * @param bearerToken - Any OAuth2 derived access token
1337
- * @returns An instance of {@link DiscordCurrentAuthorization}
1338
- *
1339
- * @remarks
1340
- * The user object is not defined if the scopes do not include `identify`.
1341
- * In the user object, if defined, the email is not included if the scopes do not include `email`
1342
- */
1343
- getCurrentAuthenticationInfo: (bearerToken: string) => Promise<Camelize<DiscordCurrentAuthorization>>;
1344
- /**
1345
- * Exchange the information to get a OAuth2 accessToken token
1346
- *
1347
- * @param clientId - Application's client id
1348
- * @param clientSecret - application's client secret
1349
- * @param options - The options to make the exchange with discord
1350
- */
1351
- exchangeToken: (clientId: BigString, clientSecret: string, options: Camelize<DiscordTokenExchange>) => Promise<Camelize<DiscordAccessTokenResponse>>;
1352
- /**
1353
- * Revoke an access_token
1354
- *
1355
- * @param clientId - Application's client id
1356
- * @param clientSecret - application's client secret
1357
- * @param options - The options to revoke the access_token
1358
- */
1359
- revokeToken: (clientId: BigString, clientSecret: string, options: Camelize<DiscordTokenRevocation>) => Promise<void>;
1360
- /**
1361
- * Gets the permissions of a guild application command.
1362
- *
1363
- * @param guildId - The ID of the guild the command is registered in.
1364
- * @param commandId - The ID of the command to get the permissions of.
1365
- * @param options - The OAuth2 related optional parameters for the endpoint
1366
- * @returns An instance of {@link DiscordGuildApplicationCommandPermissions}.
1367
- *
1368
- * @remarks
1369
- * Then specifying the options object the access token passed-in requires the OAuth2 scope `applications.commands.permissions.update`
1370
- *
1371
- * @see {@link https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions}
1372
- */
1373
- getApplicationCommandPermission: (guildId: BigString, commandId: BigString, options?: GetApplicationCommandPermissionOptions) => Promise<Camelize<DiscordGuildApplicationCommandPermissions>>;
1374
- /**
1375
- * Gets the permissions of all application commands registered in a guild by the ID of the guild and optionally an external application.
1376
- *
1377
- * @param guildId - The ID of the guild to get the permissions objects of.
1378
- * @param options - The OAuth2 related optional parameters for the endpoint
1379
- * @returns A collection of {@link DiscordGuildApplicationCommandPermissions} objects assorted by command ID.
1380
- *
1381
- * @remarks
1382
- * Then specifying the options object the access token passed-in requires the OAuth2 scope `applications.commands.permissions.update`
1383
- *
1384
- * @see {@link https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions}
1385
- */
1386
- getApplicationCommandPermissions: (guildId: BigString, options?: GetApplicationCommandPermissionOptions) => Promise<Camelize<DiscordGuildApplicationCommandPermissions>[]>;
1387
- /**
1388
- * Gets a guild's audit log.
1389
- *
1390
- * @param guildId - The ID of the guild to get the audit log of.
1391
- * @param options - The parameters for the fetching of the audit log.
1392
- * @returns An instance of {@link DiscordAuditLog}.
1393
- *
1394
- * @remarks
1395
- * Requires the `VIEW_AUDIT_LOG` permission.
1396
- *
1397
- * @see {@link https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log}
1398
- */
1399
- getAuditLog: (guildId: BigString, options?: GetGuildAuditLog) => Promise<Camelize<DiscordAuditLog>>;
1400
- /**
1401
- * Gets an automod rule by its ID.
1402
- *
1403
- * @param guildId - The ID of the guild to get the rule of.
1404
- * @param ruleId - The ID of the rule to get.
1405
- * @returns An instance of {@link DiscordAutoModerationRule}.
1406
- *
1407
- * @remarks
1408
- * Requires the `MANAGE_GUILD` permission.
1409
- *
1410
- * @see {@link https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule}
1411
- */
1412
- getAutomodRule: (guildId: BigString, ruleId: BigString) => Promise<Camelize<DiscordAutoModerationRule>>;
1413
- /**
1414
- * Gets the list of automod rules for a guild.
1415
- *
1416
- * @param guildId - The ID of the guild to get the rules from.
1417
- * @returns A collection of {@link DiscordAutoModerationRule} objects assorted by rule ID.
1418
- *
1419
- * @remarks
1420
- * Requires the `MANAGE_GUILD` permission.
1421
- *
1422
- * @see {@link https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild}
1423
- */
1424
- getAutomodRules: (guildId: BigString) => Promise<Camelize<DiscordAutoModerationRule>[]>;
1425
- /**
1426
- * Gets the list of available voice regions.
1427
- *
1428
- * @returns A collection of {@link DiscordVoiceRegion} objects assorted by voice region ID.
1429
- */
1430
- getAvailableVoiceRegions: () => Promise<Camelize<DiscordVoiceRegion>[]>;
1431
- /**
1432
- * Gets a ban by user ID.
1433
- *
1434
- * @param guildId - The ID of the guild to get the ban from.
1435
- * @param userId - The ID of the user to get the ban for.
1436
- * @returns An instance of {@link DiscordBan}.
1437
- *
1438
- * @remarks
1439
- * Requires the `BAN_MEMBERS` permission.
1440
- *
1441
- * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-ban}
1442
- */
1443
- getBan: (guildId: BigString, userId: BigString) => Promise<Camelize<DiscordBan>>;
1444
- /**
1445
- * Gets the list of bans for a guild.
1446
- *
1447
- * @param guildId - The ID of the guild to get the list of bans for.
1448
- * @param options - The parameters for the fetching of the list of bans.
1449
- * @returns A collection of {@link DiscordBan} objects assorted by user ID.
1450
- *
1451
- * @remarks
1452
- * Requires the `BAN_MEMBERS` permission.
1453
- *
1454
- * Users are ordered by their IDs in _ascending_ order.
1455
- *
1456
- * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-bans}
1457
- */
1458
- getBans: (guildId: BigString, options?: GetBans) => Promise<Camelize<DiscordBan>[]>;
1459
- /**
1460
- * Gets a channel by its ID.
1461
- *
1462
- * @param channelId - The ID of the channel to get.
1463
- * @returns An instance of {@link DiscordChannel}.
1464
- *
1465
- * @remarks
1466
- * If the channel is a thread, a {@link DiscordThreadMember} object is included in the result.
1467
- *
1468
- * @see {@link https://discord.com/developers/docs/resources/channel#get-channel}
1469
- */
1470
- getChannel: (channelId: BigString) => Promise<Camelize<DiscordChannel>>;
1471
- /**
1472
- * Gets the list of invites for a channel.
1473
- *
1474
- * @param channelId - The ID of the channel to get the invites of.
1475
- * @returns A collection of {@link DiscordInviteMetadata} objects assorted by invite code.
1476
- *
1477
- * @remarks
1478
- * Requires the `MANAGE_CHANNELS` permission.
1479
- *
1480
- * Only usable for guild channels.
1481
- *
1482
- * @see {@link https://discord.com/developers/docs/resources/channel#get-channel-invites}
1483
- */
1484
- getChannelInvites: (channelId: BigString) => Promise<Camelize<DiscordInviteMetadata>[]>;
1485
- /**
1486
- * Gets the list of channels for a guild.
1487
- *
1488
- * @param guildId - The ID of the guild to get the channels of.
1489
- * @returns A collection of {@link DiscordChannel} objects assorted by channel ID.
1490
- *
1491
- * @remarks
1492
- * Excludes threads.
1493
- *
1494
- * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-channels}
1495
- */
1496
- getChannels: (guildId: BigString) => Promise<Camelize<DiscordChannel>[]>;
1497
- /**
1498
- * Gets a list of webhooks for a channel.
1499
- *
1500
- * @param channelId - The ID of the channel which to get the webhooks of.
1501
- * @returns A collection of {@link DiscordWebhook} objects assorted by webhook ID.
1502
- *
1503
- * @remarks
1504
- * Requires the `MANAGE_WEBHOOKS` permission.
1505
- *
1506
- * @see {@link https://discord.com/developers/docs/resources/webhook#get-channel-webhooks}
1507
- */
1508
- getChannelWebhooks: (channelId: BigString) => Promise<Camelize<DiscordWebhook>[]>;
1509
- /**
1510
- * Gets or creates a DM channel with a user.
1511
- *
1512
- * @param userId - The ID of the user to create the DM channel with.
1513
- * @returns An instance of {@link DiscordChannel}.
1514
- *
1515
- * @see {@link https://discord.com/developers/docs/resources/user#create-dm}
1516
- */
1517
- getDmChannel: (userId: BigString) => Promise<Camelize<DiscordChannel>>;
1518
- /**
1519
- * Create a new group DM channel with multiple users.
1520
- *
1521
- * @param options - The options for create a new group dm
1522
- * @returns An instance of {@link DiscordChannel}.
1523
- *
1524
- * @remarks
1525
- * The access tokens require to have the `gdm.join` scope
1526
- *
1527
- * This endpoint is limited to 10 active group DMs.
1528
- *
1529
- * Fires a _Channel create_ gateway event.
1530
- *
1531
- * @see {@link https://discord.com/developers/docs/resources/user#create-group-dm}
1532
- */
1533
- getGroupDmChannel: (options: CreateGroupDmOptions) => Promise<Camelize<DiscordChannel>>;
1534
- /**
1535
- * Gets an emoji by its ID.
1536
- *
1537
- * @param guildId - The ID of the guild from which to get the emoji.
1538
- * @param emojiId - The ID of the emoji to get.
1539
- * @returns An instance of {@link DiscordEmoji}.
1540
- *
1541
- * @remarks
1542
- * Includes the `user` field if the bot has the `MANAGE_GUILD_EXPRESSIONS` permission,
1543
- * or if the bot created the emoji and has the the `CREATE_GUILD_EXPRESSIONS` permission.
1544
- *
1545
- * @see {@link https://discord.com/developers/docs/resources/emoji#get-guild-emoji}
1546
- */
1547
- getEmoji: (guildId: BigString, emojiId: BigString) => Promise<Camelize<DiscordEmoji>>;
1548
- /**
1549
- * Gets an application emoji by its ID.
1550
- *
1551
- * @param emojiId - The ID of the emoji to get.
1552
- * @returns An instance of {@link DiscordEmoji}.
1553
- *
1554
- * @remarks
1555
- * 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.
1556
- *
1557
- * @see {@link https://discord.com/developers/docs/resources/emoji#get-application-emoji}
1558
- */
1559
- getApplicationEmoji: (emojiId: BigString) => Promise<Camelize<DiscordEmoji>>;
1560
- /**
1561
- * Gets the list of emojis for a guild.
1562
- *
1563
- * @param guildId - The ID of the guild which to get the emojis of.
1564
- * @returns A collection of {@link DiscordEmoji} objects assorted by emoji ID.
1565
- *
1566
- * @remarks
1567
- * Includes `user` fields if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
1568
- *
1569
- * @see {@link https://discord.com/developers/docs/resources/emoji#list-guild-emojis}
1570
- */
1571
- getEmojis: (guildId: BigString) => Promise<Camelize<DiscordEmoji>[]>;
1572
- /**
1573
- * Gets the list of emojis for an application.
1574
- *
1575
- * @returns An object with the array of {@link DiscordEmoji} objects.
1576
- *
1577
- * @remarks
1578
- * 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.
1579
- *
1580
- * @see {@link https://discord.com/developers/docs/resources/emoji#list-application-emojis}
1581
- */
1582
- getApplicationEmojis: () => Promise<{
1583
- items: Camelize<DiscordEmoji>[];
1584
- }>;
1585
- /**
1586
- * Gets a follow-up message to an interaction by the ID of the message.
1587
- *
1588
- * @param token - The interaction token to use, provided in the original interaction.
1589
- * @param messageId - The ID of the message to get.
1590
- * @returns An instance of {@link DiscordMessage}.
1591
- *
1592
- * @remarks
1593
- * Unlike `getMessage()`, this endpoint allows the bot user to act without:
1594
- * - Needing to be able to see the contents of the channel that the message is in. (`READ_MESSAGES` permission.)
1595
- * - Requiring the `MESSAGE_CONTENT` intent.
1596
- *
1597
- * Does not support ephemeral follow-up messages due to these being stateless.
1598
- *
1599
- * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#get-followup-message}
1600
- */
1601
- getFollowupMessage: (token: string, messageId: BigString) => Promise<Camelize<DiscordMessage>>;
1602
- /** Get the bots Gateway metadata that can help during the operation of large or sharded bots. */
1603
- getGatewayBot: () => Promise<Camelize<DiscordGetGatewayBot>>;
1604
- /**
1605
- * Gets a global application command by its ID.
1606
- *
1607
- * @param commandId - The ID of the command to get.
1608
- * @returns An instance of {@link DiscordApplicationCommand}.
1609
- *
1610
- * @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-command}
1611
- */
1612
- getGlobalApplicationCommand: (commandId: BigString) => Promise<Camelize<DiscordApplicationCommand>>;
1613
- /**
1614
- * Gets the list of your bot's global application commands.
1615
- *
1616
- * @param options - The parameters for the fetching of global application commands
1617
- * @returns A collection of {@link DiscordApplicationCommand} objects assorted by command ID.
1618
- *
1619
- * @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands}
1620
- */
1621
- getGlobalApplicationCommands: (options?: GetGlobalApplicationCommandsOptions) => Promise<Camelize<DiscordApplicationCommand>[]>;
1622
- /**
1623
- * Gets a guild by its ID.
1624
- *
1625
- * @param guildId - The ID of the guild to get.
1626
- * @param options - The parameters for the fetching of the guild.
1627
- * @returns An instance of {@link DiscordGuild}.
1628
- *
1629
- * @see {@link https://discord.com/developers/docs/resources/guild#get-guild}
1630
- */
1631
- getGuild: (guildId: BigString, options?: {
1632
- counts?: boolean;
1633
- }) => Promise<Camelize<DiscordGuild>>;
1634
- /**
1635
- * Get the user guilds.
1636
- *
1637
- * @param bearerToken - The access token of the user, if unspecified the bot token is used instead
1638
- * @param options - The parameters for the fetching of the guild.
1639
- * @returns An array of partial {@link DiscordGuild}.
1640
- *
1641
- * @remarks
1642
- * If used with an access token, the token needs to have the `guilds` scope
1643
- *
1644
- * @see {@link https://discord.com/developers/docs/resources/user#get-current-user-guilds}
1645
- */
1646
- getGuilds: (bearerToken?: string, options?: GetUserGuilds) => Promise<Partial<Camelize<DiscordGuild>>[]>;
1647
- /**
1648
- * Gets a guild application command by its ID.
1649
- *
1650
- * @param guildId - The ID of the guild the command is registered in.
1651
- * @param commandId - The ID of the command to get.
1652
- * @returns An instance of {@link DiscordApplicationCommand}.
1653
- *
1654
- * @see {@link https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command}
1655
- */
1656
- getGuildApplicationCommand: (commandId: BigString, guildId: BigString) => Promise<Camelize<DiscordApplicationCommand>>;
1657
- /**
1658
- * Gets the list of application commands registered by your bot in a guild.
1659
- *
1660
- * @param guildId - The ID of the guild the commands are registered in.
1661
- * @param options - The parameters for the fetching of guild application commands
1662
- * @returns A collection of {@link DiscordApplicationCommand} objects assorted by command ID.
1663
- *
1664
- * @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-commandss}
1665
- */
1666
- getGuildApplicationCommands: (guildId: BigString, options?: GetGuildApplicationCommandsOptions) => Promise<Camelize<DiscordApplicationCommand>[]>;
1667
- /**
1668
- * Gets the preview of a guild by a guild's ID.
1669
- *
1670
- * @param guildId - The ID of the guild to get the preview of.
1671
- * @returns An instance of {@link DiscordGuildPreview}.
1672
- *
1673
- * @remarks
1674
- * If the bot user is not in the guild, the guild must be discoverable.
1675
- *
1676
- * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-preview}
1677
- */
1678
- getGuildPreview: (guildId: BigString) => Promise<Camelize<DiscordGuildPreview>>;
1679
- /**
1680
- * Returns a sticker object for the given guild and sticker IDs.
1681
- *
1682
- * @param guildId The ID of the guild to get
1683
- * @param stickerId The ID of the sticker to get
1684
- * @return A {@link DiscordSticker}
1685
- *
1686
- * @remarks Includes the user field if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
1687
- *
1688
- * @see {@link https://discord.com/developers/docs/resources/sticker#get-guild-sticker}
1689
- */
1690
- getGuildSticker: (guildId: BigString, stickerId: BigString) => Promise<Camelize<DiscordSticker>>;
1691
- /**
1692
- * Returns an array of sticker objects for the given guild.
1693
- *
1694
- * @param guildId The ID of the guild to get
1695
- * @returns A collection of {@link DiscordSticker} objects assorted by sticker ID.
1696
- *
1697
- * @remarks Includes user fields if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
1698
- *
1699
- * @see {@link https://discord.com/developers/docs/resources/sticker#list-guild-stickers}
1700
- */
1701
- getGuildStickers: (guildId: BigString) => Promise<Camelize<DiscordSticker>[]>;
1702
- /**
1703
- * Gets a template by its code.
1704
- *
1705
- * @param templateCode - The code of the template to get.
1706
- * @returns An instance of {@link DiscordTemplate}.
1707
- *
1708
- * @remarks
1709
- * Requires the `MANAGE_GUILD` permission.
1710
- *
1711
- * @see {@link https://discord.com/developers/docs/resources/guild-template#get-guild-template}
1712
- */
1713
- getGuildTemplate: (templateCode: string) => Promise<Camelize<DiscordTemplate>>;
1714
- /**
1715
- * Gets the list of templates for a guild.
1716
- *
1717
- * @param guildId - The ID of the guild to get the list of templates for.
1718
- * @returns A collection of {@link DiscordTemplate} objects assorted by template code.
1719
- *
1720
- * @remarks
1721
- * Requires the `MANAGE_GUILD` permission.
1722
- *
1723
- * @see {@link https://discord.com/developers/docs/resources/guild-template#get-guild-templates}
1724
- */
1725
- getGuildTemplates: (guildId: BigString) => Promise<Camelize<DiscordTemplate>[]>;
1726
- /**
1727
- * Gets the list of webhooks for a guild.
1728
- *
1729
- * @param guildId - The ID of the guild to get the list of webhooks for.
1730
- * @returns A collection of {@link DiscordWebhook} objects assorted by webhook ID.
1731
- *
1732
- * @remarks
1733
- * Requires the `MANAGE_WEBHOOKS` permission.
1734
- *
1735
- * @see {@link https://discord.com/developers/docs/resources/webhook#get-guild-webhooks}
1736
- */
1737
- getGuildWebhooks: (guildId: BigString) => Promise<Camelize<DiscordWebhook>[]>;
1738
- /**
1739
- * Gets the list of integrations attached to a guild.
1740
- *
1741
- * @param guildId - The ID of the guild to get the list of integrations from.
1742
- * @returns A collection of {@link DiscordIntegration} objects assorted by integration ID.
1743
- *
1744
- * @remarks
1745
- * Requires the `MANAGE_GUILD` permission.
1746
- *
1747
- * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-integrations}
1748
- */
1749
- getIntegrations: (guildId: BigString) => Promise<Camelize<DiscordIntegration>[]>;
1750
- /**
1751
- * Gets an invite to a channel by its invite code.
1752
- *
1753
- * @param inviteCode - The invite code of the invite to get.
1754
- * @param options - The parameters for the fetching of the invite.
1755
- * @returns An instance of {@link DiscordInviteMetadata}.
1756
- *
1757
- * @see {@link https://discord.com/developers/docs/resources/invite#get-invite}
1758
- */
1759
- getInvite: (inviteCode: string, options?: GetInvite) => Promise<Camelize<DiscordInviteMetadata>>;
1760
- /**
1761
- * Gets the list of invites for a guild.
1762
- *
1763
- * @param guildId - The ID of the guild to get the invites from.
1764
- * @returns A collection of {@link DiscordInviteMetadata} objects assorted by invite code.
1765
- *
1766
- * @remarks
1767
- * Requires the `MANAGE_GUILD` or `VIEW_AUDIT_LOG` permission.
1768
- *
1769
- * @see {@link https://discord.com/developers/docs/resources/invite#get-invites}
1770
- */
1771
- getInvites: (guildId: BigString) => Promise<Camelize<DiscordInviteMetadata>[]>;
1772
- /**
1773
- * Gets a message from a channel by the ID of the message.
1774
- *
1775
- * @param channelId - The ID of the channel from which to get the message.
1776
- * @param messageId - The ID of the message to get.
1777
- * @returns An instance of {@link DiscordMessage}.
1778
- *
1779
- * @remarks
1780
- * Requires that the bot user be able to see the contents of the channel in which the message was posted.
1781
- *
1782
- * If getting a message from a guild channel:
1783
- * - Requires the `READ_MESSAGE_HISTORY` permission.
1784
- *
1785
- * @see {@link https://discord.com/developers/docs/resources/channel#get-channel-message}
1786
- */
1787
- getMessage: (channelId: BigString, messageId: BigString) => Promise<Camelize<DiscordMessage>>;
1788
- /**
1789
- * Gets multiple messages from a channel.
1790
- *
1791
- * @param channelId - The ID of the channel from which to get the messages.
1792
- * @param options - The parameters for the fetching of the messages.
1793
- * @returns Returns an array of {@link DiscordMessage} objects from newest to oldest on success.
1794
- *
1795
- * @remarks
1796
- * Requires that the bot user be able to see the contents of the channel in which the messages were posted.
1797
- *
1798
- * If getting a messages from a guild channel:
1799
- * - Requires the `READ_MESSAGE_HISTORY` permission.
1800
- *
1801
- * @see {@link https://discord.com/developers/docs/resources/channel#get-channel-messages}
1802
- */
1803
- getMessages: (channelId: BigString, options?: GetMessagesOptions) => Promise<Camelize<DiscordMessage>[]>;
1804
- /**
1805
- * Returns a sticker pack for the given ID.
1806
- *
1807
- * @returns A {@link DiscordStickerPack} object.
1808
- *
1809
- * @see {@link https://discord.com/developers/docs/resources/sticker#get-sticker-pack}
1810
- */
1811
- getStickerPack: (stickerPackId: BigString) => Promise<Camelize<DiscordStickerPack>>;
1812
- /**
1813
- * Returns the list of sticker packs available.
1814
- *
1815
- * @returns A collection of {@link DiscordStickerPack} objects assorted by sticker ID.
1816
- *
1817
- * @see {@link https://discord.com/developers/docs/resources/sticker#list-sticker-packs}
1818
- */
1819
- getStickerPacks: () => Promise<Camelize<DiscordStickerPack>[]>;
1820
- /**
1821
- * Gets the initial message response to an interaction.
1822
- *
1823
- * @param token - The interaction token to use, provided in the original interaction.
1824
- * @returns An instance of {@link DiscordMessage}.
1825
- *
1826
- * @remarks
1827
- * Unlike `getMessage()`, this endpoint allows the bot user to act without:
1828
- * - Needing to be able to see the contents of the channel that the message is in. (`READ_MESSAGES` permission.)
1829
- * - Requiring the `MESSAGE_CONTENT` intent.
1830
- *
1831
- * Does not support ephemeral follow-up messages due to these being stateless.
1832
- *
1833
- * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response}
1834
- */
1835
- getOriginalInteractionResponse: (token: string) => Promise<Camelize<DiscordMessage>>;
1836
- /**
1837
- * Retrieves the list of pins in a channel.
1838
- *
1839
- * @param channelId - The ID of the channel to get the pins for.
1840
- * @param options - The options for the fetching of the pins.
1841
- * @returns A {@link DiscordGetChannelPins} objects
1842
- *
1843
- * @remarks
1844
- * Requires the `VIEW_CHANNEL` permission.
1845
- *
1846
- * If the user is missing the `READ_MESSAGE_HISTORY` permission in the channel, then no pins will be returned.
1847
- *
1848
- * @see {@link https://discord.com/developers/docs/resources/message#get-channel-pins}
1849
- */
1850
- getChannelPins: (channelId: BigString, options?: GetChannelPinsOptions) => Promise<Camelize<DiscordGetChannelPins>>;
1851
- /**
1852
- * Gets the pinned messages for a channel.
1853
- *
1854
- * @param channelId - The ID of the channel to get the pinned messages for.
1855
- * @returns A collection of {@link DiscordMessage} objects assorted by message ID.
1856
- *
1857
- * @remarks
1858
- * Requires that the bot user be able to see the contents of the channel in which the messages were posted.
1859
- *
1860
- * If getting a message from a guild channel:
1861
- * - Requires the `READ_MESSAGE_HISTORY` permission.
1862
- *
1863
- * @see {@link https://discord.com/developers/docs/resources/message#get-pinned-messages-deprecated}
1864
- * @deprecated Use {@link getChannelPins} instead.
1865
- */
1866
- getPinnedMessages: (channelId: BigString) => Promise<Camelize<DiscordMessage>[]>;
1867
- /**
1868
- * Gets the list of private archived threads for a channel.
1869
- *
1870
- * @param channelId - The ID of the channel to get the archived threads for.
1871
- * @param options - The parameters for the fetching of threads.
1872
- * @returns An instance of {@link DiscordListArchivedThreads}.
1873
- *
1874
- * @remarks
1875
- * Requires the `READ_MESSAGE_HISTORY` permission.
1876
- * Requires the `MANAGE_THREADS` permission.
1877
- *
1878
- * Returns threads of type {@link ChannelTypes}.GuildPrivateThread.
1879
- *
1880
- * Threads are ordered by the `archive_timestamp` property included in the metadata of the object in descending order.
1881
- *
1882
- * @see {@link https://discord.com/developers/docs/resources/channel#list-private-archived-threads}
1883
- */
1884
- getPrivateArchivedThreads: (channelId: BigString, options?: ListArchivedThreads) => Promise<Camelize<DiscordListArchivedThreads>>;
1885
- /**
1886
- * Gets the list of private archived threads the bot is a member of for a channel.
1887
- *
1888
- * @param channelId - The ID of the channel to get the archived threads for.
1889
- * @param options - The parameters for the fetching of threads.
1890
- * @returns An instance of {@link DiscordListArchivedThreads}.
1891
- *
1892
- * @remarks
1893
- * Requires the `READ_MESSAGE_HISTORY` permission.
1894
- *
1895
- * Returns threads of type {@link ChannelTypes}.GuildPrivateThread.
1896
- *
1897
- * Threads are ordered by the `id` property in descending order.
1898
- *
1899
- * @see {@link https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads}
1900
- */
1901
- getPrivateJoinedArchivedThreads: (channelId: BigString, options?: ListArchivedThreads) => Promise<Camelize<DiscordListArchivedThreads>>;
1902
- /**
1903
- * Gets the number of members that would be kicked from a guild during pruning.
1904
- *
1905
- * @param guildId - The ID of the guild to get the prune count of.
1906
- * @param options - The parameters for the fetching of the prune count.
1907
- * @returns A number indicating the number of members that would be kicked.
1908
- *
1909
- * @remarks
1910
- * Requires the `MANAGE_GUILD` and `KICK_MEMBERS` permissions.
1911
- *
1912
- * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-prune-count}
1913
- */
1914
- getPruneCount: (guildId: BigString, options?: GetGuildPruneCountQuery) => Promise<Camelize<DiscordPrunedCount>>;
1915
- /**
1916
- * Gets the list of public archived threads for a channel.
1917
- *
1918
- * @param channelId - The ID of the channel to get the archived threads for.
1919
- * @param options - The parameters for the fetching of threads.
1920
- * @returns An instance of {@link DiscordListArchivedThreads}.
1921
- *
1922
- * @remarks
1923
- * Requires the `READ_MESSAGE_HISTORY` permission.
1924
- *
1925
- * If called on a channel of type {@link ChannelTypes}.GuildText, returns threads of type {@link ChannelTypes}.GuildPublicThread.
1926
- * If called on a channel of type {@link ChannelTypes}.GuildNews, returns threads of type {@link ChannelTypes}.GuildNewsThread.
1927
- *
1928
- * Threads are ordered by the `archive_timestamp` property included in the metadata of the object in descending order.
1929
- *
1930
- * @see {@link https://discord.com/developers/docs/resources/channel#list-public-archived-threads}
1931
- */
1932
- getPublicArchivedThreads: (channelId: BigString, options?: ListArchivedThreads) => Promise<Camelize<DiscordListArchivedThreads>>;
1933
- /**
1934
- * Gets the list of roles for a guild.
1935
- *
1936
- * @param guildId - The ID of the guild to get the list of roles for.
1937
- * @returns A collection of {@link DiscordRole} objects assorted by role ID.
1938
- *
1939
- * @remarks
1940
- * ⚠️ This endpoint should be used sparingly due to {@link DiscordRole} objects already being included in guild payloads.
1941
- *
1942
- * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-roles}
1943
- */
1944
- getRoles: (guildId: BigString) => Promise<Camelize<DiscordRole>[]>;
1945
- /**
1946
- * Gets a role by id for a guild.
1947
- *
1948
- * @param guildId - The ID of the guild to get role for.
1949
- * @param roleId - The ID of the role.
1950
- * @returns A {@link DiscordRole} object.
1951
- *
1952
- * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-role}
1953
- */
1954
- getRole: (guildId: BigString, roleId: BigString) => Promise<Camelize<DiscordRole>>;
1955
- /**
1956
- * Gets a scheduled event by its ID.
1957
- *
1958
- * @param guildId - The ID of the guild to get the scheduled event from.
1959
- * @param eventId - The ID of the scheduled event to get.
1960
- * @param options - The parameters for the fetching of the scheduled event.
1961
- * @returns An instance of {@link DiscordScheduledEvent}.
1962
- *
1963
- * @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event}
1964
- */
1965
- getScheduledEvent: (guildId: BigString, eventId: BigString, options?: {
1966
- withUserCount?: boolean;
1967
- }) => Promise<Camelize<DiscordScheduledEvent>>;
1968
- /**
1969
- * Gets the list of scheduled events for a guild.
1970
- *
1971
- * @param guildId - The ID of the guild to get the scheduled events from.
1972
- * @param options - The parameters for the fetching of the scheduled events.
1973
- * @returns A collection of {@link DiscordScheduledEvent} objects assorted by event ID.
1974
- *
1975
- * @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild}
1976
- */
1977
- getScheduledEvents: (guildId: BigString, options?: GetScheduledEvents) => Promise<Camelize<DiscordScheduledEvent>[]>;
1978
- /**
1979
- * Gets the list of subscribers to a scheduled event from a guild.
1980
- *
1981
- * @param guildId - The ID of the guild to get the subscribers to the scheduled event from.
1982
- * @param eventId - The ID of the scheduled event to get the subscribers of.
1983
- * @param options - The parameters for the fetching of the subscribers.
1984
- * @returns A collection of {@link DiscordUser} objects assorted by user ID.
1985
- *
1986
- * @remarks
1987
- * Requires the `MANAGE_EVENTS` permission.
1988
- *
1989
- * Users are ordered by their IDs in _ascending_ order.
1990
- *
1991
- * @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users}
1992
- */
1993
- getScheduledEventUsers: (guildId: BigString, eventId: BigString, options?: GetScheduledEventUsers) => Promise<Array<{
1994
- user: Camelize<DiscordUser>;
1995
- member?: Camelize<DiscordMember>;
1996
- }>>;
1997
- /** Get the bots Gateway metadata that can help during the operation of large or sharded bots. */
1998
- getSessionInfo: () => Promise<Camelize<DiscordGetGatewayBot>>;
1999
- /**
2000
- * Gets the stage instance associated with a stage channel, if one exists.
2001
- *
2002
- * @param channelId - The ID of the stage channel the stage instance is associated with.
2003
- * @returns An instance of {@link DiscordStageInstance}.
2004
- *
2005
- * @see {@link https://discord.com/developers/docs/resources/stage-instance#get-stage-instance}
2006
- */
2007
- getStageInstance: (channelId: BigString) => Promise<Camelize<DiscordStageInstance>>;
2008
- /**
2009
- * Returns the current user's voice state in the guild.
2010
- *
2011
- * @param guildId - The ID of the guild to get the voice state from.
2012
- * @returns An instance of {@link DiscordVoiceState}.
2013
- *
2014
- * @see {@link https://discord.com/developers/docs/resources/voice#get-current-user-voice-state}
2015
- */
2016
- getOwnVoiceState: (guildId: BigString) => Promise<Camelize<DiscordVoiceState>>;
2017
- /**
2018
- * Returns the specified user's voice state in the guild.
2019
- *
2020
- * @param guildId - The ID of the guild to get the voice state from.
2021
- * @param userId - The ID of the user to get the voice state from
2022
- * @returns An instance of {@link DiscordVoiceState}.
2023
- *
2024
- * @see {@link https://discord.com/developers/docs/resources/voice#get-user-voice-state}
2025
- */
2026
- getUserVoiceState: (guildId: BigString, userId: BigString) => Promise<Camelize<DiscordVoiceState>>;
2027
- /**
2028
- * Returns a sticker object for the given sticker ID.
2029
- *
2030
- * @param stickerId The ID of the sticker to get
2031
- * @returns A {@link DiscordSticker}
2032
- *
2033
- * @see {@link https://discord.com/developers/docs/resources/sticker#get-sticker}
2034
- */
2035
- getSticker: (stickerId: BigString) => Promise<Camelize<DiscordSticker>>;
2036
- /**
2037
- * Gets a thread member by their user ID.
2038
- *
2039
- * @param channelId - The ID of the thread to get the thread member of.
2040
- * @param userId - The user ID of the thread member to get.
2041
- * @param options - The parameters for the fetching of the thread member.
2042
- * @returns An instance of {@link DiscordThreadMember}.
2043
- *
2044
- * @see {@link https://discord.com/developers/docs/resources/channel#get-thread-member}
2045
- */
2046
- getThreadMember: (channelId: BigString, userId: BigString, options?: GetThreadMember) => Promise<Camelize<DiscordThreadMember>>;
2047
- /**
2048
- * Gets the list of thread members for a thread.
2049
- *
2050
- * @param channelId - The ID of the thread to get the thread members of.
2051
- * @param options - The parameters for the fetching of the thread members.
2052
- * @returns A collection of {@link DiscordThreadMember} assorted by user ID.
2053
- *
2054
- * @remarks
2055
- * Requires the application to have the `GUILD_MEMBERS` privileged intent enabled.
2056
- *
2057
- * @see {@link https://discord.com/developers/docs/resources/channel#list-thread-members}
2058
- */
2059
- getThreadMembers: (channelId: BigString, options?: ListThreadMembers) => Promise<Camelize<DiscordThreadMember>[]>;
2060
- /**
2061
- * Gets the list of users that reacted with an emoji to a message.
2062
- *
2063
- * @param channelId - The ID of the channel the message to get the users for is in.
2064
- * @param messageId - The ID of the message to get the users for.
2065
- * @param reaction - The reaction for which to get the users.
2066
- * @param options - The parameters for the fetching of the users.
2067
- * @returns A collection of {@link DiscordUser} objects assorted by user ID.
2068
- *
2069
- * @see {@link https://discord.com/developers/docs/resources/channel#get-reactions}
2070
- */
2071
- getReactions: (channelId: BigString, messageId: BigString, reaction: string, options?: GetReactions) => Promise<Camelize<DiscordUser>[]>;
2072
- /**
2073
- * Get a user's data from the api
2074
- *
2075
- * @param id The user's id
2076
- * @returns {DiscordUser}
2077
- */
2078
- getUser: (id: BigString) => Promise<Camelize<DiscordUser>>;
2079
- /**
2080
- * Get the current user data.
2081
- *
2082
- * @param bearerToken - The access token of the user
2083
- * @returns {DiscordUser}
2084
- *
2085
- * @remarks
2086
- * This requires the `identify` scope.
2087
- *
2088
- * To get the mail this also requires the `email` scope
2089
- */
2090
- getCurrentUser: (bearerToken: string) => Promise<Camelize<DiscordUser>>;
2091
- /**
2092
- * Get the current user connections.
2093
- *
2094
- * @param bearerToken - The access token of the user
2095
- * @returns {DiscordConnection[]}
2096
- *
2097
- * @remarks
2098
- * This requires the `connections` scope.
2099
- */
2100
- getUserConnections: (bearerToken: string) => Promise<Camelize<DiscordConnection>[]>;
2101
- /**
2102
- * Get the current user application role connection for the application.
2103
- *
2104
- * @param bearerToken - The access token of the user
2105
- * @param applicationId - The id of the application to get the role connection
2106
- * @returns {DiscordApplicationRoleConnection}
2107
- *
2108
- * @remarks
2109
- * The access token requires the `role_connections.write` scope.
2110
- *
2111
- * @see {@link https://discord.com/developers/docs/resources/user#get-user-application-role-connection}
2112
- */
2113
- getUserApplicationRoleConnection: (bearerToken: string, applicationId: BigString) => Promise<Camelize<DiscordApplicationRoleConnection>>;
2114
- /**
2115
- * Gets information about the vanity url of a guild.
2116
- *
2117
- * @param guildId - The ID of the guild to get the vanity url information for.
2118
- * @returns An instance of {@link DiscordVanityUrl}.
2119
- *
2120
- * @remarks
2121
- * Requires the `MANAGE_GUILD` permission.
2122
- *
2123
- * The `code` property will be `null` if the guild does not have a set vanity url.
2124
- *
2125
- * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-vanity-url}
2126
- */
2127
- getVanityUrl: (guildId: BigString) => Promise<Camelize<DiscordVanityUrl>>;
2128
- /**
2129
- * Gets the list of voice regions for a guild.
2130
- *
2131
- * @param guildId - The ID of the guild to get the voice regions for.
2132
- * @returns A collection of {@link DiscordVoiceRegion} objects assorted by voice region ID.
2133
- *
2134
- * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-voice-regions}
2135
- */
2136
- getVoiceRegions: (guildId: BigString) => Promise<Camelize<DiscordVoiceRegion>[]>;
2137
- /**
2138
- * Gets a webhook by its ID.
2139
- *
2140
- * @param webhookId - The ID of the webhook to get.
2141
- * @returns An instance of {@link DiscordWebhook}.
2142
- *
2143
- * @remarks
2144
- * Requires the `MANAGE_WEBHOOKS` permission unless the application making the request owns the webhook.
2145
- *
2146
- * @see {@link https://discord.com/developers/docs/resources/webhook#get-webhook}
2147
- */
2148
- getWebhook: (webhookId: BigString) => Promise<Camelize<DiscordWebhook>>;
2149
- /**
2150
- * Gets a webhook message by its ID.
2151
- *
2152
- * @param webhookId - The ID of the webhook to get a message of.
2153
- * @param token - The webhook token, used to get webhook messages.
2154
- * @param messageId - the ID of the webhook message to get.
2155
- * @param options - The parameters for the fetching of the message.
2156
- * @returns An instance of {@link DiscordMessage}.
2157
- *
2158
- * @see {@link https://discord.com/developers/docs/resources/webhook#get-webhook-message}
2159
- */
2160
- getWebhookMessage: (webhookId: BigString, token: string, messageId: BigString, options?: GetWebhookMessageOptions) => Promise<Camelize<DiscordMessage>>;
2161
- /**
2162
- * Gets a webhook using the webhook token, thereby bypassing the need for authentication + permissions.
2163
- *
2164
- * @param webhookId - The ID of the webhook to get.
2165
- * @param token - The webhook token, used to get the webhook.
2166
- * @returns An instance of {@link DiscordWebhook}.
2167
- *
2168
- * @see {@link https://discord.com/developers/docs/resources/webhook#get-webhook-with-token}
2169
- */
2170
- getWebhookWithToken: (webhookId: BigString, token: string) => Promise<Camelize<DiscordWebhook>>;
2171
- /**
2172
- * Gets the welcome screen for a guild.
2173
- *
2174
- * @param guildId - The ID of the guild to get the welcome screen for.
2175
- * @returns An instance of {@link DiscordWelcomeScreen}.
2176
- *
2177
- * @remarks
2178
- * If the welcome screen is not enabled:
2179
- * - Requires the `MANAGE_GUILD` permission.
2180
- *
2181
- * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen}
2182
- */
2183
- getWelcomeScreen: (guildId: BigString) => Promise<Camelize<DiscordWelcomeScreen>>;
2184
- /**
2185
- * Gets the guild widget by guild ID.
2186
- *
2187
- * @param guildId - The ID of the guild to get the widget of.
2188
- * @returns An instance of {@link DiscordGuildWidget}.
2189
- *
2190
- * @remarks
2191
- * Fires an `INVITE_CREATED` Gateway event when an invite channel is defined and a new `Invite` is generated.
2192
- *
2193
- * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-widget}
2194
- */
2195
- getWidget: (guildId: BigString) => Promise<Camelize<DiscordGuildWidget>>;
2196
- /**
2197
- * Gets the settings of a guild's widget.
2198
- *
2199
- * @param guildId - The ID of the guild to get the widget of.
2200
- * @returns An instance of {@link DiscordGuildWidgetSettings}.
2201
- *
2202
- * @remarks
2203
- * Requires the `MANAGE_GUILD` permission.
2204
- *
2205
- * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-widget-settings}
2206
- */
2207
- getWidgetSettings: (guildId: BigString) => Promise<Camelize<DiscordGuildWidgetSettings>>;
2208
- /**
2209
- * Adds the bot user to a thread.
2210
- *
2211
- * @param channelId - The ID of the thread to add the bot user to.
2212
- *
2213
- * @remarks
2214
- * Requires the thread not be archived.
2215
- *
2216
- * Fires a _Thread Members Update_ gateway event.
2217
- *
2218
- * @see {@link https://discord.com/developers/docs/resources/channel#join-thread}
2219
- */
2220
- joinThread: (channelId: BigString) => Promise<void>;
2221
- /**
2222
- * Leaves a guild.
2223
- *
2224
- * @param guildId - The ID of the guild to leave.
2225
- *
2226
- * @remarks
2227
- * Fires a _Guild Delete_ event.
2228
- *
2229
- * @see {@link https://discord.com/developers/docs/resources/user#leave-guild}
2230
- */
2231
- leaveGuild: (guildId: BigString) => Promise<void>;
2232
- /**
2233
- * Removes the bot user from a thread.
2234
- *
2235
- * @param channelId - The ID of the thread to remove the bot user from.
2236
- *
2237
- * @remarks
2238
- * Requires the thread not be archived.
2239
- *
2240
- * Fires a _Thread Members Update_ gateway event.
2241
- *
2242
- * @see {@link https://discord.com/developers/docs/resources/channel#leave-thread}
2243
- */
2244
- leaveThread: (channelId: BigString) => Promise<void>;
2245
- /**
2246
- * Cross-posts a message posted in an announcement channel to subscribed channels.
2247
- *
2248
- * @param channelId - The ID of the announcement channel.
2249
- * @param messageId - The ID of the message to cross-post.
2250
- * @returns An instance of the cross-posted {@link DiscordMessage}.
2251
- *
2252
- * @remarks
2253
- * Requires the `SEND_MESSAGES` permission.
2254
- *
2255
- * If not cross-posting own message:
2256
- * - Requires the `MANAGE_MESSAGES` permission.
2257
- *
2258
- * Fires a _Message Create_ event in the guilds the subscribed channels are in.
2259
- *
2260
- * @see {@link https://discord.com/developers/docs/resources/channel#crosspost-message}
2261
- */
2262
- publishMessage: (channelId: BigString, messageId: BigString) => Promise<Camelize<DiscordMessage>>;
2263
- /**
2264
- * Removes a role from a member.
2265
- *
2266
- * @param guildId - The ID of the guild the member to remove the role from is in.
2267
- * @param userId - The user ID of the member to remove the role from.
2268
- * @param roleId - The ID of the role to remove from the member.
2269
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
2270
- *
2271
- * @remarks
2272
- * Requires the `MANAGE_ROLES` permission.
2273
- *
2274
- * Fires a _Guild Member Update_ gateway event.
2275
- *
2276
- * @see {@link https://discord.com/developers/docs/resources/guild#remove-guild-member-role}
2277
- */
2278
- removeRole: (guildId: BigString, userId: BigString, roleId: BigString, reason?: string) => Promise<void>;
2279
- /**
2280
- * Removes a member from a thread.
2281
- *
2282
- * @param channelId - The ID of the thread to remove the thread member of.
2283
- * @param userId - The user ID of the thread member to remove.
2284
- *
2285
- * @remarks
2286
- * If the thread is of type {@link ChannelTypes}.GuildPrivateThread, requires to be the creator of the thread.
2287
- * Otherwise, requires the `MANAGE_THREADS` permission.
2288
- *
2289
- * Requires the thread not be archived.
2290
- *
2291
- * Fires a _Thread Members Update_ gateway event.
2292
- *
2293
- * @see {@link https://discord.com/developers/docs/resources/channel#remove-thread-member}
2294
- */
2295
- removeThreadMember: (channelId: BigString, userId: BigString) => Promise<void>;
2296
- /**
2297
- * Removes a member from a Group DM.
2298
- *
2299
- * @param channelId - The ID of the channel to remove the recipient user of.
2300
- * @param userId - The user ID of the user to remove.
2301
- *
2302
- * @see {@link https://discord.com/developers/docs/resources/channel#group-dm-remove-recipient}
2303
- */
2304
- removeDmRecipient: (channelId: BigString, userId: BigString) => Promise<void>;
2305
- /**
2306
- * Sends a message to a channel.
2307
- *
2308
- * @param channelId - The ID of the channel to send the message in.
2309
- * @param options - The parameters for the creation of the message.
2310
- * @returns An instance of the created {@link DiscordMessage}.
2311
- *
2312
- * @remarks
2313
- * Requires that the bot user be able to see the contents of the channel the message is to be sent in.
2314
- *
2315
- * If sending a message to a guild channel:
2316
- * - Requires the `SEND_MESSAGES` permission.
2317
- *
2318
- * If sending a TTS message:
2319
- * - Requires the `SEND_TTS_MESSAGES` permission.
2320
- *
2321
- * If sending a message as a reply to another message:
2322
- * - Requires the `READ_MESSAGE_HISTORY` permission.
2323
- * - The message being replied to cannot be a system message.
2324
- *
2325
- * ⚠️ The maximum size of a request (accounting for any attachments and message content) for bot users is _8 MiB_.
2326
- *
2327
- * Fires a _Message Create_ gateway event.
2328
- *
2329
- * @see {@link https://discord.com/developers/docs/resources/channel#create-message}
2330
- */
2331
- sendMessage: (channelId: BigString, options: CreateMessageOptions) => Promise<Camelize<DiscordMessage>>;
2332
- /**
2333
- * Sends a follow-up message to an interaction.
2334
- *
2335
- * @param token - The interaction token to use, provided in the original interaction.
2336
- * @param options - The parameters for the creation of the message.
2337
- * @returns An instance of the created {@link DiscordMessage}.
2338
- *
2339
- * @remarks
2340
- * ⚠️ Interaction tokens are only valid for _15 minutes_.
2341
- *
2342
- * By default, mentions are suppressed. To enable mentions, pass a mention object with the callback data.
2343
- *
2344
- * Unlike `sendMessage()`, this endpoint allows the bot user to act without:
2345
- * - Needing to be able to see the contents of the channel that the message is in. (`READ_MESSAGES` permission.)
2346
- * - Requiring the `MESSAGE_CONTENT` intent.
2347
- *
2348
- * 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
2349
- * You can check if it was initiated from a user-installed app that isn't installed in the server by checking if {@link DiscordInteraction.authorizing_integration_owners | authorizingIntegrationOwners} only contains {@link DiscordApplicationIntegrationType.UserInstall | UserInstall}.
2350
- *
2351
- * Fires a _Message Create_ event.
2352
- *
2353
- * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message}
2354
- */
2355
- sendFollowupMessage: (token: string, options: InteractionCallbackData) => Promise<Camelize<DiscordMessage>>;
2356
- /**
2357
- * Sends a response to an interaction.
2358
- *
2359
- * @param interactionId - The ID of the interaction to respond to.
2360
- * @param token - The interaction token to use, provided in the original interaction.
2361
- * @param options - The parameters for the creation of the message.
2362
- * @param params - The query parameters for the response of the callback
2363
- * @returns Nothing or the {@link DiscordInteractionCallbackResponse} if withResponse param is true
2364
- *
2365
- * @remarks
2366
- * ⚠️ Interaction tokens are only valid for _15 minutes_.
2367
- *
2368
- * By default, mentions are suppressed. To enable mentions, pass a mention object with the callback data.
2369
- *
2370
- * Unlike `sendMessage()`, this endpoint allows the bot user to act without:
2371
- * - Needing to be able to see the contents of the channel that the message is in. (`READ_MESSAGES` permission.)
2372
- * - Requiring the `MESSAGE_CONTENT` intent.
2373
- *
2374
- * Fires a _Message Create_ event.
2375
- *
2376
- * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
2377
- */
2378
- sendInteractionResponse: (interactionId: BigString, token: string, options: InteractionResponse, params?: InteractionCallbackOptions) => Promise<void | Camelize<DiscordInteractionCallbackResponse>>;
2379
- /**
2380
- * Creates a thread, using an existing message as its point of origin.
2381
- *
2382
- * @param channelId - The ID of the channel in which to create the thread.
2383
- * @param messageId - The ID of the message to use as the thread's point of origin.
2384
- * @param options - The parameters to use for the creation of the thread.
2385
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
2386
- * @returns An instance of the created {@link DiscordChannel}.
2387
- *
2388
- * @remarks
2389
- * If called on a channel of type {@link ChannelTypes}.GuildText, creates a {@link ChannelTypes}.GuildPublicThread.
2390
- * If called on a channel of type {@link ChannelTypes}.GuildNews, creates a {@link ChannelTypes}.GuildNewsThread.
2391
- * Does not work on channels of type {@link ChannelTypes}.GuildForum.
2392
- *
2393
- * The ID of the created thread will be the same as the ID of the source message.
2394
- *
2395
- * Fires a _Thread Create_ gateway event.
2396
- *
2397
- * @see {@link https://discord.com/developers/docs/resources/channel#start-thread-from-message}
2398
- */
2399
- startThreadWithMessage: (channelId: BigString, messageId: BigString, options: StartThreadWithMessage, reason?: string) => Promise<Camelize<DiscordChannel>>;
2400
- /**
2401
- * Creates a thread without using a message as the thread's point of origin.
2402
- *
2403
- * @param channelId - The ID of the channel in which to create the thread.
2404
- * @param options - The parameters to use for the creation of the thread.
2405
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
2406
- * @returns An instance of the created {@link DiscordChannel | Thread}.
2407
- *
2408
- * @remarks
2409
- * Creating a private thread requires the server to be boosted.
2410
- *
2411
- * Fires a _Thread Create_ gateway event.
2412
- *
2413
- * @see {@link https://discord.com/developers/docs/resources/channel#start-thread-without-message}
2414
- */
2415
- startThreadWithoutMessage: (channelId: BigString, options: StartThreadWithoutMessage, reason?: string) => Promise<Camelize<DiscordChannel>>;
2416
- /**
2417
- * Get a list of users that voted for this specific answer.
2418
- *
2419
- * @param channelId - The ID of the channel in which the message with the poll lives
2420
- * @param messageId - The ID of the message in which the poll lives
2421
- * @param answerId - The ID of the answer to get the users that voted that answer
2422
- * @param options - The options for the request
2423
- * @returns The list of users that voted for the specific answer.
2424
- */
2425
- getPollAnswerVoters: (channelId: BigString, messageId: BigString, answerId: number, options?: GetPollAnswerVotes) => Promise<Camelize<DiscordGetAnswerVotesResponse>>;
2426
- /**
2427
- * Immediately ends the poll.
2428
- *
2429
- * @param channelId - The ID of the channel in which the message with the poll lives
2430
- * @param messageId - The ID of the message in which the poll lives
2431
- * @returns The message with the expired poll
2432
- *
2433
- * @remarks
2434
- * You cannot end polls from other users.
2435
- *
2436
- * Fires a _Message Update_ gateway event
2437
- */
2438
- endPoll: (channelId: BigString, messageId: BigString) => Promise<Camelize<DiscordMessage>>;
2439
- /**
2440
- * Synchronises a template with the current state of a guild.
2441
- *
2442
- * @param guildId - The ID of the guild to synchronise a template of.
2443
- * @returns An instance of the edited {@link DiscordTemplate}.
2444
- *
2445
- * @remarks
2446
- * Requires the `MANAGE_GUILD` permission.
2447
- *
2448
- * Fires a _Guild Update_ gateway event.
2449
- *
2450
- * @see {@link https://discord.com/developers/docs/resources/guild-template#get-guild-templates}
2451
- */
2452
- syncGuildTemplate: (guildId: BigString) => Promise<Camelize<DiscordTemplate>>;
2453
- /**
2454
- * Triggers a typing indicator for the specified channel, which expires after 10 seconds.
2455
- *
2456
- * @param channelId - The ID of the channel in which to trigger the typing indicator.
2457
- *
2458
- * @remarks
2459
- * Generally bots should **not** use this route.
2460
- * However, if a bot is responding to a command and expects the computation to take a few seconds,
2461
- * this endpoint may be called to let the user know that the bot is processing their message.
2462
- *
2463
- * Fires a _Typing Start_ gateway event.
2464
- *
2465
- * @see {@link https://discord.com/developers/docs/resources/channel#trigger-typing-indicator}
2466
- */
2467
- triggerTypingIndicator: (channelId: BigString) => Promise<void>;
2468
- /**
2469
- * Re-registers the list of global application commands, overwriting the previous commands completely.
2470
- *
2471
- * @param commands - The list of commands to use to overwrite the previous list.
2472
- * @param options - Additional options for the endpoint.
2473
- * @returns A collection of {@link DiscordApplicationCommand} objects assorted by command ID.
2474
- *
2475
- * @remarks
2476
- * ❗ Commands that are not present in the `commands` array will be __deleted__.
2477
- *
2478
- * ⚠️ Commands that do not already exist will count towards the daily limit of _200_ new commands.
2479
- *
2480
- * When using the bearer token the token needs the `applications.commands.update` scope and must be a `Client grant` token.
2481
- * You will be able to update only your own application commands
2482
- *
2483
- * @see {@link https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands}
2484
- */
2485
- upsertGlobalApplicationCommands: (commands: CreateApplicationCommand[], options?: UpsertGlobalApplicationCommandOptions) => Promise<Camelize<DiscordApplicationCommand>[]>;
2486
- /**
2487
- * Re-registers the list of application commands registered in a guild, overwriting the previous commands completely.
2488
- *
2489
- * @param guildId - The ID of the guild whose list of commands to overwrite.
2490
- * @param commands - The list of commands to use to overwrite the previous list.
2491
- * @param options - Additional options for the endpoint.
2492
- * @returns A collection of {@link DiscordApplicationCommand} objects assorted by command ID.
2493
- *
2494
- * @remarks
2495
- * ❗ Commands that are not present in the `commands` array will be __deleted__.
2496
- *
2497
- * ⚠️ Commands that do not already exist will count towards the daily limit of _200_ new commands.
2498
- *
2499
- * When using the bearer token the token needs the `applications.commands.update` scope and must be a `Client grant` token.
2500
- * You will be able to update only your own application commands
2501
- *
2502
- * @see {@link https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands}
2503
- */
2504
- upsertGuildApplicationCommands: (guildId: BigString, commands: CreateApplicationCommand[], options?: UpsertGuildApplicationCommandOptions) => Promise<Camelize<DiscordApplicationCommand>[]>;
2505
- /**
2506
- * Bans a user from a guild.
2507
- *
2508
- * @param guildId - The ID of the guild to ban the user from.
2509
- * @param userId - The ID of the user to ban from the guild.
2510
- * @param options - The parameters for the creation of the ban.
2511
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
2512
- *
2513
- * @remarks
2514
- * Requires the `BAN_MEMBERS` permission.
2515
- *
2516
- * Fires a _Guild Ban Add_ gateway event.
2517
- *
2518
- * @see {@link https://discord.com/developers/docs/resources/guild#create-guild-ban}
2519
- */
2520
- banMember: (guildId: BigString, userId: BigString, options?: CreateGuildBan, reason?: string) => Promise<void>;
2521
- /**
2522
- * Bans up to 200 users from a guild.
2523
- *
2524
- * @param guildId - The ID of the guild to ban the users from.
2525
- * @param options - The users to ban and the other options for the ban.
2526
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
2527
- *
2528
- * @remarks
2529
- * Requires the `BAN_MEMBERS` and `MANAGE_GUILD` permissions.
2530
- *
2531
- * If all provided users fail to be banned, discord will respond with an error (code: `500000: Failed to ban users`)
2532
- *
2533
- * Fires as many _Guild Ban Add_ gateway events as many user where banned.
2534
- *
2535
- * @see {@link https://discord.com/developers/docs/resources/guild#bulk-guild-ban}
2536
- */
2537
- bulkBanMembers: (guildId: BigString, options: CreateGuildBulkBan, reason?: string) => Promise<Camelize<DiscordBulkBan>>;
2538
- /**
2539
- * Edits the nickname of the bot user.
2540
- *
2541
- * @param guildId - The ID of the guild to edit the nickname of the bot user in.
2542
- * @param options - The parameters for the edit of the nickname.
2543
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
2544
- * @returns An instance of the edited {@link DiscordMember}
2545
- *
2546
- * @remarks
2547
- * Fires a _Guild Member Update_ gateway event.
2548
- *
2549
- * @see {@link https://discord.com/developers/docs/resources/guild#modify-current-member}
2550
- */
2551
- editBotMember: (guildId: BigString, options: EditBotMemberOptions, reason?: string) => Promise<Camelize<DiscordMember>>;
2552
- /**
2553
- * Edits a member's properties.
2554
- *
2555
- * @param guildId - The ID of the guild to edit the member of.
2556
- * @param userId - The user ID of the member to edit.
2557
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
2558
- * @param options - The parameters for the edit of the user.
2559
- *
2560
- * @remarks
2561
- * This endpoint requires various permissions depending on what is edited about the member.
2562
- * To find out the required permission to enact a change, read the documentation of this endpoint's {@link ModifyGuildMember | parameters}.
2563
- *
2564
- * Fires a _Guild Member Update_ gateway event.
2565
- *
2566
- * @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-member}
2567
- */
2568
- editMember: (guildId: BigString, userId: BigString, options: ModifyGuildMember, reason?: string) => Promise<Camelize<DiscordMember>>;
2569
- /**
2570
- * Gets the member object by user ID.
2571
- *
2572
-
2573
- * @param guildId - The ID of the guild to get the member object for.
2574
- * @param userId - The ID of the user to get the member object for.
2575
- * @returns An instance of {@link DiscordMemberWithUser}.
2576
- *
2577
- * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-member}
2578
- */
2579
- getMember: (guildId: BigString, userId: BigString) => Promise<Camelize<DiscordMemberWithUser>>;
2580
- /**
2581
- * Gets the current member object.
2582
- *
2583
- * @param bearerToken - The access token of the user
2584
- * @param guildId - The ID of the guild to get the member object for.
2585
- * @returns An instance of {@link DiscordMemberWithUser}.
2586
- *
2587
- * @remarks
2588
- * The access tokens needs the `guilds.members.read` scope
2589
- *
2590
- * @see {@link https://discord.com/developers/docs/resources/user#get-current-user-guild-member}
2591
- */
2592
- getCurrentMember: (guildId: BigString, bearerToken: string) => Promise<Camelize<DiscordMemberWithUser>>;
2593
- /**
2594
- * Gets the list of members for a guild.
2595
- *
2596
- * @param guildId - The ID of the guild to get the list of members for.
2597
- * @param options - The parameters for the fetching of the members.
2598
- * @returns A collection of {@link DiscordMemberWithUser} objects assorted by user ID.
2599
- *
2600
- * @remarks
2601
- * Requires the `GUILD_MEMBERS` intent.
2602
- *
2603
- * ⚠️ It is not recommended to use this endpoint with very large bots. Instead, opt to use `fetchMembers()`:
2604
- * REST communication only permits 50 requests to be made per second, while gateways allow for up to 120 requests
2605
- * per minute per shard. For more information, read {@link https://discord.com/developers/docs/topics/rate-limits#rate-limits}.
2606
- *
2607
- * @see {@link https://discord.com/developers/docs/resources/guild#list-guild-members}
2608
- * @see {@link https://discord.com/developers/docs/topics/gateway#request-guild-members}
2609
- * @see {@link https://discord.com/developers/docs/topics/rate-limits#rate-limits}
2610
- */
2611
- getMembers: (guildId: BigString, options: ListGuildMembers) => Promise<Camelize<DiscordMemberWithUser>[]>;
2612
- /**
2613
- * Returns a serialized activity instance, if it exists. Useful for preventing unwanted activity sessions.
2614
- *
2615
- * @param applicationId - The ID of the application
2616
- * @param instanceId - The ID of the activity instance
2617
- */
2618
- getApplicationActivityInstance: (applicationId: BigString, instanceId: string) => Promise<Camelize<DiscordActivityInstance>>;
2619
- /**
2620
- * Kicks a member from a guild.
2621
- *
2622
-
2623
- * @param guildId - The ID of the guild to kick the member from.
2624
- * @param userId - The user ID of the member to kick from the guild.
2625
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
2626
- *
2627
- * @remarks
2628
- * Requires the `KICK_MEMBERS` permission.
2629
- *
2630
- * Fires a _Guild Member Remove_ gateway event.
2631
- *
2632
- * @see {@link https://discord.com/developers/docs/resources/guild#remove-guild-member}
2633
- */
2634
- kickMember: (guildId: BigString, userId: BigString, reason?: string) => Promise<void>;
2635
- /**
2636
- * Pins a message in a channel.
2637
- *
2638
- * @param channelId - The ID of the channel where the message is to be pinned.
2639
- * @param messageId - The ID of the message to pin.
2640
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
2641
- *
2642
- * @remarks
2643
- * Requires the `PIN_MESSAGES` permission.
2644
- *
2645
- * Fires a _Channel Pins Update_ event.
2646
- *
2647
- * @see {@link https://discord.com/developers/docs/resources/message#pin-message}
2648
- */
2649
- pinMessage: (channelId: BigString, messageId: BigString, reason?: string) => Promise<void>;
2650
- /**
2651
- * Initiates the process of pruning inactive members.
2652
- *
2653
-
2654
- * @param guildId - The ID of the guild to prune the members of.
2655
- * @param options - The parameters for the pruning of members.
2656
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
2657
- * @returns A number indicating how many members were pruned.
2658
- *
2659
- * @remarks
2660
- * Requires the `MANAGE_GUILD` and `KICK_MEMBERS` permissions.
2661
- *
2662
- * ❗ Requests to this endpoint will time out for large guilds. To prevent this from happening, set the {@link 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.
2663
- *
2664
- * ⚠️ 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 {@link BeginGuildPrune.includeRoles | includeRoles} property of the options object parameter.
2665
- *
2666
- * Fires a _Guild Member Remove_ gateway event for every member kicked.
2667
- *
2668
- * @see {@link https://discord.com/developers/docs/resources/guild#begin-guild-prune}
2669
- */
2670
- pruneMembers: (guildId: BigString, options: BeginGuildPrune, reason?: string) => Promise<{
2671
- pruned: number | null;
2672
- }>;
2673
- /**
2674
- * Gets the list of members whose usernames or nicknames start with a provided string.
2675
- *
2676
-
2677
- * @param guildId - The ID of the guild to search in.
2678
- * @param query - The string to match usernames or nicknames against.
2679
- * @param options - The parameters for searching through the members.
2680
- * @returns A collection of {@link DiscordMember} objects assorted by user ID.
2681
- *
2682
- * @see {@link https://discord.com/developers/docs/resources/guild#search-guild-members}
2683
- */
2684
- searchMembers: (guildId: BigString, query: string, options?: Omit<SearchMembers, 'query'>) => Promise<Camelize<DiscordMemberWithUser>[]>;
2685
- /**
2686
- * Unbans a user from a guild.
2687
- *
2688
-
2689
- * @param guildId - The ID of the guild to unban the user in.
2690
- * @param userId - The ID of the user to unban.
2691
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
2692
- *
2693
- * @remarks
2694
- * Requires the `BAN_MEMBERS` permission.
2695
- *
2696
- * Fires a _Guild Ban Remove_ gateway event.
2697
- *
2698
- * @see {@link https://discord.com/developers/docs/resources/guild#remove-guild-ban}
2699
- */
2700
- unbanMember: (guildId: BigString, userId: BigString, reason?: string) => Promise<void>;
2701
- /**
2702
- * Unpin a message in a channel.
2703
- *
2704
- * @param channelId - The ID of the channel where the message is pinned.
2705
- * @param messageId - The ID of the message to unpin.
2706
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
2707
- *
2708
- * @remarks
2709
- * Requires the `PIN_MESSAGES` permission.
2710
- *
2711
- * Fires a _Channel Pins Update_ event.
2712
- *
2713
- * @see {@link https://discord.com/developers/docs/resources/message#unpin-message}
2714
- */
2715
- unpinMessage: (channelId: BigString, messageId: BigString, reason?: string) => Promise<void>;
2716
- /**
2717
- * Get the guild onboarding
2718
- *
2719
- * @param guildId - The guild to get the onboarding from
2720
- */
2721
- getGuildOnboarding: (guildId: BigString) => Promise<Camelize<DiscordGuildOnboarding>>;
2722
- /**
2723
- * Modifies the onboarding configuration of the guild.
2724
- *
2725
- * @param guildId - The guild to edit the onboarding from
2726
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
2727
- *
2728
- * @remarks
2729
- * Requires the `MANAGE_GUILD` and `MANAGE_ROLES` permissions.
2730
- *
2731
- * Onboarding enforces constraints when enabled. These constraints are:
2732
- * - at least 7 default channels
2733
- * - at least 5 of the 7 channels must allow sending messages to the \@everyone role
2734
- *
2735
- * The `mode` field modifies what is considered when enforcing these constraints.
2736
- */
2737
- editGuildOnboarding: (guildId: BigString, options: EditGuildOnboarding, reason?: string) => Promise<Camelize<DiscordGuildOnboarding>>;
2738
- /**
2739
- * Modifies the incident actions of the guild.
2740
- *
2741
- * @param guildId - The guild to edit the incident actions from
2742
- * @param options - The options for the incident actions
2743
- *
2744
- * @remarks
2745
- * Requires the `MANAGE_GUILD` permission.
2746
- */
2747
- modifyGuildIncidentActions: (guildId: BigString, options: ModifyGuildIncidentActions) => Promise<Camelize<DiscordIncidentsData>>;
2748
- /**
2749
- * Returns all entitlements for a given app, active and expired.
2750
- *
2751
- * @param applicationId - The id of the application to get the entitlements
2752
- * @param {GetEntitlements} [options] - The optional query params for the endpoint
2753
- */
2754
- listEntitlements: (applicationId: BigString, options?: GetEntitlements) => Promise<Camelize<DiscordEntitlement>[]>;
2755
- /**
2756
- * Returns an entitlement.
2757
- *
2758
- * @param applicationId - The id of the application to get the entitlement
2759
- * @param entitlementId - The id of the entitlement to get
2760
- */
2761
- getEntitlement: (applicationId: BigString, entitlementId: BigString) => Promise<Camelize<DiscordEntitlement>>;
2762
- /**
2763
- * 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.
2764
- *
2765
- * @param applicationId - The id of the application to create the entitlement
2766
- * @param body - The options for new entitlement
2767
- *
2768
- * @remarks
2769
- * This endpoint returns a partial entitlement object.
2770
- * It will not contain subscription_id, starts_at, or ends_at, as it's valid in perpetuity.
2771
- */
2772
- createTestEntitlement: (applicationId: BigString, body: CreateTestEntitlement) => Promise<Partial<Camelize<DiscordEntitlement>>>;
2773
- /**
2774
- * Deletes a currently-active test entitlement. Discord will act as though that user or guild no longer has entitlement to your premium offering.
2775
- *
2776
- * @param applicationId - The id of the application from where delete the entitlement
2777
- * @param entitlementId - The id of the entitlement to delete
2778
- */
2779
- deleteTestEntitlement: (applicationId: BigString, entitlementId: BigString) => Promise<void>;
2780
- /**
2781
- * For One-Time Purchase consumable SKUs, marks a given entitlement for the user as consumed. The entitlement will have `consumed: true` when using {@link listEntitlements | List Entitlements}
2782
- *
2783
- * @param applicationId - The id of the application to get the entitlement
2784
- * @param entitlementId - The id of the entitlement to get
2785
- */
2786
- consumeEntitlement: (applicationId: BigString, entitlementId: BigString) => Promise<void>;
2787
- /**
2788
- * Returns all SKUs for a given application
2789
- *
2790
- * @param applicationId - The id of the application to get the SKUs
2791
- */
2792
- listSkus: (applicationId: BigString) => Promise<Camelize<DiscordSku>[]>;
2793
- /**
2794
- * Returns all subscriptions containing the SKU, filtered by user.
2795
- *
2796
- * @param skuId - The id of the sku of get the subscriptions for
2797
- */
2798
- listSubscriptions: (skuId: BigString, options?: ListSkuSubscriptionsOptions) => Promise<Camelize<DiscordSubscription[]>>;
2799
- /**
2800
- * Get a subscription by its ID.
2801
- *
2802
- * @param skuId - The id of the sku of get the subscriptions for
2803
- */
2804
- getSubscription: (skuId: BigString, subscriptionId: BigString) => Promise<Camelize<DiscordSubscription>>;
2805
- /**
2806
- * Send a soundboard sound to a voice channel the user is connected to.
2807
- *
2808
- * @param channelId - The id of the voice channel
2809
- *
2810
- * @remarks
2811
- * Fires a _Voice Channel Effect Send_ Gateway event.
2812
- *
2813
- * Requires the `SPEAK` and `USE_SOUNDBOARD` permissions, and also the `USE_EXTERNAL_SOUNDS` permission if the sound is from a different server.
2814
- * Additionally, requires the user to be connected to the voice channel, having a voice state without `deaf`, `self_deaf`, `mute`, or `suppress` enabled.
2815
- */
2816
- sendSoundboardSound: (channelId: BigString, options: SendSoundboardSound) => Promise<void>;
2817
- /** Returns an array of soundboard sound objects that can be used by all users. */
2818
- listDefaultSoundboardSounds: () => Promise<Camelize<DiscordSoundboardSound>[]>;
2819
- /**
2820
- * Returns a list of the guild's soundboard sounds.
2821
- *
2822
- * @param guildId - The guild to get the sounds from
2823
- *
2824
- * @remarks
2825
- * Includes `user` fields if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
2826
- */
2827
- listGuildSoundboardSounds: (guildId: BigString) => Promise<{
2828
- items: Camelize<DiscordSoundboardSound>[];
2829
- }>;
2830
- /**
2831
- * Returns a soundboard sound object for the given sound id.
2832
- *
2833
- * @param guildId - The guild to get the sounds from
2834
- * @param soundId - The sound id
2835
- *
2836
- * @remarks
2837
- * Includes `user` fields if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
2838
- */
2839
- getGuildSoundboardSound: (guildId: BigString, soundId: BigString) => Promise<Camelize<DiscordSoundboardSound>>;
2840
- /**
2841
- * Create a new soundboard sound for the guild.
2842
- *
2843
- * @param guildId - The guild to create the sounds in
2844
- * @param options - The options to create the sound
2845
- * @param reason - The audit log reason
2846
- *
2847
- * @remarks
2848
- * Fires a _Guild Soundboard Sound Create_ Gateway event.
2849
- *
2850
- * Requires the `CREATE_GUILD_EXPRESSIONS` permission.
2851
- */
2852
- createGuildSoundboardSound: (guildId: BigString, options: CreateGuildSoundboardSound, reason?: string) => Promise<Camelize<DiscordSoundboardSound>>;
2853
- /**
2854
- * Modify the given soundboard sound.
2855
- *
2856
- * @param guildId - The guild to create the sounds in
2857
- * @param soundId - The sound id to update
2858
- * @param options - The options to update the sound
2859
- * @param reason - The audit log reason
2860
- *
2861
- * @remarks
2862
- * Fires a _Guild Soundboard Sound Update_ Gateway event.
2863
- *
2864
- * For sounds created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
2865
- * For other sounds, requires the `MANAGE_GUILD_EXPRESSIONS` permission.
2866
- */
2867
- modifyGuildSoundboardSound: (guildId: BigString, soundId: BigString, options: ModifyGuildSoundboardSound, reason?: string) => Promise<Camelize<DiscordSoundboardSound>>;
2868
- /**
2869
- * Delete the given soundboard sound.
2870
- *
2871
- * @param guildId - The guild to create the sounds in
2872
- * @param soundId - The sound id to delete
2873
- * @param reason - The audit log reason
2874
- *
2875
- * @remarks
2876
- * Fires a _Guild Soundboard Sound Delete_ Gateway event.
2877
- *
2878
- * For sounds created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
2879
- * For other sounds, requires the `MANAGE_GUILD_EXPRESSIONS` permission.
2880
- */
2881
- deleteGuildSoundboardSound: (guildId: BigString, soundId: BigString, reason?: string) => Promise<void>;
2882
- /**
2883
- * Returns a list of application role connection metadata objects for the given application.
2884
- *
2885
- * @param applicationId - The application to get the role connections from
2886
- * @returns A list of application role connection metadata objects
2887
- */
2888
- listApplicationRoleConnectionsMetadataRecords: (applicationId: BigString) => Promise<Camelize<DiscordApplicationRoleConnectionMetadata>[]>;
2889
- /**
2890
- * Updates and returns a list of application role connection metadata objects for the given application.
2891
- *
2892
- * @param applicationId - The application to get the role connections from
2893
- * @param options - The options to update the role connections
2894
- * @returns A list of application role connection metadata objects
2895
- *
2896
- * @remarks
2897
- * An application can have a maximum of 5 metadata records.
2898
- */
2899
- updateApplicationRoleConnectionsMetadataRecords: (applicationId: BigString, options: Camelize<DiscordApplicationRoleConnectionMetadata>[]) => Promise<Camelize<DiscordApplicationRoleConnectionMetadata>[]>;
2900
- /**
2901
- * Creates a new lobby, adding any of the specified members to it, if provided.
2902
- *
2903
- * @param options - The options to create the lobby
2904
- * @returns The created lobby
2905
- */
2906
- createLobby: (options: CreateLobby) => Promise<Camelize<DiscordLobby>>;
2907
- /**
2908
- * Returns a lobby object for the specified lobby id, if it exists.
2909
- *
2910
- * @param lobbyId - The ID of the lobby to get
2911
- * @returns The lobby object
2912
- */
2913
- getLobby: (lobbyId: BigString) => Promise<Camelize<DiscordLobby>>;
2914
- /**
2915
- * Modifies the specified lobby with new values, if provided.
2916
- *
2917
- * @param lobbyId - The ID of the lobby to modify
2918
- * @param options - The options to modify the lobby
2919
- * @returns The modified lobby
2920
- */
2921
- modifyLobby: (lobbyId: BigString, options: ModifyLobby) => Promise<Camelize<DiscordLobby>>;
2922
- /**
2923
- * Deletes the specified lobby if it exists.
2924
- *
2925
- * It is safe to call even if the lobby is already deleted as well.
2926
- *
2927
- * @param lobbyId - The ID of the lobby to delete
2928
- * @returns Nothing
2929
- */
2930
- deleteLobby: (lobbyId: BigString) => Promise<void>;
2931
- /**
2932
- * 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.
2933
- *
2934
- * @param lobbyId - The ID of the lobby to add the user to
2935
- * @param userId - The ID of the user to add to the lobby
2936
- * @param options - The options to add the user to the lobby
2937
- * @returns The lobby member object
2938
- */
2939
- addMemberToLobby: (lobbyId: BigString, userId: BigString, options: AddLobbyMember) => Promise<Camelize<DiscordLobbyMember>>;
2940
- /**
2941
- * 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.
2942
- *
2943
- * @param lobbyId - The ID of the lobby to remove the user from
2944
- * @param userId - The ID of the user to remove from the lobby
2945
- * @returns Nothing
2946
- */
2947
- removeMemberFromLobby: (lobbyId: BigString, userId: BigString) => Promise<void>;
2948
- /**
2949
- * 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.
2950
- *
2951
- * @param lobbyId - The ID of the lobby to remove the user from
2952
- * @param bearerToken - The access token of the user
2953
- * @returns Nothing
2954
- *
2955
- * @remarks
2956
- * This requires a bearer token for authorization
2957
- */
2958
- leaveLobby: (lobbyId: BigString, bearerToken: string) => Promise<void>;
2959
- /**
2960
- * Links an existing text channel to a lobby.
2961
- *
2962
- * @param lobbyId - The ID of the lobby to link the channel to
2963
- * @param bearerToken - The access token of the user
2964
- * @param options - The options to link the channel to the lobby
2965
- * @returns The updated lobby object
2966
- *
2967
- * @remarks
2968
- * Uses bearer token for authorization and the user must be a lobby member with the CanLinkLobby lobby member flag.
2969
- */
2970
- linkChannelToLobby: (lobbyId: BigString, bearerToken: string, options: LinkChannelToLobby) => Promise<Camelize<DiscordLobby>>;
2971
- /**
2972
- * Unlinks any currently linked channels from the specified lobby.
2973
- *
2974
- * @param lobbyId - The ID of the lobby to unlink the channel from
2975
- * @param bearerToken - The access token of the user
2976
- * @returns The updated lobby object
2977
- *
2978
- * @remarks
2979
- * Uses bearer token for authorization and the user must be a lobby member with the CanLinkLobby lobby member flag.
2980
- */
2981
- unlinkChannelToLobby: (lobbyId: BigString, bearerToken: string) => Promise<Camelize<DiscordLobby>>;
2982
- }
2983
- export type RequestMethods = 'GET' | 'POST' | 'DELETE' | 'PATCH' | 'PUT';
2984
- export type ApiVersions = 9 | 10;
2985
- export interface CreateRequestBodyOptions {
2986
- headers?: Record<string, string>;
2987
- body?: any;
2988
- unauthorized?: boolean;
2989
- reason?: string;
2990
- files?: FileContent[];
2991
- }
2992
- export type MakeRequestOptions = Omit<CreateRequestBodyOptions, 'method'> & Pick<SendRequestOptions, 'runThroughQueue'>;
2993
- export interface RequestBody {
2994
- headers: Record<string, string>;
2995
- body?: string | FormData;
2996
- method: RequestMethods;
2997
- }
2998
- export interface SendRequestOptions {
2999
- /** The route to send the request to. */
3000
- route: string;
3001
- /** The method to use for sending the request. */
3002
- method: RequestMethods;
3003
- /** The amount of times this request has been retried. */
3004
- retryCount: number;
3005
- /** Handler to retry a request should it be rate limited. */
3006
- retryRequest?: (options: SendRequestOptions) => Promise<void>;
3007
- /** Resolve handler when a request succeeds. */
3008
- resolve: (value: RestRequestResponse) => void;
3009
- /** Reject handler when a request fails. */
3010
- reject: (value: RestRequestRejection) => void;
3011
- /** If this request has a bucket id which it falls under for rate limit */
3012
- bucketId?: string;
256
+ simplifiedUrl?: string;
3013
257
  /** Additional request options, used for things like overriding authorization header. */
3014
258
  requestBodyOptions?: CreateRequestBodyOptions;
3015
259
  /**
@@ -3037,6 +281,7 @@ export interface RestRequestRejection {
3037
281
  /** The returned body parsed if it was JSON, otherwise it will be the raw body as a string */
3038
282
  body?: string | object;
3039
283
  error?: string;
284
+ errorObject?: Error;
3040
285
  }
3041
286
  export interface RestManagerEvents {
3042
287
  /**