@discordeno/rest 22.0.1-next.fca3cbb → 22.0.1-next.fdb61e1

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