@discordeno/rest 19.0.0-next.8bb91fa → 19.0.0-next.8d1ba2a
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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/invalidBucket.d.ts +6 -7
- package/dist/invalidBucket.d.ts.map +1 -1
- package/dist/invalidBucket.js +23 -25
- package/dist/invalidBucket.js.map +1 -1
- package/dist/manager.d.ts +9 -0
- package/dist/manager.d.ts.map +1 -1
- package/dist/manager.js +504 -830
- package/dist/manager.js.map +1 -1
- package/dist/queue.js +1 -1
- package/dist/queue.js.map +1 -1
- package/dist/routes.d.ts +3 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +487 -0
- package/dist/routes.js.map +1 -0
- package/dist/types.d.ts +120 -60
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/typings/routes.d.ts +0 -2
- package/dist/typings/routes.d.ts.map +1 -1
- package/dist/typings/routes.js.map +1 -1
- package/package.json +5 -6
package/dist/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ApplicationCommandPermissions, AtLeastOne, BeginGuildPrune, BigString, Camelize,
|
|
1
|
+
import type { ApplicationCommandPermissions, AtLeastOne, BeginGuildPrune, BigString, Camelize, CamelizedDiscordActiveThreads, CamelizedDiscordApplication, CamelizedDiscordApplicationCommand, CamelizedDiscordArchivedThreads, CamelizedDiscordAuditLog, CamelizedDiscordAutoModerationRule, CamelizedDiscordBan, CamelizedDiscordChannel, CamelizedDiscordEmoji, CamelizedDiscordFollowedChannel, CamelizedDiscordGetGatewayBot, CamelizedDiscordGuild, CamelizedDiscordGuildApplicationCommandPermissions, CamelizedDiscordGuildPreview, CamelizedDiscordGuildWidget, CamelizedDiscordGuildWidgetSettings, CamelizedDiscordIntegration, CamelizedDiscordInvite, CamelizedDiscordInviteMetadata, CamelizedDiscordMember, CamelizedDiscordMemberWithUser, CamelizedDiscordMessage, CamelizedDiscordModifyGuildWelcomeScreen, CamelizedDiscordPrunedCount, CamelizedDiscordRole, CamelizedDiscordScheduledEvent, CamelizedDiscordStageInstance, CamelizedDiscordSticker, CamelizedDiscordStickerPack, CamelizedDiscordTemplate, CamelizedDiscordThreadMember, CamelizedDiscordUser, CamelizedDiscordVanityUrl, CamelizedDiscordVoiceRegion, CamelizedDiscordWebhook, CamelizedDiscordWelcomeScreen, CreateApplicationCommand, CreateAutoModerationRuleOptions, CreateChannelInvite, CreateForumPostWithMessage, CreateGuild, CreateGuildBan, CreateGuildChannel, CreateGuildEmoji, CreateGuildFromTemplate, CreateGuildRole, CreateGuildStickerOptions, CreateMessageOptions, CreateScheduledEvent, CreateStageInstance, CreateTemplate, DeleteWebhookMessageOptions, EditAutoModerationRuleOptions, EditBotMemberOptions, EditChannelPermissionOverridesOptions, EditGuildRole, EditGuildStickerOptions, EditMessage, EditOwnVoiceState, EditScheduledEvent, EditUserVoiceState, ExecuteWebhook, FileContent, GetBans, GetGuildAuditLog, GetGuildPruneCountQuery, GetInvite, GetMessagesOptions, GetReactions, GetScheduledEvents, GetScheduledEventUsers, GetWebhookMessageOptions, InteractionCallbackData, InteractionResponse, ListArchivedThreads, ListGuildMembers, MfaLevels, ModifyChannel, ModifyGuild, ModifyGuildChannelPositions, ModifyGuildEmoji, ModifyGuildMember, ModifyGuildTemplate, ModifyRolePositions, ModifyWebhook, SearchMembers, StartThreadWithMessage, StartThreadWithoutMessage } from '@discordeno/types';
|
|
2
2
|
import type { InvalidRequestBucket } from './invalidBucket.js';
|
|
3
3
|
import type { Queue } from './queue.js';
|
|
4
4
|
import type { RestRoutes } from './typings/routes.js';
|
|
5
5
|
export interface CreateRestManagerOptions {
|
|
6
6
|
/** The bot token which will be used to make requests. */
|
|
7
|
-
token
|
|
7
|
+
token?: string;
|
|
8
8
|
/**
|
|
9
9
|
* For old bots that have a different bot id and application id.
|
|
10
10
|
* @default bot id from token
|
|
@@ -29,7 +29,7 @@ export interface CreateRestManagerOptions {
|
|
|
29
29
|
}
|
|
30
30
|
export interface RestManager {
|
|
31
31
|
/** The bot token which will be used to make requests. */
|
|
32
|
-
token
|
|
32
|
+
token?: string;
|
|
33
33
|
/** 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. */
|
|
34
34
|
applicationId: bigint;
|
|
35
35
|
/** The api version to use when making requests. Only the latest supported version will be tested. */
|
|
@@ -40,6 +40,12 @@ export interface RestManager {
|
|
|
40
40
|
* @default https://discord.com/api
|
|
41
41
|
*/
|
|
42
42
|
baseUrl: string;
|
|
43
|
+
/**
|
|
44
|
+
* `true` if the `baseUrl` does not start with `https://discord.com/api`.
|
|
45
|
+
*
|
|
46
|
+
* Mostly used only for intern functions.
|
|
47
|
+
*/
|
|
48
|
+
isProxied: boolean;
|
|
43
49
|
/** The authorization header to attach when sending requests to the proxy. */
|
|
44
50
|
authorization?: string;
|
|
45
51
|
/** The maximum amount of times a request should be retried. Defaults to Infinity */
|
|
@@ -58,12 +64,14 @@ export interface RestManager {
|
|
|
58
64
|
invalidBucket: InvalidRequestBucket;
|
|
59
65
|
/** The routes that are available for this manager. */
|
|
60
66
|
routes: RestRoutes;
|
|
67
|
+
/** Whether or not the rest manager should keep objects in raw snake case from discord. */
|
|
68
|
+
preferSnakeCase: (enabled: boolean) => RestManager;
|
|
61
69
|
/** Check the rate limits for a url or a bucket. */
|
|
62
70
|
checkRateLimits: (url: string) => number | false;
|
|
63
71
|
/** Reshapes and modifies the obj as needed to make it ready for discords api. */
|
|
64
72
|
changeToDiscordFormat: (obj: any) => any;
|
|
65
73
|
/** Creates the request body and headers that are necessary to send a request. Will handle different types of methods and everything necessary for discord. */
|
|
66
|
-
|
|
74
|
+
createRequestBody: (method: RequestMethods, options?: CreateRequestBodyOptions) => RequestBody;
|
|
67
75
|
/** 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. */
|
|
68
76
|
processRateLimitedPaths: () => void;
|
|
69
77
|
/** Processes the rate limit headers and determines if it needs to be rate limited and returns the bucket id if available */
|
|
@@ -73,19 +81,19 @@ export interface RestManager {
|
|
|
73
81
|
/** Split a url to separate rate limit buckets based on major/minor parameters. */
|
|
74
82
|
simplifyUrl: (url: string, method: RequestMethods) => string;
|
|
75
83
|
/** Make a request to be sent to the api. */
|
|
76
|
-
makeRequest: <T = unknown>(method: RequestMethods, url: string,
|
|
84
|
+
makeRequest: <T = unknown>(method: RequestMethods, url: string, options?: MakeRequestOptions) => Promise<T>;
|
|
77
85
|
/** Takes a request and processes it into a queue. */
|
|
78
|
-
processRequest: (request: SendRequestOptions) => void
|
|
86
|
+
processRequest: (request: SendRequestOptions) => Promise<void>;
|
|
79
87
|
/** Make a get request to the api */
|
|
80
|
-
get: <T = void>(url: string) => Promise<Camelize<T>>;
|
|
88
|
+
get: <T = void>(url: string, options?: Omit<MakeRequestOptions, 'body'>) => Promise<Camelize<T>>;
|
|
81
89
|
/** Make a post request to the api. */
|
|
82
|
-
post: <T = void>(url: string,
|
|
90
|
+
post: <T = void>(url: string, options?: MakeRequestOptions) => Promise<Camelize<T>>;
|
|
83
91
|
/** Make a put request to the api. */
|
|
84
|
-
put: <T = void>(url: string,
|
|
92
|
+
put: <T = void>(url: string, options?: MakeRequestOptions) => Promise<Camelize<T>>;
|
|
85
93
|
/** Make a delete request to the api. */
|
|
86
|
-
delete: (url: string,
|
|
94
|
+
delete: (url: string, options?: Omit<MakeRequestOptions, 'body'>) => Promise<void>;
|
|
87
95
|
/** Make a patch request to the api. */
|
|
88
|
-
patch: <T = void>(url: string,
|
|
96
|
+
patch: <T = void>(url: string, options?: MakeRequestOptions) => Promise<Camelize<T>>;
|
|
89
97
|
/**
|
|
90
98
|
* Adds a reaction to a message.
|
|
91
99
|
*
|
|
@@ -130,6 +138,7 @@ export interface RestManager {
|
|
|
130
138
|
* @param guildId - The ID of the guild the member to add the role to is in.
|
|
131
139
|
* @param userId - The user ID of the member to add the role to.
|
|
132
140
|
* @param roleId - The ID of the role to add to the member.
|
|
141
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
133
142
|
*
|
|
134
143
|
* @remarks
|
|
135
144
|
* Requires the `MANAGE_ROLES` permission.
|
|
@@ -159,6 +168,7 @@ export interface RestManager {
|
|
|
159
168
|
*
|
|
160
169
|
* @param guildId - The ID of the guild to create the rule in.
|
|
161
170
|
* @param options - The parameters for the creation of the rule.
|
|
171
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
162
172
|
* @returns An instance of the created {@link CamelizedDiscordAutoModerationRule}.
|
|
163
173
|
*
|
|
164
174
|
* @remarks
|
|
@@ -168,12 +178,13 @@ export interface RestManager {
|
|
|
168
178
|
*
|
|
169
179
|
* @see {@link https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule}
|
|
170
180
|
*/
|
|
171
|
-
createAutomodRule: (guildId: BigString, options: CreateAutoModerationRuleOptions) => Promise<CamelizedDiscordAutoModerationRule>;
|
|
181
|
+
createAutomodRule: (guildId: BigString, options: CreateAutoModerationRuleOptions, reason?: string) => Promise<CamelizedDiscordAutoModerationRule>;
|
|
172
182
|
/**
|
|
173
183
|
* Creates a channel within a guild.
|
|
174
184
|
*
|
|
175
185
|
* @param guildId - The ID of the guild to create the channel within.
|
|
176
186
|
* @param options - The parameters for the creation of the channel.
|
|
187
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
177
188
|
* @returns An instance of the created {@link CamelizedDiscordChannel}.
|
|
178
189
|
*
|
|
179
190
|
* @remarks
|
|
@@ -187,12 +198,13 @@ export interface RestManager {
|
|
|
187
198
|
*
|
|
188
199
|
* @see {@link https://discord.com/developers/docs/resources/guild#create-guild-channel}
|
|
189
200
|
*/
|
|
190
|
-
createChannel: (guildId: BigString, options: CreateGuildChannel) => Promise<CamelizedDiscordChannel>;
|
|
201
|
+
createChannel: (guildId: BigString, options: CreateGuildChannel, reason?: string) => Promise<CamelizedDiscordChannel>;
|
|
191
202
|
/**
|
|
192
203
|
* Creates an emoji in a guild.
|
|
193
204
|
*
|
|
194
205
|
* @param guildId - The ID of the guild in which to create the emoji.
|
|
195
206
|
* @param options - The parameters for the creation of the emoji.
|
|
207
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
196
208
|
* @returns An instance of the created {@link CamelizedDiscordEmoji}.
|
|
197
209
|
*
|
|
198
210
|
* @remarks
|
|
@@ -204,12 +216,13 @@ export interface RestManager {
|
|
|
204
216
|
*
|
|
205
217
|
* @see {@link https://discord.com/developers/docs/resources/emoji#create-guild-emoji}
|
|
206
218
|
*/
|
|
207
|
-
createEmoji: (guildId: BigString, options: CreateGuildEmoji) => Promise<CamelizedDiscordEmoji>;
|
|
219
|
+
createEmoji: (guildId: BigString, options: CreateGuildEmoji, reason?: string) => Promise<CamelizedDiscordEmoji>;
|
|
208
220
|
/**
|
|
209
221
|
* Creates a new thread in a forum channel, and sends a message within the created thread.
|
|
210
222
|
*
|
|
211
223
|
* @param channelId - The ID of the forum channel to create the thread within.
|
|
212
224
|
* @param options - The parameters for the creation of the thread.
|
|
225
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
213
226
|
* @returns An instance of {@link CamelizedDiscordChannel} with a nested {@link Message} object.
|
|
214
227
|
*
|
|
215
228
|
* @remarks
|
|
@@ -222,7 +235,7 @@ export interface RestManager {
|
|
|
222
235
|
*
|
|
223
236
|
* @experimental
|
|
224
237
|
*/
|
|
225
|
-
createForumThread: (channelId: BigString, options: CreateForumPostWithMessage) => Promise<CamelizedDiscordChannel>;
|
|
238
|
+
createForumThread: (channelId: BigString, options: CreateForumPostWithMessage, reason?: string) => Promise<CamelizedDiscordChannel>;
|
|
226
239
|
/**
|
|
227
240
|
* Creates an application command accessible globally; across different guilds and channels.
|
|
228
241
|
*
|
|
@@ -284,6 +297,7 @@ export interface RestManager {
|
|
|
284
297
|
* Create a new sticker for the guild.
|
|
285
298
|
*
|
|
286
299
|
* @param guildId The ID of the guild to get
|
|
300
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
287
301
|
* @return A {@link CamelizedDiscordSticker}
|
|
288
302
|
*
|
|
289
303
|
* @remarks
|
|
@@ -294,7 +308,7 @@ export interface RestManager {
|
|
|
294
308
|
*
|
|
295
309
|
* @see {@link https://discord.com/developers/docs/resources/sticker#create-guild-sticker}
|
|
296
310
|
*/
|
|
297
|
-
createGuildSticker: (guildId: BigString, options: CreateGuildStickerOptions) => Promise<CamelizedDiscordSticker>;
|
|
311
|
+
createGuildSticker: (guildId: BigString, options: CreateGuildStickerOptions, reason?: string) => Promise<CamelizedDiscordSticker>;
|
|
298
312
|
/**
|
|
299
313
|
* Creates a template from a guild.
|
|
300
314
|
*
|
|
@@ -315,6 +329,7 @@ export interface RestManager {
|
|
|
315
329
|
*
|
|
316
330
|
* @param channelId - The ID of the channel to create the invite to.
|
|
317
331
|
* @param options - The parameters for the creation of the invite.
|
|
332
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
318
333
|
* @returns An instance of the created {@link CamelizedDiscordInvite}.
|
|
319
334
|
*
|
|
320
335
|
* @remarks
|
|
@@ -327,12 +342,13 @@ export interface RestManager {
|
|
|
327
342
|
*
|
|
328
343
|
* @see {@link https://discord.com/developers/docs/resources/channel#create-channel-invite}
|
|
329
344
|
*/
|
|
330
|
-
createInvite: (channelId: BigString, options?: CreateChannelInvite) => Promise<CamelizedDiscordInvite>;
|
|
345
|
+
createInvite: (channelId: BigString, options?: CreateChannelInvite, reason?: string) => Promise<CamelizedDiscordInvite>;
|
|
331
346
|
/**
|
|
332
347
|
* Creates a role in a guild.
|
|
333
348
|
*
|
|
334
349
|
* @param guildId - The ID of the guild to create the role in.
|
|
335
350
|
* @param options - The parameters for the creation of the role.
|
|
351
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
336
352
|
* @returns An instance of the created {@link CamelizedDiscordRole}.
|
|
337
353
|
*
|
|
338
354
|
* @remarks
|
|
@@ -348,6 +364,7 @@ export interface RestManager {
|
|
|
348
364
|
*
|
|
349
365
|
* @param guildId - The ID of the guild to create the scheduled event in.
|
|
350
366
|
* @param options - The parameters for the creation of the scheduled event.
|
|
367
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
351
368
|
* @returns An instance of the created {@link ScheduledEvent}.
|
|
352
369
|
*
|
|
353
370
|
* @remarks
|
|
@@ -359,11 +376,12 @@ export interface RestManager {
|
|
|
359
376
|
*
|
|
360
377
|
* @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event}
|
|
361
378
|
*/
|
|
362
|
-
createScheduledEvent: (guildId: BigString, options: CreateScheduledEvent) => Promise<CamelizedDiscordScheduledEvent>;
|
|
379
|
+
createScheduledEvent: (guildId: BigString, options: CreateScheduledEvent, reason?: string) => Promise<CamelizedDiscordScheduledEvent>;
|
|
363
380
|
/**
|
|
364
381
|
* Creates a stage instance associated with a stage channel.
|
|
365
382
|
*
|
|
366
383
|
* @param options - The parameters for the creation of the stage instance.
|
|
384
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
367
385
|
* @returns An instance of the created {@link CamelizedDiscordStageInstance}.
|
|
368
386
|
*
|
|
369
387
|
* @remarks
|
|
@@ -373,29 +391,31 @@ export interface RestManager {
|
|
|
373
391
|
*
|
|
374
392
|
* @see {@link https://discord.com/developers/docs/resources/stage-instance#create-stage-instance}
|
|
375
393
|
*/
|
|
376
|
-
createStageInstance: (options: CreateStageInstance) => Promise<CamelizedDiscordStageInstance>;
|
|
394
|
+
createStageInstance: (options: CreateStageInstance, reason?: string) => Promise<CamelizedDiscordStageInstance>;
|
|
377
395
|
/**
|
|
378
396
|
* Creates a webhook.
|
|
379
397
|
*
|
|
380
398
|
* @param channelId - The ID of the channel to create the webhook in.
|
|
381
399
|
* @param options - The parameters for the creation of the webhook.
|
|
400
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
382
401
|
* @returns An instance of the created {@link CamelizedDiscordWebhook}.
|
|
383
402
|
*
|
|
384
403
|
* @remarks
|
|
385
404
|
* Requires the `MANAGE_WEBHOOKS` permission.
|
|
386
405
|
*
|
|
387
|
-
* ⚠️ The webhook name must not contain the
|
|
406
|
+
* ⚠️ The webhook name must not contain the substrings 'clyde', or 'discord' (case-insensitive).
|
|
388
407
|
*
|
|
389
408
|
* Fires a _Webhooks Update_ gateway event.
|
|
390
409
|
*
|
|
391
410
|
* @see {@link https://discord.com/developers/docs/resources/webhook#create-webhook}
|
|
392
411
|
*/
|
|
393
|
-
createWebhook: (channelId: BigString, options: CreateWebhook) => Promise<CamelizedDiscordWebhook>;
|
|
412
|
+
createWebhook: (channelId: BigString, options: CreateWebhook, reason?: string) => Promise<CamelizedDiscordWebhook>;
|
|
394
413
|
/**
|
|
395
414
|
* Deletes an automod rule.
|
|
396
415
|
*
|
|
397
416
|
* @param guildId - The ID of the guild to delete the rule from.
|
|
398
417
|
* @param ruleId - The ID of the automod rule to delete.
|
|
418
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
399
419
|
*
|
|
400
420
|
* @remarks
|
|
401
421
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -409,6 +429,7 @@ export interface RestManager {
|
|
|
409
429
|
* Deletes a channel from within a guild.
|
|
410
430
|
*
|
|
411
431
|
* @param channelId - The ID of the channel to delete.
|
|
432
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
412
433
|
* @returns An instance of the deleted {@link Channel}.
|
|
413
434
|
*
|
|
414
435
|
* @remarks
|
|
@@ -435,6 +456,7 @@ export interface RestManager {
|
|
|
435
456
|
*
|
|
436
457
|
* @param channelId - The ID of the channel to delete the permission override of.
|
|
437
458
|
* @param overwriteId - The ID of the permission override to delete.
|
|
459
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
438
460
|
*
|
|
439
461
|
* @remarks
|
|
440
462
|
* Requires the `MANAGE_ROLES` permission.
|
|
@@ -449,6 +471,7 @@ export interface RestManager {
|
|
|
449
471
|
*
|
|
450
472
|
* @param guildId - The ID of the guild from which to delete the emoji.
|
|
451
473
|
* @param id - The ID of the emoji to delete.
|
|
474
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
452
475
|
*
|
|
453
476
|
* @remarks
|
|
454
477
|
* Requires the `MANAGE_EMOJIS_AND_STICKERS` permission.
|
|
@@ -506,6 +529,7 @@ export interface RestManager {
|
|
|
506
529
|
* Delete a new sticker for the guild.
|
|
507
530
|
*
|
|
508
531
|
* @param guildId The ID of the guild to get
|
|
532
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
509
533
|
* @return A {@link CamelizedDiscordSticker}
|
|
510
534
|
*
|
|
511
535
|
* @remarks
|
|
@@ -536,6 +560,7 @@ export interface RestManager {
|
|
|
536
560
|
*
|
|
537
561
|
* @param guildId - The ID of the guild from which to delete the integration.
|
|
538
562
|
* @param integrationId - The ID of the integration to delete from the guild.
|
|
563
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
539
564
|
*
|
|
540
565
|
* @remarks
|
|
541
566
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -547,11 +572,12 @@ export interface RestManager {
|
|
|
547
572
|
*
|
|
548
573
|
* @see {@link https://discord.com/developers/docs/resources/guild#delete-guild-integration}
|
|
549
574
|
*/
|
|
550
|
-
deleteIntegration: (guildId: BigString, integrationId: BigString) => Promise<void>;
|
|
575
|
+
deleteIntegration: (guildId: BigString, integrationId: BigString, reason?: string) => Promise<void>;
|
|
551
576
|
/**
|
|
552
577
|
* Deletes an invite to a channel.
|
|
553
578
|
*
|
|
554
579
|
* @param inviteCode - The invite code of the invite to delete.
|
|
580
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
555
581
|
*
|
|
556
582
|
* @remarks
|
|
557
583
|
* Requires the `MANAGE_CHANNELS` permission.
|
|
@@ -566,6 +592,7 @@ export interface RestManager {
|
|
|
566
592
|
*
|
|
567
593
|
* @param channelId - The ID of the channel to delete the message from.
|
|
568
594
|
* @param messageId - The ID of the message to delete from the channel.
|
|
595
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
569
596
|
*
|
|
570
597
|
* @remarks
|
|
571
598
|
* If not deleting own message:
|
|
@@ -581,6 +608,7 @@ export interface RestManager {
|
|
|
581
608
|
*
|
|
582
609
|
* @param channelId - The ID of the channel to delete the messages from.
|
|
583
610
|
* @param messageIds - The IDs of the messages to delete from the channel.
|
|
611
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
584
612
|
*
|
|
585
613
|
* @remarks
|
|
586
614
|
* Requires the `MANAGE_MESSAGES` permission.
|
|
@@ -658,6 +686,7 @@ export interface RestManager {
|
|
|
658
686
|
*
|
|
659
687
|
* @param guildId - The ID of the guild to delete the role from.
|
|
660
688
|
* @param roleId - The ID of the role to delete.
|
|
689
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
661
690
|
*
|
|
662
691
|
* @remarks
|
|
663
692
|
* Requires the `MANAGE_ROLES` permission.
|
|
@@ -666,7 +695,7 @@ export interface RestManager {
|
|
|
666
695
|
*
|
|
667
696
|
* @see {@link https://discord.com/developers/docs/resources/guild#delete-guild-role}
|
|
668
697
|
*/
|
|
669
|
-
deleteRole: (guildId: BigString, roleId: BigString) => Promise<void>;
|
|
698
|
+
deleteRole: (guildId: BigString, roleId: BigString, reason?: string) => Promise<void>;
|
|
670
699
|
/**
|
|
671
700
|
* Deletes a scheduled event from a guild.
|
|
672
701
|
*
|
|
@@ -685,6 +714,7 @@ export interface RestManager {
|
|
|
685
714
|
* Deletes the stage instance associated with a stage channel, if one exists.
|
|
686
715
|
*
|
|
687
716
|
* @param channelId - The ID of the stage channel the stage instance is associated with.
|
|
717
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
688
718
|
*
|
|
689
719
|
* @remarks
|
|
690
720
|
* Requires the user to be a moderator of the stage channel.
|
|
@@ -765,13 +795,14 @@ export interface RestManager {
|
|
|
765
795
|
*
|
|
766
796
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions}
|
|
767
797
|
*/
|
|
768
|
-
editApplicationCommandPermissions: (guildId: BigString, commandId: BigString, bearerToken: string, options: ApplicationCommandPermissions[]) => Promise<
|
|
798
|
+
editApplicationCommandPermissions: (guildId: BigString, commandId: BigString, bearerToken: string, options: ApplicationCommandPermissions[]) => Promise<CamelizedDiscordGuildApplicationCommandPermissions>;
|
|
769
799
|
/**
|
|
770
800
|
* Edits an automod rule.
|
|
771
801
|
*
|
|
772
802
|
* @param guildId - The ID of the guild to edit the rule in.
|
|
773
803
|
* @param ruleId - The ID of the rule to edit.
|
|
774
804
|
* @param options - The parameters for the edit of the rule.
|
|
805
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
775
806
|
* @returns An instance of the edited {@link CamelizedDiscordAutoModerationRule}.
|
|
776
807
|
*
|
|
777
808
|
* @remarks
|
|
@@ -781,7 +812,7 @@ export interface RestManager {
|
|
|
781
812
|
*
|
|
782
813
|
* @see {@link https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule}
|
|
783
814
|
*/
|
|
784
|
-
editAutomodRule: (guildId: BigString, ruleId: BigString, options: Partial<EditAutoModerationRuleOptions
|
|
815
|
+
editAutomodRule: (guildId: BigString, ruleId: BigString, options: Partial<EditAutoModerationRuleOptions>, reason?: string) => Promise<CamelizedDiscordAutoModerationRule>;
|
|
785
816
|
/**
|
|
786
817
|
* Modifies the bot's username or avatar.
|
|
787
818
|
* NOTE: username: if changed may cause the bot's discriminator to be randomized.
|
|
@@ -795,6 +826,7 @@ export interface RestManager {
|
|
|
795
826
|
*
|
|
796
827
|
* @param channelId - The ID of the channel to edit.
|
|
797
828
|
* @param options - The parameters for the edit of the channel.
|
|
829
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
798
830
|
* @returns An instance of the edited {@link CamelizedDiscordChannel}.
|
|
799
831
|
*
|
|
800
832
|
* @remarks
|
|
@@ -819,12 +851,13 @@ export interface RestManager {
|
|
|
819
851
|
* - Otherwise:
|
|
820
852
|
* - Fires a _Channel Update_ gateway event.
|
|
821
853
|
*/
|
|
822
|
-
editChannel: (channelId: BigString, options: ModifyChannel) => Promise<CamelizedDiscordChannel>;
|
|
854
|
+
editChannel: (channelId: BigString, options: ModifyChannel, reason?: string) => Promise<CamelizedDiscordChannel>;
|
|
823
855
|
/**
|
|
824
856
|
* Edits the permission overrides for a user or role in a channel.
|
|
825
857
|
*
|
|
826
858
|
* @param channelId - The ID of the channel to edit the permission overrides of.
|
|
827
859
|
* @param options - The permission override.
|
|
860
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
828
861
|
*
|
|
829
862
|
* @remarks
|
|
830
863
|
* Requires the `MANAGE_ROLES` permission.
|
|
@@ -835,7 +868,7 @@ export interface RestManager {
|
|
|
835
868
|
*
|
|
836
869
|
* @see {@link https://discord.com/developers/docs/resources/channel#edit-channel-permissions}
|
|
837
870
|
*/
|
|
838
|
-
editChannelPermissionOverrides: (channelId: BigString, options: EditChannelPermissionOverridesOptions) => Promise<void>;
|
|
871
|
+
editChannelPermissionOverrides: (channelId: BigString, options: EditChannelPermissionOverridesOptions, reason?: string) => Promise<void>;
|
|
839
872
|
/**
|
|
840
873
|
* Edits the positions of a set of channels in a guild.
|
|
841
874
|
*
|
|
@@ -856,6 +889,7 @@ export interface RestManager {
|
|
|
856
889
|
* @param guildId - The ID of the guild in which to edit the emoji.
|
|
857
890
|
* @param id - The ID of the emoji to edit.
|
|
858
891
|
* @param options - The parameters for the edit of the emoji.
|
|
892
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
859
893
|
* @returns An instance of the updated {@link CamelizedDiscordEmoji}.
|
|
860
894
|
*
|
|
861
895
|
* @remarks
|
|
@@ -865,7 +899,7 @@ export interface RestManager {
|
|
|
865
899
|
*
|
|
866
900
|
* @see {@link https://discord.com/developers/docs/resources/emoji#modify-guild-emoji}
|
|
867
901
|
*/
|
|
868
|
-
editEmoji: (guildId: BigString, id: BigString, options: ModifyGuildEmoji) => Promise<CamelizedDiscordEmoji>;
|
|
902
|
+
editEmoji: (guildId: BigString, id: BigString, options: ModifyGuildEmoji, reason?: string) => Promise<CamelizedDiscordEmoji>;
|
|
869
903
|
/**
|
|
870
904
|
* Edits a follow-up message to an interaction.
|
|
871
905
|
*
|
|
@@ -900,6 +934,7 @@ export interface RestManager {
|
|
|
900
934
|
* @param guildId - The ID of the guild to edit.
|
|
901
935
|
* @param shardId - The ID of the shard the guild is in.
|
|
902
936
|
* @param options - The parameters for the edit of the guild.
|
|
937
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
903
938
|
* @returns An instance of the edited {@link Guild}.
|
|
904
939
|
*
|
|
905
940
|
* @remarks
|
|
@@ -912,7 +947,7 @@ export interface RestManager {
|
|
|
912
947
|
*
|
|
913
948
|
* @see {@link https://discord.com/developers/docs/resources/guild#modify-guild}
|
|
914
949
|
*/
|
|
915
|
-
editGuild: (guildId: BigString, options: ModifyGuild) => Promise<CamelizedDiscordGuild>;
|
|
950
|
+
editGuild: (guildId: BigString, options: ModifyGuild, reason?: string) => Promise<CamelizedDiscordGuild>;
|
|
916
951
|
/**
|
|
917
952
|
* Edits an application command registered in a guild.
|
|
918
953
|
*
|
|
@@ -924,12 +959,15 @@ export interface RestManager {
|
|
|
924
959
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command}
|
|
925
960
|
*/
|
|
926
961
|
editGuildApplicationCommand: (commandId: BigString, guildId: BigString, options: CreateApplicationCommand) => Promise<CamelizedDiscordApplicationCommand>;
|
|
927
|
-
/** Modify a guild's MFA level. Requires guild ownership.
|
|
962
|
+
/** Modify a guild's MFA level. Requires guild ownership.
|
|
963
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
964
|
+
*/
|
|
928
965
|
editGuildMfaLevel: (guildId: BigString, mfaLevel: MfaLevels, reason?: string) => Promise<void>;
|
|
929
966
|
/**
|
|
930
967
|
* Edit the given sticker.
|
|
931
968
|
*
|
|
932
969
|
* @param guildId The ID of the guild to get
|
|
970
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
933
971
|
* @return A {@link CamelizedDiscordSticker}
|
|
934
972
|
*
|
|
935
973
|
* @remarks
|
|
@@ -938,7 +976,7 @@ export interface RestManager {
|
|
|
938
976
|
*
|
|
939
977
|
* @see {@link https://discord.com/developers/docs/resources/sticker#modify-guild-sticker}
|
|
940
978
|
*/
|
|
941
|
-
editGuildSticker: (guildId: BigString, stickerId: BigString, options: AtLeastOne<EditGuildStickerOptions
|
|
979
|
+
editGuildSticker: (guildId: BigString, stickerId: BigString, options: AtLeastOne<EditGuildStickerOptions>, reason?: string) => Promise<CamelizedDiscordSticker>;
|
|
942
980
|
/**
|
|
943
981
|
* Edits a template's settings.
|
|
944
982
|
*
|
|
@@ -989,7 +1027,7 @@ export interface RestManager {
|
|
|
989
1027
|
*
|
|
990
1028
|
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response}
|
|
991
1029
|
*/
|
|
992
|
-
editOriginalInteractionResponse: (token: string, options: InteractionCallbackData) => Promise<CamelizedDiscordMessage
|
|
1030
|
+
editOriginalInteractionResponse: (token: string, options: InteractionCallbackData) => Promise<CamelizedDiscordMessage>;
|
|
993
1031
|
/**
|
|
994
1032
|
* Edits the original webhook message.
|
|
995
1033
|
*
|
|
@@ -1030,6 +1068,7 @@ export interface RestManager {
|
|
|
1030
1068
|
* @param guildId - The ID of the guild to edit the role in.
|
|
1031
1069
|
* @param roleId - The ID of the role to edit.
|
|
1032
1070
|
* @param options - The parameters for the edit of the role.
|
|
1071
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
1033
1072
|
* @returns An instance of the edited {@link CamelizedDiscordRole}.
|
|
1034
1073
|
*
|
|
1035
1074
|
* @remarks
|
|
@@ -1039,12 +1078,13 @@ export interface RestManager {
|
|
|
1039
1078
|
*
|
|
1040
1079
|
* @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-role}
|
|
1041
1080
|
*/
|
|
1042
|
-
editRole: (guildId: BigString, roleId: BigString, options: EditGuildRole) => Promise<CamelizedDiscordRole>;
|
|
1081
|
+
editRole: (guildId: BigString, roleId: BigString, options: EditGuildRole, reason?: string) => Promise<CamelizedDiscordRole>;
|
|
1043
1082
|
/**
|
|
1044
1083
|
* Edits the positions of a set of roles.
|
|
1045
1084
|
*
|
|
1046
1085
|
* @param guildId - The ID of the guild to edit the role positions in.
|
|
1047
1086
|
* @param options - The parameters for the edit of the role positions.
|
|
1087
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
1048
1088
|
* @returns A collection of {@link CamelizedDiscordRole} objects assorted by role ID.
|
|
1049
1089
|
*
|
|
1050
1090
|
* @remarks
|
|
@@ -1054,12 +1094,13 @@ export interface RestManager {
|
|
|
1054
1094
|
*
|
|
1055
1095
|
* @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-role-positions}
|
|
1056
1096
|
*/
|
|
1057
|
-
editRolePositions: (guildId: BigString, options: ModifyRolePositions[]) => Promise<CamelizedDiscordRole[]>;
|
|
1097
|
+
editRolePositions: (guildId: BigString, options: ModifyRolePositions[], reason?: string) => Promise<CamelizedDiscordRole[]>;
|
|
1058
1098
|
/**
|
|
1059
1099
|
* Edits a scheduled event.
|
|
1060
1100
|
*
|
|
1061
1101
|
* @param guildId - The ID of the guild to edit the scheduled event in.
|
|
1062
1102
|
* @param eventId - The ID of the scheduled event to edit.
|
|
1103
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
1063
1104
|
* @returns An instance of the edited {@link ScheduledEvent}.
|
|
1064
1105
|
*
|
|
1065
1106
|
* @remarks
|
|
@@ -1073,11 +1114,13 @@ export interface RestManager {
|
|
|
1073
1114
|
*
|
|
1074
1115
|
* @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event}
|
|
1075
1116
|
*/
|
|
1076
|
-
editScheduledEvent: (guildId: BigString, eventId: BigString, options: Partial<EditScheduledEvent
|
|
1117
|
+
editScheduledEvent: (guildId: BigString, eventId: BigString, options: Partial<EditScheduledEvent>, reason?: string) => Promise<CamelizedDiscordScheduledEvent>;
|
|
1077
1118
|
/**
|
|
1078
1119
|
* Edits a stage instance.
|
|
1079
1120
|
*
|
|
1080
1121
|
* @param channelId - The ID of the stage channel the stage instance is associated with.
|
|
1122
|
+
* @param topic - Topic of the Stage instance (1-120 characters).
|
|
1123
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
1081
1124
|
* @returns An instance of the updated {@link CamelizedDiscordStageInstance}.
|
|
1082
1125
|
*
|
|
1083
1126
|
* @remarks
|
|
@@ -1087,7 +1130,7 @@ export interface RestManager {
|
|
|
1087
1130
|
*
|
|
1088
1131
|
* @see {@link https://discord.com/developers/docs/resources/stage-instance#modify-stage-instance}
|
|
1089
1132
|
*/
|
|
1090
|
-
editStageInstance: (channelId: BigString,
|
|
1133
|
+
editStageInstance: (channelId: BigString, topic: string, reason?: string) => Promise<CamelizedDiscordStageInstance>;
|
|
1091
1134
|
/**
|
|
1092
1135
|
* Edits the voice state of another user.
|
|
1093
1136
|
*
|
|
@@ -1106,6 +1149,7 @@ export interface RestManager {
|
|
|
1106
1149
|
* Edits a webhook.
|
|
1107
1150
|
*
|
|
1108
1151
|
* @param webhookId - The ID of the webhook to edit.
|
|
1152
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
1109
1153
|
* @returns An instance of the edited {@link CamelizedDiscordWebhook}.
|
|
1110
1154
|
*
|
|
1111
1155
|
* @remarks
|
|
@@ -1115,7 +1159,7 @@ export interface RestManager {
|
|
|
1115
1159
|
*
|
|
1116
1160
|
* @see {@link https://discord.com/developers/docs/resources/webhook#edit-webhook}
|
|
1117
1161
|
*/
|
|
1118
|
-
editWebhook: (webhookId: BigString, options: ModifyWebhook) => Promise<CamelizedDiscordWebhook>;
|
|
1162
|
+
editWebhook: (webhookId: BigString, options: ModifyWebhook, reason?: string) => Promise<CamelizedDiscordWebhook>;
|
|
1119
1163
|
/**
|
|
1120
1164
|
* Edits a webhook message.
|
|
1121
1165
|
*
|
|
@@ -1153,6 +1197,7 @@ export interface RestManager {
|
|
|
1153
1197
|
*
|
|
1154
1198
|
* @param guildId - The ID of the guild to edit the welcome screen of.
|
|
1155
1199
|
* @param options - The parameters for the edit of the welcome screen.
|
|
1200
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
1156
1201
|
* @returns An instance of the edited {@link WelcomeScreen}.
|
|
1157
1202
|
*
|
|
1158
1203
|
* @remarks
|
|
@@ -1162,11 +1207,12 @@ export interface RestManager {
|
|
|
1162
1207
|
*
|
|
1163
1208
|
* @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen}
|
|
1164
1209
|
*/
|
|
1165
|
-
editWelcomeScreen: (guildId: BigString, options: CamelizedDiscordModifyGuildWelcomeScreen) => Promise<CamelizedDiscordWelcomeScreen>;
|
|
1210
|
+
editWelcomeScreen: (guildId: BigString, options: CamelizedDiscordModifyGuildWelcomeScreen, reason?: string) => Promise<CamelizedDiscordWelcomeScreen>;
|
|
1166
1211
|
/**
|
|
1167
1212
|
* Edits the settings of a guild's widget.
|
|
1168
1213
|
*
|
|
1169
1214
|
* @param guildId - The ID of the guild to edit the settings of the widget of.
|
|
1215
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
1170
1216
|
* @returns An instance of the edited {@link GuildWidgetSettings}.
|
|
1171
1217
|
*
|
|
1172
1218
|
* @remarks
|
|
@@ -1176,7 +1222,7 @@ export interface RestManager {
|
|
|
1176
1222
|
*
|
|
1177
1223
|
* @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-widget}
|
|
1178
1224
|
*/
|
|
1179
|
-
editWidgetSettings: (guildId: BigString, options: CamelizedDiscordGuildWidgetSettings) => Promise<CamelizedDiscordGuildWidgetSettings>;
|
|
1225
|
+
editWidgetSettings: (guildId: BigString, options: CamelizedDiscordGuildWidgetSettings, reason?: string) => Promise<CamelizedDiscordGuildWidgetSettings>;
|
|
1180
1226
|
/**
|
|
1181
1227
|
* Executes a webhook, causing a message to be posted in the channel configured for the webhook.
|
|
1182
1228
|
*
|
|
@@ -1231,7 +1277,7 @@ export interface RestManager {
|
|
|
1231
1277
|
*
|
|
1232
1278
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions}
|
|
1233
1279
|
*/
|
|
1234
|
-
getApplicationCommandPermission: (guildId: BigString, commandId: BigString) => Promise<
|
|
1280
|
+
getApplicationCommandPermission: (guildId: BigString, commandId: BigString) => Promise<CamelizedDiscordGuildApplicationCommandPermissions>;
|
|
1235
1281
|
/**
|
|
1236
1282
|
* Gets the permissions of all application commands registered in a guild by the ID of the guild.
|
|
1237
1283
|
*
|
|
@@ -1240,7 +1286,7 @@ export interface RestManager {
|
|
|
1240
1286
|
*
|
|
1241
1287
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions}
|
|
1242
1288
|
*/
|
|
1243
|
-
getApplicationCommandPermissions: (guildId: BigString) => Promise<
|
|
1289
|
+
getApplicationCommandPermissions: (guildId: BigString) => Promise<CamelizedDiscordGuildApplicationCommandPermissions[]>;
|
|
1244
1290
|
/**
|
|
1245
1291
|
* Gets a guild's audit log.
|
|
1246
1292
|
*
|
|
@@ -1967,6 +2013,7 @@ export interface RestManager {
|
|
|
1967
2013
|
* @param guildId - The ID of the guild the member to remove the role from is in.
|
|
1968
2014
|
* @param userId - The user ID of the member to remove the role from.
|
|
1969
2015
|
* @param roleId - The ID of the role to remove from the member.
|
|
2016
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
1970
2017
|
*
|
|
1971
2018
|
* @remarks
|
|
1972
2019
|
* Requires the `MANAGE_ROLES` permission.
|
|
@@ -2069,6 +2116,7 @@ export interface RestManager {
|
|
|
2069
2116
|
* @param channelId - The ID of the channel in which to create the thread.
|
|
2070
2117
|
* @param messageId - The ID of the message to use as the thread's point of origin.
|
|
2071
2118
|
* @param options - The parameters to use for the creation of the thread.
|
|
2119
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2072
2120
|
* @returns An instance of the created {@link Channel | Thread}.
|
|
2073
2121
|
*
|
|
2074
2122
|
* @remarks
|
|
@@ -2082,12 +2130,13 @@ export interface RestManager {
|
|
|
2082
2130
|
*
|
|
2083
2131
|
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-from-message}
|
|
2084
2132
|
*/
|
|
2085
|
-
startThreadWithMessage: (channelId: BigString, messageId: BigString, options: StartThreadWithMessage) => Promise<CamelizedDiscordChannel>;
|
|
2133
|
+
startThreadWithMessage: (channelId: BigString, messageId: BigString, options: StartThreadWithMessage, reason?: string) => Promise<CamelizedDiscordChannel>;
|
|
2086
2134
|
/**
|
|
2087
2135
|
* Creates a thread without using a message as the thread's point of origin.
|
|
2088
2136
|
*
|
|
2089
2137
|
* @param channelId - The ID of the channel in which to create the thread.
|
|
2090
2138
|
* @param options - The parameters to use for the creation of the thread.
|
|
2139
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2091
2140
|
* @returns An instance of the created {@link CamelizedDiscordChannel | Thread}.
|
|
2092
2141
|
*
|
|
2093
2142
|
* @remarks
|
|
@@ -2097,7 +2146,7 @@ export interface RestManager {
|
|
|
2097
2146
|
*
|
|
2098
2147
|
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-without-message}
|
|
2099
2148
|
*/
|
|
2100
|
-
startThreadWithoutMessage: (channelId: BigString, options: StartThreadWithoutMessage) => Promise<CamelizedDiscordChannel>;
|
|
2149
|
+
startThreadWithoutMessage: (channelId: BigString, options: StartThreadWithoutMessage, reason?: string) => Promise<CamelizedDiscordChannel>;
|
|
2101
2150
|
/**
|
|
2102
2151
|
* Synchronises a template with the current state of a guild.
|
|
2103
2152
|
*
|
|
@@ -2157,9 +2206,9 @@ export interface RestManager {
|
|
|
2157
2206
|
/**
|
|
2158
2207
|
* Bans a user from a guild.
|
|
2159
2208
|
*
|
|
2160
|
-
|
|
2161
2209
|
* @param guildId - The ID of the guild to ban the user from.
|
|
2162
2210
|
* @param userId - The ID of the user to ban from the guild.
|
|
2211
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2163
2212
|
* @param options - The parameters for the creation of the ban.
|
|
2164
2213
|
*
|
|
2165
2214
|
* @remarks
|
|
@@ -2169,12 +2218,13 @@ export interface RestManager {
|
|
|
2169
2218
|
*
|
|
2170
2219
|
* @see {@link https://discord.com/developers/docs/resources/guild#create-guild-ban}
|
|
2171
2220
|
*/
|
|
2172
|
-
banMember: (guildId: BigString, userId: BigString, options?: CreateGuildBan) => Promise<void>;
|
|
2221
|
+
banMember: (guildId: BigString, userId: BigString, options?: CreateGuildBan, reason?: string) => Promise<void>;
|
|
2173
2222
|
/**
|
|
2174
2223
|
* Edits the nickname of the bot user.
|
|
2175
2224
|
*
|
|
2176
2225
|
* @param guildId - The ID of the guild to edit the nickname of the bot user in.
|
|
2177
2226
|
* @param options - The parameters for the edit of the nickname.
|
|
2227
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2178
2228
|
* @returns An instance of the edited {@link CamelizedDiscordMember}
|
|
2179
2229
|
*
|
|
2180
2230
|
* @remarks
|
|
@@ -2182,12 +2232,13 @@ export interface RestManager {
|
|
|
2182
2232
|
*
|
|
2183
2233
|
* @see {@link https://discord.com/developers/docs/resources/guild#modify-current-member}
|
|
2184
2234
|
*/
|
|
2185
|
-
editBotMember: (guildId: BigString, options: EditBotMemberOptions) => Promise<CamelizedDiscordMember>;
|
|
2235
|
+
editBotMember: (guildId: BigString, options: EditBotMemberOptions, reason?: string) => Promise<CamelizedDiscordMember>;
|
|
2186
2236
|
/**
|
|
2187
2237
|
* Edits a member's properties.
|
|
2188
2238
|
*
|
|
2189
2239
|
* @param guildId - The ID of the guild to edit the member of.
|
|
2190
2240
|
* @param userId - The user ID of the member to edit.
|
|
2241
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2191
2242
|
* @param options - The parameters for the edit of the user.
|
|
2192
2243
|
*
|
|
2193
2244
|
* @remarks
|
|
@@ -2198,7 +2249,7 @@ export interface RestManager {
|
|
|
2198
2249
|
*
|
|
2199
2250
|
* @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-member}
|
|
2200
2251
|
*/
|
|
2201
|
-
editMember: (guildId: BigString, userId: BigString, options: ModifyGuildMember) => Promise<CamelizedDiscordMember>;
|
|
2252
|
+
editMember: (guildId: BigString, userId: BigString, options: ModifyGuildMember, reason?: string) => Promise<CamelizedDiscordMember>;
|
|
2202
2253
|
/**
|
|
2203
2254
|
* Gets the member object by user ID.
|
|
2204
2255
|
*
|
|
@@ -2235,6 +2286,7 @@ export interface RestManager {
|
|
|
2235
2286
|
|
|
2236
2287
|
* @param guildId - The ID of the guild to kick the member from.
|
|
2237
2288
|
* @param userId - The user ID of the member to kick from the guild.
|
|
2289
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2238
2290
|
*
|
|
2239
2291
|
* @remarks
|
|
2240
2292
|
* Requires the `KICK_MEMBERS` permission.
|
|
@@ -2249,6 +2301,7 @@ export interface RestManager {
|
|
|
2249
2301
|
*
|
|
2250
2302
|
* @param channelId - The ID of the channel where the message is to be pinned.
|
|
2251
2303
|
* @param messageId - The ID of the message to pin.
|
|
2304
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2252
2305
|
*
|
|
2253
2306
|
* @remarks
|
|
2254
2307
|
* Requires that the bot user be able to see the contents of the channel in which the messages were posted.
|
|
@@ -2268,6 +2321,7 @@ export interface RestManager {
|
|
|
2268
2321
|
|
|
2269
2322
|
* @param guildId - The ID of the guild to prune the members of.
|
|
2270
2323
|
* @param options - The parameters for the pruning of members.
|
|
2324
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2271
2325
|
* @returns A number indicating how many members were pruned.
|
|
2272
2326
|
*
|
|
2273
2327
|
* @remarks
|
|
@@ -2281,7 +2335,7 @@ export interface RestManager {
|
|
|
2281
2335
|
*
|
|
2282
2336
|
* @see {@link https://discord.com/developers/docs/resources/guild#begin-guild-prune}
|
|
2283
2337
|
*/
|
|
2284
|
-
pruneMembers: (guildId: BigString, options: BeginGuildPrune) => Promise<{
|
|
2338
|
+
pruneMembers: (guildId: BigString, options: BeginGuildPrune, reason?: string) => Promise<{
|
|
2285
2339
|
pruned: number | null;
|
|
2286
2340
|
}>;
|
|
2287
2341
|
/**
|
|
@@ -2302,6 +2356,7 @@ export interface RestManager {
|
|
|
2302
2356
|
|
|
2303
2357
|
* @param guildId - The ID of the guild to unban the user in.
|
|
2304
2358
|
* @param userId - The ID of the user to unban.
|
|
2359
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2305
2360
|
*
|
|
2306
2361
|
* @remarks
|
|
2307
2362
|
* Requires the `BAN_MEMBERS` permission.
|
|
@@ -2310,12 +2365,13 @@ export interface RestManager {
|
|
|
2310
2365
|
*
|
|
2311
2366
|
* @see {@link https://discord.com/developers/docs/resources/guild#remove-guild-ban}
|
|
2312
2367
|
*/
|
|
2313
|
-
unbanMember: (guildId: BigString, userId: BigString) => Promise<void>;
|
|
2368
|
+
unbanMember: (guildId: BigString, userId: BigString, reason?: string) => Promise<void>;
|
|
2314
2369
|
/**
|
|
2315
2370
|
* Unpins a pinned message in a channel.
|
|
2316
2371
|
*
|
|
2317
2372
|
* @param channelId - The ID of the channel where the message is pinned.
|
|
2318
2373
|
* @param messageId - The ID of the message to unpin.
|
|
2374
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2319
2375
|
*
|
|
2320
2376
|
* @remarks
|
|
2321
2377
|
* Requires that the bot user be able to see the contents of the channel in which the messages were posted.
|
|
@@ -2330,7 +2386,7 @@ export interface RestManager {
|
|
|
2330
2386
|
}
|
|
2331
2387
|
export type RequestMethods = 'GET' | 'POST' | 'DELETE' | 'PATCH' | 'PUT';
|
|
2332
2388
|
export type ApiVersions = 9 | 10;
|
|
2333
|
-
export interface CreateWebhook
|
|
2389
|
+
export interface CreateWebhook {
|
|
2334
2390
|
/** Name of the webhook (1-80 characters) */
|
|
2335
2391
|
name: string;
|
|
2336
2392
|
/** Image url for the default webhook avatar */
|
|
@@ -2338,23 +2394,22 @@ export interface CreateWebhook extends WithReason {
|
|
|
2338
2394
|
}
|
|
2339
2395
|
export interface CreateRequestBodyOptions {
|
|
2340
2396
|
headers?: Record<string, string>;
|
|
2341
|
-
|
|
2342
|
-
body?: Record<string, unknown>;
|
|
2397
|
+
body?: any;
|
|
2343
2398
|
unauthorized?: boolean;
|
|
2344
|
-
|
|
2399
|
+
reason?: string;
|
|
2400
|
+
files?: FileContent[];
|
|
2345
2401
|
}
|
|
2402
|
+
export type MakeRequestOptions = Omit<CreateRequestBodyOptions, 'method'> & Pick<SendRequestOptions, 'runThroughQueue'>;
|
|
2346
2403
|
export interface RequestBody {
|
|
2347
2404
|
headers: Record<string, string>;
|
|
2348
|
-
body
|
|
2405
|
+
body?: string | FormData;
|
|
2349
2406
|
method: RequestMethods;
|
|
2350
2407
|
}
|
|
2351
2408
|
export interface SendRequestOptions {
|
|
2352
|
-
/** The
|
|
2353
|
-
|
|
2354
|
-
/** The method to use
|
|
2409
|
+
/** The route to send the request to. */
|
|
2410
|
+
route: string;
|
|
2411
|
+
/** The method to use for sending the request. */
|
|
2355
2412
|
method: RequestMethods;
|
|
2356
|
-
/** The body to be sent in the request. */
|
|
2357
|
-
body?: Record<string, any>;
|
|
2358
2413
|
/** The amount of times this request has been retried. */
|
|
2359
2414
|
retryCount: number;
|
|
2360
2415
|
/** Handler to retry a request should it be rate limited. */
|
|
@@ -2366,7 +2421,12 @@ export interface SendRequestOptions {
|
|
|
2366
2421
|
/** If this request has a bucket id which it falls under for rate limit */
|
|
2367
2422
|
bucketId?: string;
|
|
2368
2423
|
/** Additional request options, used for things like overriding authorization header. */
|
|
2369
|
-
|
|
2424
|
+
requestBodyOptions?: CreateRequestBodyOptions;
|
|
2425
|
+
/**
|
|
2426
|
+
* Whether the request should be run through the queue.
|
|
2427
|
+
* Useful for routes which do not have any rate limits.
|
|
2428
|
+
*/
|
|
2429
|
+
runThroughQueue?: boolean;
|
|
2370
2430
|
}
|
|
2371
2431
|
export interface RestRateLimitedPath {
|
|
2372
2432
|
url: string;
|