@discordeno/rest 19.0.0-next.fd518cb → 19.0.0-next.fda3003
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/cjs/index.cjs +25 -0
- package/dist/cjs/invalidBucket.cjs +87 -0
- package/dist/cjs/manager.cjs +1446 -0
- package/dist/cjs/queue.cjs +166 -0
- package/dist/cjs/routes.cjs +581 -0
- package/dist/cjs/types.cjs +6 -0
- package/dist/cjs/typings/routes.cjs +6 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/invalidBucket.js +83 -0
- package/dist/esm/manager.js +1404 -0
- package/dist/esm/queue.js +156 -0
- package/dist/esm/routes.js +571 -0
- package/dist/esm/types.js +3 -0
- package/dist/esm/typings/routes.js +3 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/{invalidBucket.d.ts → types/invalidBucket.d.ts} +5 -0
- package/dist/types/invalidBucket.d.ts.map +1 -0
- package/dist/types/manager.d.ts.map +1 -0
- package/dist/{queue.d.ts → types/queue.d.ts} +12 -0
- package/dist/types/queue.d.ts.map +1 -0
- package/dist/types/routes.d.ts.map +1 -0
- package/dist/{types.d.ts → types/types.d.ts} +446 -110
- package/dist/types/types.d.ts.map +1 -0
- package/dist/{typings → types/typings}/routes.d.ts +46 -5
- package/dist/types/typings/routes.d.ts.map +1 -0
- package/package.json +29 -23
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -8
- package/dist/index.js.map +0 -1
- package/dist/invalidBucket.d.ts.map +0 -1
- package/dist/invalidBucket.js +0 -82
- package/dist/invalidBucket.js.map +0 -1
- package/dist/manager.d.ts.map +0 -1
- package/dist/manager.js +0 -1102
- package/dist/manager.js.map +0 -1
- package/dist/queue.d.ts.map +0 -1
- package/dist/queue.js +0 -153
- package/dist/queue.js.map +0 -1
- package/dist/routes.d.ts.map +0 -1
- package/dist/routes.js +0 -487
- package/dist/routes.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
- package/dist/typings/routes.d.ts.map +0 -1
- package/dist/typings/routes.js +0 -3
- package/dist/typings/routes.js.map +0 -1
- /package/dist/{index.d.ts → types/index.d.ts} +0 -0
- /package/dist/{manager.d.ts → types/manager.d.ts} +0 -0
- /package/dist/{routes.d.ts → types/routes.d.ts} +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { ApplicationCommandPermissions, AtLeastOne, BeginGuildPrune, BigString, Camelize, CamelizedDiscordActiveThreads, CamelizedDiscordApplication, CamelizedDiscordApplicationCommand,
|
|
1
|
+
import type { AddDmRecipientOptions, AddGuildMemberOptions, ApplicationCommandPermissions, AtLeastOne, BeginGuildPrune, BigString, Camelize, CamelizedDiscordAccessTokenResponse, CamelizedDiscordActiveThreads, CamelizedDiscordApplication, CamelizedDiscordApplicationCommand, CamelizedDiscordApplicationRoleConnection, CamelizedDiscordArchivedThreads, CamelizedDiscordAuditLog, CamelizedDiscordAutoModerationRule, CamelizedDiscordBan, CamelizedDiscordChannel, CamelizedDiscordConnection, CamelizedDiscordCurrentAuthorization, CamelizedDiscordEmoji, CamelizedDiscordEntitlement, CamelizedDiscordFollowedChannel, CamelizedDiscordGetAnswerVotesResponse, CamelizedDiscordGetGatewayBot, CamelizedDiscordGuild, CamelizedDiscordGuildApplicationCommandPermissions, CamelizedDiscordGuildOnboarding, CamelizedDiscordGuildPreview, CamelizedDiscordGuildWidget, CamelizedDiscordGuildWidgetSettings, CamelizedDiscordIntegration, CamelizedDiscordInvite, CamelizedDiscordInviteMetadata, CamelizedDiscordMember, CamelizedDiscordMemberWithUser, CamelizedDiscordMessage, CamelizedDiscordModifyGuildWelcomeScreen, CamelizedDiscordPartialGuild, CamelizedDiscordPrunedCount, CamelizedDiscordRole, CamelizedDiscordScheduledEvent, CamelizedDiscordSku, CamelizedDiscordStageInstance, CamelizedDiscordSticker, CamelizedDiscordStickerPack, CamelizedDiscordTemplate, CamelizedDiscordThreadMember, CamelizedDiscordTokenExchange, CamelizedDiscordTokenRevocation, CamelizedDiscordUser, CamelizedDiscordVanityUrl, CamelizedDiscordVoiceRegion, CamelizedDiscordWebhook, CamelizedDiscordWelcomeScreen, CreateApplicationCommand, CreateAutoModerationRuleOptions, CreateChannelInvite, CreateEntitlement, CreateForumPostWithMessage, CreateGlobalApplicationCommandOptions, CreateGuild, CreateGuildApplicationCommandOptions, CreateGuildBan, CreateGuildBulkBan, CreateGuildChannel, CreateGuildEmoji, CreateGuildFromTemplate, CreateGuildRole, CreateGuildStickerOptions, CreateMessageOptions, CreateScheduledEvent, CreateStageInstance, CreateTemplate, DeleteWebhookMessageOptions, DiscordBulkBan, EditApplication, EditAutoModerationRuleOptions, EditBotMemberOptions, EditChannelPermissionOverridesOptions, EditGuildOnboarding, EditGuildRole, EditGuildStickerOptions, EditMessage, EditOwnVoiceState, EditScheduledEvent, EditUserVoiceState, ExecuteWebhook, FileContent, GetApplicationCommandPermissionOptions, GetBans, GetEntitlements, GetGroupDmOptions, GetGuildAuditLog, GetGuildPruneCountQuery, GetInvite, GetMessagesOptions, GetPollAnswerVotes, GetReactions, GetScheduledEventUsers, GetScheduledEvents, GetUserGuilds, GetWebhookMessageOptions, InteractionCallbackData, InteractionResponse, ListArchivedThreads, ListGuildMembers, MfaLevels, ModifyChannel, ModifyGuild, ModifyGuildChannelPositions, ModifyGuildEmoji, ModifyGuildMember, ModifyGuildTemplate, ModifyRolePositions, ModifyWebhook, SearchMembers, StartThreadWithMessage, StartThreadWithoutMessage, UpsertGlobalApplicationCommandOptions, UpsertGuildApplicationCommandOptions } from '@discordeno/types';
|
|
2
|
+
import type { logger } from '@discordeno/utils';
|
|
2
3
|
import type { InvalidRequestBucket } from './invalidBucket.js';
|
|
3
4
|
import type { Queue } from './queue.js';
|
|
4
5
|
import type { RestRoutes } from './typings/routes.js';
|
|
5
6
|
export interface CreateRestManagerOptions {
|
|
6
7
|
/** The bot token which will be used to make requests. */
|
|
7
|
-
token
|
|
8
|
+
token: string;
|
|
8
9
|
/**
|
|
9
10
|
* For old bots that have a different bot id and application id.
|
|
10
11
|
* @default bot id from token
|
|
@@ -18,18 +19,42 @@ export interface CreateRestManagerOptions {
|
|
|
18
19
|
* @default https://discord.com/api
|
|
19
20
|
*/
|
|
20
21
|
baseUrl: string;
|
|
21
|
-
/** The authorization header to attach when sending requests to the proxy. */
|
|
22
|
+
/** The authorization header value to attach when sending requests to the proxy. */
|
|
22
23
|
authorization: string;
|
|
24
|
+
/**
|
|
25
|
+
* The authorization header name to use when sending requests to the proxy
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* If the `authorization` header is used it will override any authorization that is given even if
|
|
29
|
+
* the requests uses OAuth2 Bearer tokens / Basic tokens
|
|
30
|
+
*
|
|
31
|
+
* @default "authorization" // For compatibility purposes
|
|
32
|
+
*/
|
|
33
|
+
authorizationHeader?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The endpoint to use in the rest proxy to update the bearer tokens
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* Should not include a `/` in the start
|
|
39
|
+
*
|
|
40
|
+
* This value is actually required if you want to use `updateTokenQueues`
|
|
41
|
+
*/
|
|
42
|
+
updateBearerTokenEndpoint?: string;
|
|
23
43
|
};
|
|
24
44
|
/**
|
|
25
45
|
* The api versions which can be used to make requests.
|
|
26
46
|
* @default 10
|
|
27
47
|
*/
|
|
28
48
|
version?: ApiVersions;
|
|
49
|
+
/**
|
|
50
|
+
* The logger that the rest manager will use
|
|
51
|
+
* @default logger // The logger exported by `@discordeno/utils`
|
|
52
|
+
*/
|
|
53
|
+
logger?: Pick<typeof logger, 'debug' | 'info' | 'warn' | 'error' | 'fatal'>;
|
|
29
54
|
}
|
|
30
55
|
export interface RestManager {
|
|
31
56
|
/** The bot token which will be used to make requests. */
|
|
32
|
-
token
|
|
57
|
+
token: string;
|
|
33
58
|
/** 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
59
|
applicationId: bigint;
|
|
35
60
|
/** The api version to use when making requests. Only the latest supported version will be tested. */
|
|
@@ -46,8 +71,12 @@ export interface RestManager {
|
|
|
46
71
|
* Mostly used only for intern functions.
|
|
47
72
|
*/
|
|
48
73
|
isProxied: boolean;
|
|
49
|
-
/** The authorization header to attach when sending requests to the proxy. */
|
|
74
|
+
/** The authorization header value to attach when sending requests to the proxy. */
|
|
50
75
|
authorization?: string;
|
|
76
|
+
/** The authorization header name to attach when sending requests to the proxy */
|
|
77
|
+
authorizationHeader: string;
|
|
78
|
+
/** The endpoint to use for `updateTokenQueues` when working with a rest proxy */
|
|
79
|
+
updateBearerTokenEndpoint?: string;
|
|
51
80
|
/** The maximum amount of times a request should be retried. Defaults to Infinity */
|
|
52
81
|
maxRetryCount: number;
|
|
53
82
|
/** Whether or not the manager is rate limited globally across all requests. Defaults to false. */
|
|
@@ -64,8 +93,15 @@ export interface RestManager {
|
|
|
64
93
|
invalidBucket: InvalidRequestBucket;
|
|
65
94
|
/** The routes that are available for this manager. */
|
|
66
95
|
routes: RestRoutes;
|
|
96
|
+
/** The logger to use for the rest manager */
|
|
97
|
+
logger: Pick<typeof logger, 'debug' | 'info' | 'warn' | 'error' | 'fatal'>;
|
|
98
|
+
/** Allows the user to inject custom headers that will be sent with every request. */
|
|
99
|
+
createBaseHeaders: () => Record<string, string>;
|
|
100
|
+
/** Whether or not the rest manager should keep objects in raw snake case from discord. */
|
|
101
|
+
preferSnakeCase: (enabled: boolean) => RestManager;
|
|
67
102
|
/** Check the rate limits for a url or a bucket. */
|
|
68
|
-
checkRateLimits: (url: string) => number | false;
|
|
103
|
+
checkRateLimits: (url: string, requestAuthorization: string) => number | false;
|
|
104
|
+
updateTokenQueues: (oldToken: string, newToken: string) => Promise<void>;
|
|
69
105
|
/** Reshapes and modifies the obj as needed to make it ready for discords api. */
|
|
70
106
|
changeToDiscordFormat: (obj: any) => any;
|
|
71
107
|
/** Creates the request body and headers that are necessary to send a request. Will handle different types of methods and everything necessary for discord. */
|
|
@@ -73,7 +109,7 @@ export interface RestManager {
|
|
|
73
109
|
/** 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. */
|
|
74
110
|
processRateLimitedPaths: () => void;
|
|
75
111
|
/** Processes the rate limit headers and determines if it needs to be rate limited and returns the bucket id if available */
|
|
76
|
-
processHeaders: (url: string, headers: Headers) => string | undefined;
|
|
112
|
+
processHeaders: (url: string, headers: Headers, requestAuthorization: string) => string | undefined;
|
|
77
113
|
/** Sends a request to the api. */
|
|
78
114
|
sendRequest: (options: SendRequestOptions) => Promise<void>;
|
|
79
115
|
/** Split a url to separate rate limit buckets based on major/minor parameters. */
|
|
@@ -161,6 +197,35 @@ export interface RestManager {
|
|
|
161
197
|
* @see {@link https://discord.com/developers/docs/resources/channel#add-thread-member}
|
|
162
198
|
*/
|
|
163
199
|
addThreadMember: (channelId: BigString, userId: BigString) => Promise<void>;
|
|
200
|
+
/**
|
|
201
|
+
* Adds a recipient to a group DM.
|
|
202
|
+
*
|
|
203
|
+
* @param channelId - The ID of the group dm to add the user to.
|
|
204
|
+
* @param userId - The user ID of the user to add to the group dm.
|
|
205
|
+
* @param options - The options for adding the user
|
|
206
|
+
*
|
|
207
|
+
* @remarks
|
|
208
|
+
* Requires an OAuth2 access token with the `gdm.join` scope
|
|
209
|
+
*
|
|
210
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#group-dm-add-recipient}
|
|
211
|
+
*/
|
|
212
|
+
addDmRecipient: (channelId: BigString, userId: BigString, options: AddDmRecipientOptions) => Promise<void>;
|
|
213
|
+
/**
|
|
214
|
+
* Adds a member to a guild.
|
|
215
|
+
*
|
|
216
|
+
* @param guildId - The ID of the thread to add the member to.
|
|
217
|
+
* @param userId - The user ID of the member to add to the thread.
|
|
218
|
+
* @param options - The options for the add of a guild member
|
|
219
|
+
*
|
|
220
|
+
* @remarks
|
|
221
|
+
* Requires the bot to be in the specified server
|
|
222
|
+
* Requires an OAuth2 access token with the `guilds.join` scope
|
|
223
|
+
*
|
|
224
|
+
* Fires a _Guild Member Add_ gateway event.
|
|
225
|
+
*
|
|
226
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#add-guild-member}
|
|
227
|
+
*/
|
|
228
|
+
addGuildMember: (guildId: BigString, userId: BigString, options: AddGuildMemberOptions) => Promise<void>;
|
|
164
229
|
/**
|
|
165
230
|
* Creates an automod rule in a guild.
|
|
166
231
|
*
|
|
@@ -206,7 +271,7 @@ export interface RestManager {
|
|
|
206
271
|
* @returns An instance of the created {@link CamelizedDiscordEmoji}.
|
|
207
272
|
*
|
|
208
273
|
* @remarks
|
|
209
|
-
* Requires the `
|
|
274
|
+
* Requires the `CREATE_GUILD_EXPRESSIONS` permission.
|
|
210
275
|
*
|
|
211
276
|
* Emojis have a maximum file size of 256 kilobits. Attempting to upload a larger emoji will cause the route to return 400 Bad Request.
|
|
212
277
|
*
|
|
@@ -216,12 +281,12 @@ export interface RestManager {
|
|
|
216
281
|
*/
|
|
217
282
|
createEmoji: (guildId: BigString, options: CreateGuildEmoji, reason?: string) => Promise<CamelizedDiscordEmoji>;
|
|
218
283
|
/**
|
|
219
|
-
* Creates a new thread in a forum channel, and sends a message within the created thread.
|
|
284
|
+
* Creates a new thread in a forum channel or media channel, and sends a message within the created thread.
|
|
220
285
|
*
|
|
221
286
|
* @param channelId - The ID of the forum channel to create the thread within.
|
|
222
287
|
* @param options - The parameters for the creation of the thread.
|
|
223
288
|
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
224
|
-
* @returns An instance of {@link CamelizedDiscordChannel} with a nested {@link
|
|
289
|
+
* @returns An instance of {@link CamelizedDiscordChannel} with a nested {@link CamelizedDiscordChannel} object.
|
|
225
290
|
*
|
|
226
291
|
* @remarks
|
|
227
292
|
* Requires the `CREATE_MESSAGES` permission.
|
|
@@ -229,25 +294,27 @@ export interface RestManager {
|
|
|
229
294
|
* Fires a _Thread Create_ gateway event.
|
|
230
295
|
* Fires a _Message Create_ gateway event.
|
|
231
296
|
*
|
|
232
|
-
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-channel}
|
|
233
|
-
*
|
|
234
|
-
* @experimental
|
|
297
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel}
|
|
235
298
|
*/
|
|
236
299
|
createForumThread: (channelId: BigString, options: CreateForumPostWithMessage, reason?: string) => Promise<CamelizedDiscordChannel>;
|
|
237
300
|
/**
|
|
238
301
|
* Creates an application command accessible globally; across different guilds and channels.
|
|
239
302
|
*
|
|
240
303
|
* @param command - The command to create.
|
|
241
|
-
* @
|
|
304
|
+
* @param options - Additional options for the endpoint
|
|
305
|
+
* @returns An instance of the created {@link CamelizedDiscordApplicationCommand}.
|
|
242
306
|
*
|
|
243
307
|
* @remarks
|
|
244
308
|
* ⚠️ Creating a command with the same name as an existing command for your application will overwrite the old command.
|
|
245
309
|
* ⚠️ Global commands once created are cached for periods of __an hour__, so changes made to existing commands will take an hour to surface.
|
|
246
310
|
* ⚠️ You can only create up to 200 _new_ commands daily.
|
|
247
311
|
*
|
|
312
|
+
* When using the bearer token the token needs the `applications.commands.update` scope and must be a `Client grant` token.
|
|
313
|
+
* You will be able to update only your own application commands
|
|
314
|
+
*
|
|
248
315
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#create-global-application-command}
|
|
249
316
|
*/
|
|
250
|
-
createGlobalApplicationCommand: (command: CreateApplicationCommand) => Promise<CamelizedDiscordApplicationCommand>;
|
|
317
|
+
createGlobalApplicationCommand: (command: CreateApplicationCommand, options?: CreateGlobalApplicationCommandOptions) => Promise<CamelizedDiscordApplicationCommand>;
|
|
251
318
|
/**
|
|
252
319
|
* Creates a guild.
|
|
253
320
|
*
|
|
@@ -267,21 +334,25 @@ export interface RestManager {
|
|
|
267
334
|
*
|
|
268
335
|
* @param command - The command to create.
|
|
269
336
|
* @param guildId - The ID of the guild to create the command for.
|
|
270
|
-
* @
|
|
337
|
+
* @param options - Additional options for the endpoint
|
|
338
|
+
* @returns An instance of the created {@link CamelizedDiscordApplicationCommand}.
|
|
271
339
|
*
|
|
272
340
|
* @remarks
|
|
273
341
|
* ⚠️ Creating a command with the same name as an existing command for your application will overwrite the old command.
|
|
274
342
|
* ⚠️ You can only create up to 200 _new_ commands daily.
|
|
275
343
|
*
|
|
344
|
+
* When using the bearer token the token needs the `applications.commands.update` scope and must be a `Client grant` token.
|
|
345
|
+
* You will be able to update only your own application commands
|
|
346
|
+
*
|
|
276
347
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command}
|
|
277
348
|
*/
|
|
278
|
-
createGuildApplicationCommand: (command: CreateApplicationCommand, guildId: BigString) => Promise<CamelizedDiscordApplicationCommand>;
|
|
349
|
+
createGuildApplicationCommand: (command: CreateApplicationCommand, guildId: BigString, options?: CreateGuildApplicationCommandOptions) => Promise<CamelizedDiscordApplicationCommand>;
|
|
279
350
|
/**
|
|
280
351
|
* Creates a guild from a template.
|
|
281
352
|
*
|
|
282
353
|
* @param templateCode - The code of the template.
|
|
283
354
|
* @param options - The parameters for the creation of the guild.
|
|
284
|
-
* @returns An instance of the created {@link
|
|
355
|
+
* @returns An instance of the created {@link CamelizedDiscordGuild}.
|
|
285
356
|
*
|
|
286
357
|
* @remarks
|
|
287
358
|
* ⚠️ This route can only be used by bots in __fewer than 10 guilds__.
|
|
@@ -299,7 +370,7 @@ export interface RestManager {
|
|
|
299
370
|
* @return A {@link CamelizedDiscordSticker}
|
|
300
371
|
*
|
|
301
372
|
* @remarks
|
|
302
|
-
* Requires the `
|
|
373
|
+
* Requires the `CREATE_GUILD_EXPRESSIONS` permission.
|
|
303
374
|
* Fires a Guild Stickers Update Gateway event.
|
|
304
375
|
* Every guilds has five free sticker slots by default, and each Boost level will grant access to more slots.
|
|
305
376
|
* Lottie stickers can only be uploaded on guilds that have either the `VERIFIED` and/or the `PARTNERED` guild feature.
|
|
@@ -312,7 +383,7 @@ export interface RestManager {
|
|
|
312
383
|
*
|
|
313
384
|
* @param guildId - The ID of the guild to create the template from.
|
|
314
385
|
* @param options - The parameters for the creation of the template.
|
|
315
|
-
* @returns An instance of the created {@link
|
|
386
|
+
* @returns An instance of the created {@link CamelizedDiscordTemplate}.
|
|
316
387
|
*
|
|
317
388
|
* @remarks
|
|
318
389
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -363,12 +434,12 @@ export interface RestManager {
|
|
|
363
434
|
* @param guildId - The ID of the guild to create the scheduled event in.
|
|
364
435
|
* @param options - The parameters for the creation of the scheduled event.
|
|
365
436
|
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
366
|
-
* @returns An instance of the created {@link
|
|
437
|
+
* @returns An instance of the created {@link CamelizedDiscordScheduledEvent}.
|
|
367
438
|
*
|
|
368
439
|
* @remarks
|
|
369
440
|
* Requires the `MANAGE_EVENTS` permission.
|
|
370
441
|
*
|
|
371
|
-
* A guild can only have a maximum of 100 events with a status of {@link ScheduledEventStatus.Active
|
|
442
|
+
* A guild can only have a maximum of 100 events with a status of {@link ScheduledEventStatus}.Active or {@link ScheduledEventStatus}.Scheduled (inclusive).
|
|
372
443
|
*
|
|
373
444
|
* Fires a _Guild Scheduled Event Create_ gateway event.
|
|
374
445
|
*
|
|
@@ -428,7 +499,7 @@ export interface RestManager {
|
|
|
428
499
|
*
|
|
429
500
|
* @param channelId - The ID of the channel to delete.
|
|
430
501
|
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
431
|
-
* @returns
|
|
502
|
+
* @returns nothing
|
|
432
503
|
*
|
|
433
504
|
* @remarks
|
|
434
505
|
* For community guilds, the _Rules_, _Guidelines_ and _Community Update_ channels cannot be deleted.
|
|
@@ -472,7 +543,8 @@ export interface RestManager {
|
|
|
472
543
|
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
473
544
|
*
|
|
474
545
|
* @remarks
|
|
475
|
-
*
|
|
546
|
+
* For emojis created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
547
|
+
* For other emojis, requires the `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
476
548
|
*
|
|
477
549
|
* Fires a _Guild Emojis Update_ gateway event.
|
|
478
550
|
*
|
|
@@ -531,7 +603,8 @@ export interface RestManager {
|
|
|
531
603
|
* @return A {@link CamelizedDiscordSticker}
|
|
532
604
|
*
|
|
533
605
|
* @remarks
|
|
534
|
-
*
|
|
606
|
+
* For stickers created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
607
|
+
* For other stickers, requires the `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
535
608
|
* Fires a Guild Stickers Update Gateway event.
|
|
536
609
|
* Every guilds has five free sticker slots by default, and each Boost level will grant access to more slots.
|
|
537
610
|
* Lottie stickers can only be uploaded on guilds that have either the `VERIFIED` and/or the `PARTNERED` guild feature.
|
|
@@ -786,14 +859,14 @@ export interface RestManager {
|
|
|
786
859
|
* @param commandId - The ID of the command to edit the permissions of.
|
|
787
860
|
* @param bearerToken - The bearer token to use to make the request.
|
|
788
861
|
* @param options - The parameters for the edit of the command permissions.
|
|
789
|
-
* @returns An instance of the edited {@link
|
|
862
|
+
* @returns An instance of the edited {@link CamelizedDiscordGuildApplicationCommandPermissions}.
|
|
790
863
|
*
|
|
791
864
|
* @remarks
|
|
792
865
|
* 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.
|
|
793
866
|
*
|
|
794
867
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions}
|
|
795
868
|
*/
|
|
796
|
-
editApplicationCommandPermissions: (guildId: BigString, commandId: BigString, bearerToken: string, options: ApplicationCommandPermissions[]) => Promise<
|
|
869
|
+
editApplicationCommandPermissions: (guildId: BigString, commandId: BigString, bearerToken: string, options: ApplicationCommandPermissions[]) => Promise<CamelizedDiscordGuildApplicationCommandPermissions>;
|
|
797
870
|
/**
|
|
798
871
|
* Edits an automod rule.
|
|
799
872
|
*
|
|
@@ -812,12 +885,13 @@ export interface RestManager {
|
|
|
812
885
|
*/
|
|
813
886
|
editAutomodRule: (guildId: BigString, ruleId: BigString, options: Partial<EditAutoModerationRuleOptions>, reason?: string) => Promise<CamelizedDiscordAutoModerationRule>;
|
|
814
887
|
/**
|
|
815
|
-
* Modifies the bot's username or
|
|
888
|
+
* Modifies the bot's username, avatar or banner.
|
|
816
889
|
* NOTE: username: if changed may cause the bot's discriminator to be randomized.
|
|
817
890
|
*/
|
|
818
891
|
editBotProfile: (options: {
|
|
819
892
|
username?: string;
|
|
820
893
|
botAvatarURL?: string | null;
|
|
894
|
+
botBannerURL?: string | null;
|
|
821
895
|
}) => Promise<CamelizedDiscordUser>;
|
|
822
896
|
/**
|
|
823
897
|
* Edits a channel's settings.
|
|
@@ -828,7 +902,7 @@ export interface RestManager {
|
|
|
828
902
|
* @returns An instance of the edited {@link CamelizedDiscordChannel}.
|
|
829
903
|
*
|
|
830
904
|
* @remarks
|
|
831
|
-
* If editing a channel of type {@link ChannelTypes.GroupDm
|
|
905
|
+
* If editing a channel of type {@link ChannelTypes}.GroupDm:
|
|
832
906
|
* - Fires a _Channel Update_ gateway event.
|
|
833
907
|
*
|
|
834
908
|
* If editing a thread channel:
|
|
@@ -844,7 +918,7 @@ export interface RestManager {
|
|
|
844
918
|
*
|
|
845
919
|
* - 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.
|
|
846
920
|
*
|
|
847
|
-
* - If modifying a channel of type {@link ChannelTypes.GuildCategory
|
|
921
|
+
* - If modifying a channel of type {@link ChannelTypes}.GuildCategory:
|
|
848
922
|
* - Fires a _Channel Update_ gateway event for each child channel impacted in this change.
|
|
849
923
|
* - Otherwise:
|
|
850
924
|
* - Fires a _Channel Update_ gateway event.
|
|
@@ -891,7 +965,8 @@ export interface RestManager {
|
|
|
891
965
|
* @returns An instance of the updated {@link CamelizedDiscordEmoji}.
|
|
892
966
|
*
|
|
893
967
|
* @remarks
|
|
894
|
-
*
|
|
968
|
+
* For emojis created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
969
|
+
* For other emojis, requires the `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
895
970
|
*
|
|
896
971
|
* Fires a `Guild Emojis Update` gateway event.
|
|
897
972
|
*
|
|
@@ -904,7 +979,7 @@ export interface RestManager {
|
|
|
904
979
|
* @param token - The interaction token to use, provided in the original interaction.
|
|
905
980
|
* @param messageId - The ID of the message to edit.
|
|
906
981
|
* @param options - The parameters for the edit of the message.
|
|
907
|
-
* @returns An instance of the edited {@link
|
|
982
|
+
* @returns An instance of the edited {@link CamelizedDiscordMessage}.
|
|
908
983
|
*
|
|
909
984
|
* @remarks
|
|
910
985
|
* Unlike `editMessage()`, this endpoint allows the bot user to act without needing to see the channel the message is in.
|
|
@@ -921,7 +996,7 @@ export interface RestManager {
|
|
|
921
996
|
*
|
|
922
997
|
* @param commandId - The ID of the command to edit.
|
|
923
998
|
* @param options - The parameters for the edit of the command.
|
|
924
|
-
* @returns An instance of the edited {@link
|
|
999
|
+
* @returns An instance of the edited {@link CamelizedDiscordApplicationCommand}.
|
|
925
1000
|
*
|
|
926
1001
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command}
|
|
927
1002
|
*/
|
|
@@ -933,12 +1008,12 @@ export interface RestManager {
|
|
|
933
1008
|
* @param shardId - The ID of the shard the guild is in.
|
|
934
1009
|
* @param options - The parameters for the edit of the guild.
|
|
935
1010
|
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
936
|
-
* @returns An instance of the edited {@link
|
|
1011
|
+
* @returns An instance of the edited {@link CamelizedDiscordGuild}.
|
|
937
1012
|
*
|
|
938
1013
|
* @remarks
|
|
939
1014
|
* Requires the `MANAGE_GUILD` permission.
|
|
940
1015
|
*
|
|
941
|
-
* If attempting to add or remove the {@link GuildFeatures.Community
|
|
1016
|
+
* If attempting to add or remove the {@link GuildFeatures}.Community feature:
|
|
942
1017
|
* - Requires the `ADMINISTRATOR` permission.
|
|
943
1018
|
*
|
|
944
1019
|
* Fires a _Guild Update_ gateway event.
|
|
@@ -952,7 +1027,7 @@ export interface RestManager {
|
|
|
952
1027
|
* @param guildId - The ID of the guild the command is registered in.
|
|
953
1028
|
* @param commandId - The ID of the command to edit.
|
|
954
1029
|
* @param options - The parameters for the edit of the command.
|
|
955
|
-
* @returns An instance of the edited {@link
|
|
1030
|
+
* @returns An instance of the edited {@link CamelizedDiscordApplicationCommand}.
|
|
956
1031
|
*
|
|
957
1032
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command}
|
|
958
1033
|
*/
|
|
@@ -969,7 +1044,8 @@ export interface RestManager {
|
|
|
969
1044
|
* @return A {@link CamelizedDiscordSticker}
|
|
970
1045
|
*
|
|
971
1046
|
* @remarks
|
|
972
|
-
*
|
|
1047
|
+
* For stickers created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
1048
|
+
* For other stickers, requires the `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
973
1049
|
* Fires a Guild Stickers Update Gateway event.
|
|
974
1050
|
*
|
|
975
1051
|
* @see {@link https://discord.com/developers/docs/resources/sticker#modify-guild-sticker}
|
|
@@ -981,7 +1057,7 @@ export interface RestManager {
|
|
|
981
1057
|
* @param guildId - The ID of the guild to edit a template of.
|
|
982
1058
|
* @param templateCode - The code of the template to edit.
|
|
983
1059
|
* @param options - The parameters for the edit of the template.
|
|
984
|
-
* @returns An instance of the edited {@link
|
|
1060
|
+
* @returns An instance of the edited {@link CamelizedDiscordTemplate}.
|
|
985
1061
|
*
|
|
986
1062
|
* @remarks
|
|
987
1063
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -997,7 +1073,7 @@ export interface RestManager {
|
|
|
997
1073
|
* @param channelId - The ID of the channel to edit the message in.
|
|
998
1074
|
* @param messageId - The IDs of the message to edit.
|
|
999
1075
|
* @param options - The parameters for the edit of the message.
|
|
1000
|
-
* @returns An instance of the edited {@link
|
|
1076
|
+
* @returns An instance of the edited {@link CamelizedDiscordMessage}.
|
|
1001
1077
|
*
|
|
1002
1078
|
* @remarks
|
|
1003
1079
|
* If editing another user's message:
|
|
@@ -1014,7 +1090,7 @@ export interface RestManager {
|
|
|
1014
1090
|
*
|
|
1015
1091
|
* @param token - The interaction token to use, provided in the original interaction.
|
|
1016
1092
|
* @param options - The parameters for the edit of the response.
|
|
1017
|
-
* @returns An instance of the edited {@link
|
|
1093
|
+
* @returns An instance of the edited {@link CamelizedDiscordMessage}.
|
|
1018
1094
|
*
|
|
1019
1095
|
* @remarks
|
|
1020
1096
|
* Unlike `editMessage()`, this endpoint allows the bot user to act without needing to see the channel the message is in.
|
|
@@ -1025,7 +1101,7 @@ export interface RestManager {
|
|
|
1025
1101
|
*
|
|
1026
1102
|
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response}
|
|
1027
1103
|
*/
|
|
1028
|
-
editOriginalInteractionResponse: (token: string, options: InteractionCallbackData) => Promise<CamelizedDiscordMessage
|
|
1104
|
+
editOriginalInteractionResponse: (token: string, options: InteractionCallbackData) => Promise<CamelizedDiscordMessage>;
|
|
1029
1105
|
/**
|
|
1030
1106
|
* Edits the original webhook message.
|
|
1031
1107
|
*
|
|
@@ -1099,14 +1175,14 @@ export interface RestManager {
|
|
|
1099
1175
|
* @param guildId - The ID of the guild to edit the scheduled event in.
|
|
1100
1176
|
* @param eventId - The ID of the scheduled event to edit.
|
|
1101
1177
|
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
1102
|
-
* @returns An instance of the edited {@link
|
|
1178
|
+
* @returns An instance of the edited {@link CamelizedDiscordScheduledEvent}.
|
|
1103
1179
|
*
|
|
1104
1180
|
* @remarks
|
|
1105
1181
|
* Requires the `MANAGE_EVENTS` permission.
|
|
1106
1182
|
*
|
|
1107
1183
|
* To start or end an event, modify the event's `status` property.
|
|
1108
1184
|
*
|
|
1109
|
-
* The `entity_metadata` property is discarded for events whose `entity_type` is not {@link ScheduledEventEntityType.External
|
|
1185
|
+
* The `entity_metadata` property is discarded for events whose `entity_type` is not {@link ScheduledEventEntityType}.External.
|
|
1110
1186
|
*
|
|
1111
1187
|
* Fires a _Guild Scheduled Event Update_ gateway event.
|
|
1112
1188
|
*
|
|
@@ -1143,6 +1219,20 @@ export interface RestManager {
|
|
|
1143
1219
|
* @see {@link https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state}
|
|
1144
1220
|
*/
|
|
1145
1221
|
editUserVoiceState: (guildId: BigString, options: EditUserVoiceState) => Promise<void>;
|
|
1222
|
+
/**
|
|
1223
|
+
* Edit the current user application role connection for the application.
|
|
1224
|
+
*
|
|
1225
|
+
* @param bearerToken - The access token of the user
|
|
1226
|
+
* @param applicationId - The id of the application to edit the role connection
|
|
1227
|
+
* @param options - The options to edit
|
|
1228
|
+
* @returns {CamelizedDiscordApplicationRoleConnection}
|
|
1229
|
+
*
|
|
1230
|
+
* @remarks
|
|
1231
|
+
* This requires the `role_connections.write` scope.
|
|
1232
|
+
*
|
|
1233
|
+
* @see {@link https://discord.com/developers/docs/resources/user#update-user-application-role-connection}
|
|
1234
|
+
*/
|
|
1235
|
+
editUserApplicationRoleConnection: (bearerToken: string, applicationId: BigString, options: CamelizedDiscordApplicationRoleConnection) => Promise<CamelizedDiscordApplicationRoleConnection>;
|
|
1146
1236
|
/**
|
|
1147
1237
|
* Edits a webhook.
|
|
1148
1238
|
*
|
|
@@ -1196,7 +1286,7 @@ export interface RestManager {
|
|
|
1196
1286
|
* @param guildId - The ID of the guild to edit the welcome screen of.
|
|
1197
1287
|
* @param options - The parameters for the edit of the welcome screen.
|
|
1198
1288
|
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
1199
|
-
* @returns An instance of the edited {@link
|
|
1289
|
+
* @returns An instance of the edited {@link CamelizedDiscordWelcomeScreen}.
|
|
1200
1290
|
*
|
|
1201
1291
|
* @remarks
|
|
1202
1292
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -1211,7 +1301,7 @@ export interface RestManager {
|
|
|
1211
1301
|
*
|
|
1212
1302
|
* @param guildId - The ID of the guild to edit the settings of the widget of.
|
|
1213
1303
|
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
1214
|
-
* @returns An instance of the edited {@link
|
|
1304
|
+
* @returns An instance of the edited {@link CamelizedDiscordGuildWidgetSettings}.
|
|
1215
1305
|
*
|
|
1216
1306
|
* @remarks
|
|
1217
1307
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -1240,6 +1330,7 @@ export interface RestManager {
|
|
|
1240
1330
|
*
|
|
1241
1331
|
* @param sourceChannelId - The ID of the announcement channel to follow.
|
|
1242
1332
|
* @param targetChannelId - The ID of the target channel - the channel to cross-post to.
|
|
1333
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
1243
1334
|
* @returns An instance of {@link CamelizedDiscordFollowedChannel}.
|
|
1244
1335
|
*
|
|
1245
1336
|
* @remarks
|
|
@@ -1249,7 +1340,7 @@ export interface RestManager {
|
|
|
1249
1340
|
*
|
|
1250
1341
|
* @see {@link https://discord.com/developers/docs/resources/channel#follow-announcement-channel}
|
|
1251
1342
|
*/
|
|
1252
|
-
followAnnouncement: (sourceChannelId: BigString, targetChannelId: BigString) => Promise<CamelizedDiscordFollowedChannel>;
|
|
1343
|
+
followAnnouncement: (sourceChannelId: BigString, targetChannelId: BigString, reason?: string) => Promise<CamelizedDiscordFollowedChannel>;
|
|
1253
1344
|
/**
|
|
1254
1345
|
* Gets the list of all active threads for a guild.
|
|
1255
1346
|
*
|
|
@@ -1266,31 +1357,73 @@ export interface RestManager {
|
|
|
1266
1357
|
getActiveThreads: (guildId: BigString) => Promise<CamelizedDiscordActiveThreads>;
|
|
1267
1358
|
/** Get the applications info */
|
|
1268
1359
|
getApplicationInfo: () => Promise<CamelizedDiscordApplication>;
|
|
1360
|
+
/**
|
|
1361
|
+
* Edit properties of the app associated with the requesting bot user.
|
|
1362
|
+
*
|
|
1363
|
+
* @remarks
|
|
1364
|
+
* Only properties that are passed will be updated.
|
|
1365
|
+
*/
|
|
1366
|
+
editApplicationInfo: (body: EditApplication) => Promise<CamelizedDiscordApplication>;
|
|
1367
|
+
/**
|
|
1368
|
+
* Get the current authentication info for the authenticated user
|
|
1369
|
+
*
|
|
1370
|
+
* @param bearerToken - Any OAuth2 derived access token
|
|
1371
|
+
* @returns An instance of {@link CamelizedDiscordCurrentAuthorization}
|
|
1372
|
+
*
|
|
1373
|
+
* @remarks
|
|
1374
|
+
* The user object is not defined if the scopes do not include `identify`.
|
|
1375
|
+
* In the user object, if defined, the email is not included if the scopes do not include `email`
|
|
1376
|
+
*/
|
|
1377
|
+
getCurrentAuthenticationInfo: (bearerToken: string) => Promise<CamelizedDiscordCurrentAuthorization>;
|
|
1378
|
+
/**
|
|
1379
|
+
* Exchange the information to get a OAuth2 accessToken token
|
|
1380
|
+
*
|
|
1381
|
+
* @param clientId - Application's client id
|
|
1382
|
+
* @param clientSecret - application's client secret
|
|
1383
|
+
* @param options - The options to make the exchange with discord
|
|
1384
|
+
*/
|
|
1385
|
+
exchangeToken: (clientId: BigString, clientSecret: string, options: CamelizedDiscordTokenExchange) => Promise<CamelizedDiscordAccessTokenResponse>;
|
|
1386
|
+
/**
|
|
1387
|
+
* Revoke an access_token
|
|
1388
|
+
*
|
|
1389
|
+
* @param clientId - Application's client id
|
|
1390
|
+
* @param clientSecret - application's client secret
|
|
1391
|
+
* @param options - The options to revoke the access_token
|
|
1392
|
+
*/
|
|
1393
|
+
revokeToken: (clientId: BigString, clientSecret: string, options: CamelizedDiscordTokenRevocation) => Promise<void>;
|
|
1269
1394
|
/**
|
|
1270
1395
|
* Gets the permissions of a guild application command.
|
|
1271
1396
|
*
|
|
1272
1397
|
* @param guildId - The ID of the guild the command is registered in.
|
|
1273
1398
|
* @param commandId - The ID of the command to get the permissions of.
|
|
1274
|
-
* @
|
|
1399
|
+
* @param options - The OAuth2 related optional parameters for the endpoint
|
|
1400
|
+
* @returns An instance of {@link CamelizedDiscordGuildApplicationCommandPermissions}.
|
|
1401
|
+
*
|
|
1402
|
+
* @remarks
|
|
1403
|
+
* Then specifying the options object the access token passed-in requires the OAuth2 scope `applications.commands.permissions.update`
|
|
1275
1404
|
*
|
|
1276
1405
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions}
|
|
1277
1406
|
*/
|
|
1278
|
-
getApplicationCommandPermission: (guildId: BigString, commandId: BigString) => Promise<
|
|
1407
|
+
getApplicationCommandPermission: (guildId: BigString, commandId: BigString, options?: GetApplicationCommandPermissionOptions) => Promise<CamelizedDiscordGuildApplicationCommandPermissions>;
|
|
1279
1408
|
/**
|
|
1280
|
-
* Gets the permissions of all application commands registered in a guild by the ID of the guild.
|
|
1409
|
+
* Gets the permissions of all application commands registered in a guild by the ID of the guild and optionally an external application.
|
|
1281
1410
|
*
|
|
1282
1411
|
* @param guildId - The ID of the guild to get the permissions objects of.
|
|
1283
|
-
* @
|
|
1412
|
+
* @param options - The OAuth2 related optional parameters for the endpoint
|
|
1413
|
+
* @returns A collection of {@link CamelizedDiscordGuildApplicationCommandPermissions} objects assorted by command ID.
|
|
1414
|
+
*
|
|
1415
|
+
* @remarks
|
|
1416
|
+
* Then specifying the options object the access token passed-in requires the OAuth2 scope `applications.commands.permissions.update`
|
|
1284
1417
|
*
|
|
1285
1418
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions}
|
|
1286
1419
|
*/
|
|
1287
|
-
getApplicationCommandPermissions: (guildId: BigString) => Promise<
|
|
1420
|
+
getApplicationCommandPermissions: (guildId: BigString, options?: GetApplicationCommandPermissionOptions) => Promise<CamelizedDiscordGuildApplicationCommandPermissions[]>;
|
|
1288
1421
|
/**
|
|
1289
1422
|
* Gets a guild's audit log.
|
|
1290
1423
|
*
|
|
1291
1424
|
* @param guildId - The ID of the guild to get the audit log of.
|
|
1292
1425
|
* @param options - The parameters for the fetching of the audit log.
|
|
1293
|
-
* @returns An instance of {@link
|
|
1426
|
+
* @returns An instance of {@link CamelizedDiscordAuditLog}.
|
|
1294
1427
|
*
|
|
1295
1428
|
* @remarks
|
|
1296
1429
|
* Requires the `VIEW_AUDIT_LOG` permission.
|
|
@@ -1326,7 +1459,7 @@ export interface RestManager {
|
|
|
1326
1459
|
/**
|
|
1327
1460
|
* Gets the list of available voice regions.
|
|
1328
1461
|
*
|
|
1329
|
-
* @returns A collection of {@link
|
|
1462
|
+
* @returns A collection of {@link CamelizedDiscordVoiceRegion} objects assorted by voice region ID.
|
|
1330
1463
|
*/
|
|
1331
1464
|
getAvailableVoiceRegions: () => Promise<CamelizedDiscordVoiceRegion[]>;
|
|
1332
1465
|
/**
|
|
@@ -1364,7 +1497,7 @@ export interface RestManager {
|
|
|
1364
1497
|
* @returns An instance of {@link CamelizedDiscordChannel}.
|
|
1365
1498
|
*
|
|
1366
1499
|
* @remarks
|
|
1367
|
-
* If the channel is a thread, a {@link
|
|
1500
|
+
* If the channel is a thread, a {@link CamelizedDiscordThreadMember} object is included in the result.
|
|
1368
1501
|
*
|
|
1369
1502
|
* @see {@link https://discord.com/developers/docs/resources/channel#get-channel}
|
|
1370
1503
|
*/
|
|
@@ -1416,6 +1549,22 @@ export interface RestManager {
|
|
|
1416
1549
|
* @see {@link https://discord.com/developers/docs/resources/user#create-dm}
|
|
1417
1550
|
*/
|
|
1418
1551
|
getDmChannel: (userId: BigString) => Promise<CamelizedDiscordChannel>;
|
|
1552
|
+
/**
|
|
1553
|
+
* Create a new group DM channel with multiple users.
|
|
1554
|
+
*
|
|
1555
|
+
* @param options - The options for create a new group dm
|
|
1556
|
+
* @returns An instance of {@link CamelizedDiscordChannel}.
|
|
1557
|
+
*
|
|
1558
|
+
* @remarks
|
|
1559
|
+
* The access tokens require to have the `gdm.join` scope
|
|
1560
|
+
*
|
|
1561
|
+
* This endpoint is limited to 10 active group DMs.
|
|
1562
|
+
*
|
|
1563
|
+
* Fires a _Channel create_ gateway event.
|
|
1564
|
+
*
|
|
1565
|
+
* @see {@link https://discord.com/developers/docs/resources/user#create-group-dm}
|
|
1566
|
+
*/
|
|
1567
|
+
getGroupDmChannel: (options: GetGroupDmOptions) => Promise<CamelizedDiscordChannel>;
|
|
1419
1568
|
/**
|
|
1420
1569
|
* Gets an emoji by its ID.
|
|
1421
1570
|
*
|
|
@@ -1423,6 +1572,10 @@ export interface RestManager {
|
|
|
1423
1572
|
* @param emojiId - The ID of the emoji to get.
|
|
1424
1573
|
* @returns An instance of {@link CamelizedDiscordEmoji}.
|
|
1425
1574
|
*
|
|
1575
|
+
* @remarks
|
|
1576
|
+
* Includes the `user` field if the bot has the `MANAGE_GUILD_EXPRESSIONS` permission,
|
|
1577
|
+
* or if the bot created the emoji and has the the `CREATE_GUILD_EXPRESSIONS` permission.
|
|
1578
|
+
*
|
|
1426
1579
|
* @see {@link https://discord.com/developers/docs/resources/emoji#get-guild-emoji}
|
|
1427
1580
|
*/
|
|
1428
1581
|
getEmoji: (guildId: BigString, emojiId: BigString) => Promise<CamelizedDiscordEmoji>;
|
|
@@ -1432,6 +1585,9 @@ export interface RestManager {
|
|
|
1432
1585
|
* @param guildId - The ID of the guild which to get the emojis of.
|
|
1433
1586
|
* @returns A collection of {@link CamelizedDiscordEmoji} objects assorted by emoji ID.
|
|
1434
1587
|
*
|
|
1588
|
+
* @remarks
|
|
1589
|
+
* Includes `user` fields if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
1590
|
+
*
|
|
1435
1591
|
* @see {@link https://discord.com/developers/docs/resources/emoji#list-guild-emojis}
|
|
1436
1592
|
*/
|
|
1437
1593
|
getEmojis: (guildId: BigString) => Promise<CamelizedDiscordEmoji[]>;
|
|
@@ -1440,7 +1596,7 @@ export interface RestManager {
|
|
|
1440
1596
|
*
|
|
1441
1597
|
* @param token - The interaction token to use, provided in the original interaction.
|
|
1442
1598
|
* @param messageId - The ID of the message to get.
|
|
1443
|
-
* @returns An instance of {@link
|
|
1599
|
+
* @returns An instance of {@link CamelizedDiscordMessage}.
|
|
1444
1600
|
*
|
|
1445
1601
|
* @remarks
|
|
1446
1602
|
* Unlike `getMessage()`, this endpoint allows the bot user to act without:
|
|
@@ -1458,7 +1614,7 @@ export interface RestManager {
|
|
|
1458
1614
|
* Gets a global application command by its ID.
|
|
1459
1615
|
*
|
|
1460
1616
|
* @param commandId - The ID of the command to get.
|
|
1461
|
-
* @returns An instance of {@link
|
|
1617
|
+
* @returns An instance of {@link CamelizedDiscordApplicationCommand}.
|
|
1462
1618
|
*
|
|
1463
1619
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-command}
|
|
1464
1620
|
*/
|
|
@@ -1466,7 +1622,7 @@ export interface RestManager {
|
|
|
1466
1622
|
/**
|
|
1467
1623
|
* Gets the list of your bot's global application commands.
|
|
1468
1624
|
*
|
|
1469
|
-
* @returns A collection of {@link
|
|
1625
|
+
* @returns A collection of {@link CamelizedDiscordApplicationCommand} objects assorted by command ID.
|
|
1470
1626
|
*
|
|
1471
1627
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands}
|
|
1472
1628
|
*/
|
|
@@ -1476,19 +1632,32 @@ export interface RestManager {
|
|
|
1476
1632
|
*
|
|
1477
1633
|
* @param guildId - The ID of the guild to get.
|
|
1478
1634
|
* @param options - The parameters for the fetching of the guild.
|
|
1479
|
-
* @returns An instance of {@link
|
|
1635
|
+
* @returns An instance of {@link CamelizedDiscordGuild}.
|
|
1480
1636
|
*
|
|
1481
1637
|
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild}
|
|
1482
1638
|
*/
|
|
1483
1639
|
getGuild: (guildId: BigString, options?: {
|
|
1484
1640
|
counts?: boolean;
|
|
1485
1641
|
}) => Promise<CamelizedDiscordGuild>;
|
|
1642
|
+
/**
|
|
1643
|
+
* Get the user guilds.
|
|
1644
|
+
*
|
|
1645
|
+
* @param bearerToken - The access token of the user, if unspecified the bot token is used instead
|
|
1646
|
+
* @param options - The parameters for the fetching of the guild.
|
|
1647
|
+
* @returns An instance of {@link CamelizedDiscordGuild}.
|
|
1648
|
+
*
|
|
1649
|
+
* @remarks
|
|
1650
|
+
* If used with an access token, the token needs to have the `guilds` scope
|
|
1651
|
+
*
|
|
1652
|
+
* @see {@link https://discord.com/developers/docs/resources/user#get-current-user-guilds}
|
|
1653
|
+
*/
|
|
1654
|
+
getGuilds: (bearerToken?: string, options?: GetUserGuilds) => Promise<CamelizedDiscordPartialGuild[]>;
|
|
1486
1655
|
/**
|
|
1487
1656
|
* Gets a guild application command by its ID.
|
|
1488
1657
|
*
|
|
1489
1658
|
* @param guildId - The ID of the guild the command is registered in.
|
|
1490
1659
|
* @param commandId - The ID of the command to get.
|
|
1491
|
-
* @returns An instance of {@link
|
|
1660
|
+
* @returns An instance of {@link CamelizedDiscordApplicationCommand}.
|
|
1492
1661
|
*
|
|
1493
1662
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command}
|
|
1494
1663
|
*/
|
|
@@ -1497,7 +1666,7 @@ export interface RestManager {
|
|
|
1497
1666
|
* Gets the list of application commands registered by your bot in a guild.
|
|
1498
1667
|
*
|
|
1499
1668
|
* @param guildId - The ID of the guild the commands are registered in.
|
|
1500
|
-
* @returns A collection of {@link
|
|
1669
|
+
* @returns A collection of {@link CamelizedDiscordApplicationCommand} objects assorted by command ID.
|
|
1501
1670
|
*
|
|
1502
1671
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-commandss}
|
|
1503
1672
|
*/
|
|
@@ -1506,10 +1675,10 @@ export interface RestManager {
|
|
|
1506
1675
|
* Gets the preview of a guild by a guild's ID.
|
|
1507
1676
|
*
|
|
1508
1677
|
* @param guildId - The ID of the guild to get the preview of.
|
|
1509
|
-
* @returns An instance of {@link
|
|
1678
|
+
* @returns An instance of {@link CamelizedDiscordGuildPreview}.
|
|
1510
1679
|
*
|
|
1511
1680
|
* @remarks
|
|
1512
|
-
* If the bot user is not in the guild, the guild must be
|
|
1681
|
+
* If the bot user is not in the guild, the guild must be discoverable.
|
|
1513
1682
|
*
|
|
1514
1683
|
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-preview}
|
|
1515
1684
|
*/
|
|
@@ -1521,7 +1690,7 @@ export interface RestManager {
|
|
|
1521
1690
|
* @param stickerId The ID of the sticker to get
|
|
1522
1691
|
* @return A {@link CamelizedDiscordSticker}
|
|
1523
1692
|
*
|
|
1524
|
-
* @remarks Includes the user field if the bot has the `
|
|
1693
|
+
* @remarks Includes the user field if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
1525
1694
|
*
|
|
1526
1695
|
* @see {@link https://discord.com/developers/docs/resources/sticker#get-guild-sticker}
|
|
1527
1696
|
*/
|
|
@@ -1532,7 +1701,7 @@ export interface RestManager {
|
|
|
1532
1701
|
* @param guildId The ID of the guild to get
|
|
1533
1702
|
* @returns A collection of {@link CamelizedDiscordSticker} objects assorted by sticker ID.
|
|
1534
1703
|
*
|
|
1535
|
-
* @remarks Includes user fields if the bot has the `
|
|
1704
|
+
* @remarks Includes user fields if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
1536
1705
|
*
|
|
1537
1706
|
* @see {@link https://discord.com/developers/docs/resources/sticker#list-guild-stickers}
|
|
1538
1707
|
*/
|
|
@@ -1541,7 +1710,7 @@ export interface RestManager {
|
|
|
1541
1710
|
* Gets a template by its code.
|
|
1542
1711
|
*
|
|
1543
1712
|
* @param templateCode - The code of the template to get.
|
|
1544
|
-
* @returns An instance of {@link
|
|
1713
|
+
* @returns An instance of {@link CamelizedDiscordTemplate}.
|
|
1545
1714
|
*
|
|
1546
1715
|
* @remarks
|
|
1547
1716
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -1553,7 +1722,7 @@ export interface RestManager {
|
|
|
1553
1722
|
* Gets the list of templates for a guild.
|
|
1554
1723
|
*
|
|
1555
1724
|
* @param guildId - The ID of the guild to get the list of templates for.
|
|
1556
|
-
* @returns A collection of {@link
|
|
1725
|
+
* @returns A collection of {@link CamelizedDiscordTemplate} objects assorted by template code.
|
|
1557
1726
|
*
|
|
1558
1727
|
* @remarks
|
|
1559
1728
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -1577,7 +1746,7 @@ export interface RestManager {
|
|
|
1577
1746
|
* Gets the list of integrations attached to a guild.
|
|
1578
1747
|
*
|
|
1579
1748
|
* @param guildId - The ID of the guild to get the list of integrations from.
|
|
1580
|
-
* @returns A collection of {@link
|
|
1749
|
+
* @returns A collection of {@link CamelizedDiscordIntegration} objects assorted by integration ID.
|
|
1581
1750
|
*
|
|
1582
1751
|
* @remarks
|
|
1583
1752
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -1599,7 +1768,7 @@ export interface RestManager {
|
|
|
1599
1768
|
* Gets the list of invites for a guild.
|
|
1600
1769
|
*
|
|
1601
1770
|
* @param guildId - The ID of the guild to get the invites from.
|
|
1602
|
-
* @returns A collection of {@link
|
|
1771
|
+
* @returns A collection of {@link CamelizedDiscordInviteMetadata} objects assorted by invite code.
|
|
1603
1772
|
*
|
|
1604
1773
|
* @remarks
|
|
1605
1774
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -1612,7 +1781,7 @@ export interface RestManager {
|
|
|
1612
1781
|
*
|
|
1613
1782
|
* @param channelId - The ID of the channel from which to get the message.
|
|
1614
1783
|
* @param messageId - The ID of the message to get.
|
|
1615
|
-
* @returns An instance of {@link
|
|
1784
|
+
* @returns An instance of {@link CamelizedDiscordMessage}.
|
|
1616
1785
|
*
|
|
1617
1786
|
* @remarks
|
|
1618
1787
|
* Requires that the bot user be able to see the contents of the channel in which the message was posted.
|
|
@@ -1628,7 +1797,7 @@ export interface RestManager {
|
|
|
1628
1797
|
*
|
|
1629
1798
|
* @param channelId - The ID of the channel from which to get the messages.
|
|
1630
1799
|
* @param options - The parameters for the fetching of the messages.
|
|
1631
|
-
* @returns A collection of {@link
|
|
1800
|
+
* @returns A collection of {@link CamelizedDiscordMessage} objects assorted by message ID.
|
|
1632
1801
|
*
|
|
1633
1802
|
* @remarks
|
|
1634
1803
|
* Requires that the bot user be able to see the contents of the channel in which the messages were posted.
|
|
@@ -1640,18 +1809,18 @@ export interface RestManager {
|
|
|
1640
1809
|
*/
|
|
1641
1810
|
getMessages: (channelId: BigString, options?: GetMessagesOptions) => Promise<CamelizedDiscordMessage[]>;
|
|
1642
1811
|
/**
|
|
1643
|
-
* Returns the list of sticker packs available
|
|
1812
|
+
* Returns the list of sticker packs available.
|
|
1644
1813
|
*
|
|
1645
|
-
* @returns A collection of {@link
|
|
1814
|
+
* @returns A collection of {@link CamelizedDiscordStickerPack} objects assorted by sticker ID.
|
|
1646
1815
|
*
|
|
1647
|
-
* @see {@link https://discord.com/developers/docs/resources/sticker#list-
|
|
1816
|
+
* @see {@link https://discord.com/developers/docs/resources/sticker#list-sticker-packs}
|
|
1648
1817
|
*/
|
|
1649
|
-
|
|
1818
|
+
getStickerPacks: () => Promise<CamelizedDiscordStickerPack[]>;
|
|
1650
1819
|
/**
|
|
1651
1820
|
* Gets the initial message response to an interaction.
|
|
1652
1821
|
*
|
|
1653
1822
|
* @param token - The interaction token to use, provided in the original interaction.
|
|
1654
|
-
* @returns An instance of {@link
|
|
1823
|
+
* @returns An instance of {@link CamelizedDiscordMessage}.
|
|
1655
1824
|
*
|
|
1656
1825
|
* @remarks
|
|
1657
1826
|
* Unlike `getMessage()`, this endpoint allows the bot user to act without:
|
|
@@ -1667,7 +1836,7 @@ export interface RestManager {
|
|
|
1667
1836
|
* Gets the pinned messages for a channel.
|
|
1668
1837
|
*
|
|
1669
1838
|
* @param channelId - The ID of the channel to get the pinned messages for.
|
|
1670
|
-
* @returns A collection of {@link
|
|
1839
|
+
* @returns A collection of {@link CamelizedDiscordMessage} objects assorted by message ID.
|
|
1671
1840
|
*
|
|
1672
1841
|
* @remarks
|
|
1673
1842
|
* Requires that the bot user be able to see the contents of the channel in which the messages were posted.
|
|
@@ -1689,7 +1858,7 @@ export interface RestManager {
|
|
|
1689
1858
|
* Requires the `READ_MESSAGE_HISTORY` permission.
|
|
1690
1859
|
* Requires the `MANAGE_THREADS` permission.
|
|
1691
1860
|
*
|
|
1692
|
-
* Returns threads of type {@link ChannelTypes.GuildPrivateThread
|
|
1861
|
+
* Returns threads of type {@link ChannelTypes}.GuildPrivateThread.
|
|
1693
1862
|
*
|
|
1694
1863
|
* Threads are ordered by the `archive_timestamp` property included in the metadata of the object in descending order.
|
|
1695
1864
|
*
|
|
@@ -1706,7 +1875,7 @@ export interface RestManager {
|
|
|
1706
1875
|
* @remarks
|
|
1707
1876
|
* Requires the `READ_MESSAGE_HISTORY` permission.
|
|
1708
1877
|
*
|
|
1709
|
-
* Returns threads of type {@link ChannelTypes.GuildPrivateThread
|
|
1878
|
+
* Returns threads of type {@link ChannelTypes}.GuildPrivateThread.
|
|
1710
1879
|
*
|
|
1711
1880
|
* Threads are ordered by the `id` property in descending order.
|
|
1712
1881
|
*
|
|
@@ -1721,7 +1890,7 @@ export interface RestManager {
|
|
|
1721
1890
|
* @returns A number indicating the number of members that would be kicked.
|
|
1722
1891
|
*
|
|
1723
1892
|
* @remarks
|
|
1724
|
-
* Requires the `KICK_MEMBERS`
|
|
1893
|
+
* Requires the `MANAGE_GUILD` and `KICK_MEMBERS` permissions.
|
|
1725
1894
|
*
|
|
1726
1895
|
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-prune-count}
|
|
1727
1896
|
*/
|
|
@@ -1731,13 +1900,13 @@ export interface RestManager {
|
|
|
1731
1900
|
*
|
|
1732
1901
|
* @param channelId - The ID of the channel to get the archived threads for.
|
|
1733
1902
|
* @param options - The parameters for the fetching of threads.
|
|
1734
|
-
* @returns An instance of {@link
|
|
1903
|
+
* @returns An instance of {@link CamelizedDiscordArchivedThreads}.
|
|
1735
1904
|
*
|
|
1736
1905
|
* @remarks
|
|
1737
1906
|
* Requires the `READ_MESSAGE_HISTORY` permission.
|
|
1738
1907
|
*
|
|
1739
|
-
* If called on a channel of type {@link ChannelTypes.GuildText
|
|
1740
|
-
* If called on a channel of type {@link ChannelTypes.GuildNews
|
|
1908
|
+
* If called on a channel of type {@link ChannelTypes}.GuildText, returns threads of type {@link ChannelTypes}.GuildPublicThread.
|
|
1909
|
+
* If called on a channel of type {@link ChannelTypes}.GuildNews, returns threads of type {@link ChannelTypes}.GuildNewsThread.
|
|
1741
1910
|
*
|
|
1742
1911
|
* Threads are ordered by the `archive_timestamp` property included in the metadata of the object in descending order.
|
|
1743
1912
|
*
|
|
@@ -1748,10 +1917,10 @@ export interface RestManager {
|
|
|
1748
1917
|
* Gets the list of roles for a guild.
|
|
1749
1918
|
*
|
|
1750
1919
|
* @param guildId - The ID of the guild to get the list of roles for.
|
|
1751
|
-
* @returns A collection of {@link
|
|
1920
|
+
* @returns A collection of {@link CamelizedDiscordRole} objects assorted by role ID.
|
|
1752
1921
|
*
|
|
1753
1922
|
* @remarks
|
|
1754
|
-
* ⚠️ This endpoint should be used sparingly due to {@link
|
|
1923
|
+
* ⚠️ This endpoint should be used sparingly due to {@link CamelizedDiscordRole} objects already being included in guild payloads.
|
|
1755
1924
|
*
|
|
1756
1925
|
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-roles}
|
|
1757
1926
|
*/
|
|
@@ -1762,7 +1931,7 @@ export interface RestManager {
|
|
|
1762
1931
|
* @param guildId - The ID of the guild to get the scheduled event from.
|
|
1763
1932
|
* @param eventId - The ID of the scheduled event to get.
|
|
1764
1933
|
* @param options - The parameters for the fetching of the scheduled event.
|
|
1765
|
-
* @returns An instance of {@link
|
|
1934
|
+
* @returns An instance of {@link CamelizedDiscordScheduledEvent}.
|
|
1766
1935
|
*
|
|
1767
1936
|
* @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event}
|
|
1768
1937
|
*/
|
|
@@ -1774,7 +1943,7 @@ export interface RestManager {
|
|
|
1774
1943
|
*
|
|
1775
1944
|
* @param guildId - The ID of the guild to get the scheduled events from.
|
|
1776
1945
|
* @param options - The parameters for the fetching of the scheduled events.
|
|
1777
|
-
* @returns A collection of {@link
|
|
1946
|
+
* @returns A collection of {@link CamelizedDiscordScheduledEvent} objects assorted by event ID.
|
|
1778
1947
|
*
|
|
1779
1948
|
* @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild}
|
|
1780
1949
|
*/
|
|
@@ -1785,7 +1954,7 @@ export interface RestManager {
|
|
|
1785
1954
|
* @param guildId - The ID of the guild to get the subscribers to the scheduled event from.
|
|
1786
1955
|
* @param eventId - The ID of the scheduled event to get the subscribers of.
|
|
1787
1956
|
* @param options - The parameters for the fetching of the subscribers.
|
|
1788
|
-
* @returns A collection of {@link
|
|
1957
|
+
* @returns A collection of {@link CamelizedDiscordUser} objects assorted by user ID.
|
|
1789
1958
|
*
|
|
1790
1959
|
* @remarks
|
|
1791
1960
|
* Requires the `MANAGE_EVENTS` permission.
|
|
@@ -1847,7 +2016,7 @@ export interface RestManager {
|
|
|
1847
2016
|
* @param messageId - The ID of the message to get the users for.
|
|
1848
2017
|
* @param reaction - The reaction for which to get the users.
|
|
1849
2018
|
* @param options - The parameters for the fetching of the users.
|
|
1850
|
-
* @returns A collection of {@link
|
|
2019
|
+
* @returns A collection of {@link CamelizedDiscordUser} objects assorted by user ID.
|
|
1851
2020
|
*
|
|
1852
2021
|
* @see {@link https://discord.com/developers/docs/resources/channel#get-reactions}
|
|
1853
2022
|
*/
|
|
@@ -1859,11 +2028,46 @@ export interface RestManager {
|
|
|
1859
2028
|
* @returns {CamelizedDiscordUser}
|
|
1860
2029
|
*/
|
|
1861
2030
|
getUser: (id: BigString) => Promise<CamelizedDiscordUser>;
|
|
2031
|
+
/**
|
|
2032
|
+
* Get the current user data.
|
|
2033
|
+
*
|
|
2034
|
+
* @param bearerToken - The access token of the user
|
|
2035
|
+
* @returns {CamelizedDiscordUser}
|
|
2036
|
+
*
|
|
2037
|
+
* @remarks
|
|
2038
|
+
* This requires the `identify` scope.
|
|
2039
|
+
*
|
|
2040
|
+
* To get the mail this also requires the `email` scope
|
|
2041
|
+
*/
|
|
2042
|
+
getCurrentUser: (bearerToken: string) => Promise<CamelizedDiscordUser>;
|
|
2043
|
+
/**
|
|
2044
|
+
* Get the current user connections.
|
|
2045
|
+
*
|
|
2046
|
+
* @param bearerToken - The access token of the user
|
|
2047
|
+
* @returns {CamelizedDiscordConnection[]}
|
|
2048
|
+
*
|
|
2049
|
+
* @remarks
|
|
2050
|
+
* This requires the `connections` scope.
|
|
2051
|
+
*/
|
|
2052
|
+
getUserConnections: (bearerToken: string) => Promise<CamelizedDiscordConnection[]>;
|
|
2053
|
+
/**
|
|
2054
|
+
* Get the current user application role connection for the application.
|
|
2055
|
+
*
|
|
2056
|
+
* @param bearerToken - The access token of the user
|
|
2057
|
+
* @param applicationId - The id of the application to get the role connection
|
|
2058
|
+
* @returns {CamelizedDiscordApplicationRoleConnection}
|
|
2059
|
+
*
|
|
2060
|
+
* @remarks
|
|
2061
|
+
* The access token requires the `role_connections.write` scope.
|
|
2062
|
+
*
|
|
2063
|
+
* @see {@link https://discord.com/developers/docs/resources/user#get-user-application-role-connection}
|
|
2064
|
+
*/
|
|
2065
|
+
getUserApplicationRoleConnection: (bearerToken: string, applicationId: BigString) => Promise<CamelizedDiscordApplicationRoleConnection>;
|
|
1862
2066
|
/**
|
|
1863
2067
|
* Gets information about the vanity url of a guild.
|
|
1864
2068
|
*
|
|
1865
2069
|
* @param guildId - The ID of the guild to get the vanity url information for.
|
|
1866
|
-
* @returns An instance of {@link
|
|
2070
|
+
* @returns An instance of {@link CamelizedDiscordVanityUrl}.
|
|
1867
2071
|
*
|
|
1868
2072
|
* @remarks
|
|
1869
2073
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -1877,7 +2081,7 @@ export interface RestManager {
|
|
|
1877
2081
|
* Gets the list of voice regions for a guild.
|
|
1878
2082
|
*
|
|
1879
2083
|
* @param guildId - The ID of the guild to get the voice regions for.
|
|
1880
|
-
* @returns A collection of {@link
|
|
2084
|
+
* @returns A collection of {@link CamelizedDiscordVoiceRegion} objects assorted by voice region ID.
|
|
1881
2085
|
*
|
|
1882
2086
|
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-voice-regions}
|
|
1883
2087
|
*/
|
|
@@ -1920,7 +2124,7 @@ export interface RestManager {
|
|
|
1920
2124
|
* Gets the welcome screen for a guild.
|
|
1921
2125
|
*
|
|
1922
2126
|
* @param guildId - The ID of the guild to get the welcome screen for.
|
|
1923
|
-
* @returns An instance of {@link
|
|
2127
|
+
* @returns An instance of {@link CamelizedDiscordWelcomeScreen}.
|
|
1924
2128
|
*
|
|
1925
2129
|
* @remarks
|
|
1926
2130
|
* If the welcome screen is not enabled:
|
|
@@ -1933,7 +2137,10 @@ export interface RestManager {
|
|
|
1933
2137
|
* Gets the guild widget by guild ID.
|
|
1934
2138
|
*
|
|
1935
2139
|
* @param guildId - The ID of the guild to get the widget of.
|
|
1936
|
-
* @returns An instance of {@link
|
|
2140
|
+
* @returns An instance of {@link CamelizedDiscordGuildWidget}.
|
|
2141
|
+
*
|
|
2142
|
+
* @remarks
|
|
2143
|
+
* Fires an `INVITE_CREATED` Gateway event when an invite channel is defined and a new `Invite` is generated.
|
|
1937
2144
|
*
|
|
1938
2145
|
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-widget}
|
|
1939
2146
|
*/
|
|
@@ -1942,7 +2149,7 @@ export interface RestManager {
|
|
|
1942
2149
|
* Gets the settings of a guild's widget.
|
|
1943
2150
|
*
|
|
1944
2151
|
* @param guildId - The ID of the guild to get the widget of.
|
|
1945
|
-
* @returns An instance of {@link
|
|
2152
|
+
* @returns An instance of {@link CamelizedDiscordGuildWidgetSettings}.
|
|
1946
2153
|
*
|
|
1947
2154
|
* @remarks
|
|
1948
2155
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -1992,7 +2199,7 @@ export interface RestManager {
|
|
|
1992
2199
|
*
|
|
1993
2200
|
* @param channelId - The ID of the announcement channel.
|
|
1994
2201
|
* @param messageId - The ID of the message to cross-post.
|
|
1995
|
-
* @returns An instance of the cross-posted {@link
|
|
2202
|
+
* @returns An instance of the cross-posted {@link CamelizedDiscordMessage}.
|
|
1996
2203
|
*
|
|
1997
2204
|
* @remarks
|
|
1998
2205
|
* Requires the `SEND_MESSAGES` permission.
|
|
@@ -2028,7 +2235,7 @@ export interface RestManager {
|
|
|
2028
2235
|
* @param userId - The user ID of the thread member to remove.
|
|
2029
2236
|
*
|
|
2030
2237
|
* @remarks
|
|
2031
|
-
* If the thread is of type {@link ChannelTypes.GuildPrivateThread
|
|
2238
|
+
* If the thread is of type {@link ChannelTypes}.GuildPrivateThread, requires to be the creator of the thread.
|
|
2032
2239
|
* Otherwise, requires the `MANAGE_THREADS` permission.
|
|
2033
2240
|
*
|
|
2034
2241
|
* Requires the thread not be archived.
|
|
@@ -2038,6 +2245,15 @@ export interface RestManager {
|
|
|
2038
2245
|
* @see {@link https://discord.com/developers/docs/resources/channel#remove-thread-member}
|
|
2039
2246
|
*/
|
|
2040
2247
|
removeThreadMember: (channelId: BigString, userId: BigString) => Promise<void>;
|
|
2248
|
+
/**
|
|
2249
|
+
* Removes a member from a Group DM.
|
|
2250
|
+
*
|
|
2251
|
+
* @param channelId - The ID of the channel to remove the recipient user of.
|
|
2252
|
+
* @param userId - The user ID of the user to remove.
|
|
2253
|
+
*
|
|
2254
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#group-dm-remove-recipient}
|
|
2255
|
+
*/
|
|
2256
|
+
removeDmRecipient: (channelId: BigString, userId: BigString) => Promise<void>;
|
|
2041
2257
|
/**
|
|
2042
2258
|
* Sends a message to a channel.
|
|
2043
2259
|
*
|
|
@@ -2070,7 +2286,7 @@ export interface RestManager {
|
|
|
2070
2286
|
*
|
|
2071
2287
|
* @param token - The interaction token to use, provided in the original interaction.
|
|
2072
2288
|
* @param options - The parameters for the creation of the message.
|
|
2073
|
-
* @returns An instance of the created {@link
|
|
2289
|
+
* @returns An instance of the created {@link CamelizedDiscordMessage}.
|
|
2074
2290
|
*
|
|
2075
2291
|
* @remarks
|
|
2076
2292
|
* ⚠️ Interaction tokens are only valid for _15 minutes_.
|
|
@@ -2092,7 +2308,7 @@ export interface RestManager {
|
|
|
2092
2308
|
* @param interactionId - The ID of the interaction to respond to.
|
|
2093
2309
|
* @param token - The interaction token to use, provided in the original interaction.
|
|
2094
2310
|
* @param options - The parameters for the creation of the message.
|
|
2095
|
-
* @returns An instance of the created {@link
|
|
2311
|
+
* @returns An instance of the created {@link CamelizedDiscordMessage}.
|
|
2096
2312
|
*
|
|
2097
2313
|
* @remarks
|
|
2098
2314
|
* ⚠️ Interaction tokens are only valid for _15 minutes_.
|
|
@@ -2115,12 +2331,12 @@ export interface RestManager {
|
|
|
2115
2331
|
* @param messageId - The ID of the message to use as the thread's point of origin.
|
|
2116
2332
|
* @param options - The parameters to use for the creation of the thread.
|
|
2117
2333
|
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2118
|
-
* @returns An instance of the created {@link
|
|
2334
|
+
* @returns An instance of the created {@link CamelizedDiscordChannel}.
|
|
2119
2335
|
*
|
|
2120
2336
|
* @remarks
|
|
2121
|
-
* If called on a channel of type {@link ChannelTypes.GuildText
|
|
2122
|
-
* If called on a channel of type {@link ChannelTypes.GuildNews
|
|
2123
|
-
* Does not work on channels of type {@link ChannelTypes.GuildForum
|
|
2337
|
+
* If called on a channel of type {@link ChannelTypes}.GuildText, creates a {@link ChannelTypes}.GuildPublicThread.
|
|
2338
|
+
* If called on a channel of type {@link ChannelTypes}.GuildNews, creates a {@link ChannelTypes}.GuildNewsThread.
|
|
2339
|
+
* Does not work on channels of type {@link ChannelTypes}.GuildForum.
|
|
2124
2340
|
*
|
|
2125
2341
|
* The ID of the created thread will be the same as the ID of the source message.
|
|
2126
2342
|
*
|
|
@@ -2145,11 +2361,34 @@ export interface RestManager {
|
|
|
2145
2361
|
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-without-message}
|
|
2146
2362
|
*/
|
|
2147
2363
|
startThreadWithoutMessage: (channelId: BigString, options: StartThreadWithoutMessage, reason?: string) => Promise<CamelizedDiscordChannel>;
|
|
2364
|
+
/**
|
|
2365
|
+
* Get a list of users that voted for this specific answer.
|
|
2366
|
+
*
|
|
2367
|
+
* @param channelId - The ID of the channel in which the message with the poll lives
|
|
2368
|
+
* @param messageId - The ID of the message in which the poll lives
|
|
2369
|
+
* @param answerId - The ID of the answer to get the users that voted that answer
|
|
2370
|
+
* @param options - The options for the request
|
|
2371
|
+
* @returns The list of users that voted for the specific answer.
|
|
2372
|
+
*/
|
|
2373
|
+
getPollAnswerVoters: (channelId: BigString, messageId: BigString, answerId: number, options?: GetPollAnswerVotes) => Promise<CamelizedDiscordGetAnswerVotesResponse>;
|
|
2374
|
+
/**
|
|
2375
|
+
* Immediately ends the poll.
|
|
2376
|
+
*
|
|
2377
|
+
* @param channelId - The ID of the channel in which the message with the poll lives
|
|
2378
|
+
* @param messageId - The ID of the message in which the poll lives
|
|
2379
|
+
* @returns The message with the expired poll
|
|
2380
|
+
*
|
|
2381
|
+
* @remarks
|
|
2382
|
+
* You cannot end polls from other users.
|
|
2383
|
+
*
|
|
2384
|
+
* Fires a _Message Update_ gateway event
|
|
2385
|
+
*/
|
|
2386
|
+
endPoll: (channelId: BigString, messageId: BigString) => Promise<CamelizedDiscordMessage>;
|
|
2148
2387
|
/**
|
|
2149
2388
|
* Synchronises a template with the current state of a guild.
|
|
2150
2389
|
*
|
|
2151
2390
|
* @param guildId - The ID of the guild to synchronise a template of.
|
|
2152
|
-
* @returns An instance of the edited {@link
|
|
2391
|
+
* @returns An instance of the edited {@link CamelizedDiscordTemplate}.
|
|
2153
2392
|
*
|
|
2154
2393
|
* @remarks
|
|
2155
2394
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -2160,12 +2399,14 @@ export interface RestManager {
|
|
|
2160
2399
|
*/
|
|
2161
2400
|
syncGuildTemplate: (guildId: BigString) => Promise<CamelizedDiscordTemplate>;
|
|
2162
2401
|
/**
|
|
2163
|
-
* Triggers a typing indicator for the
|
|
2402
|
+
* Triggers a typing indicator for the specified channel, which expires after 10 seconds.
|
|
2164
2403
|
*
|
|
2165
2404
|
* @param channelId - The ID of the channel in which to trigger the typing indicator.
|
|
2166
2405
|
*
|
|
2167
2406
|
* @remarks
|
|
2168
|
-
* Generally
|
|
2407
|
+
* Generally bots should **not** use this route.
|
|
2408
|
+
* However, if a bot is responding to a command and expects the computation to take a few seconds,
|
|
2409
|
+
* this endpoint may be called to let the user know that the bot is processing their message.
|
|
2169
2410
|
*
|
|
2170
2411
|
* Fires a _Typing Start_ gateway event.
|
|
2171
2412
|
*
|
|
@@ -2176,38 +2417,46 @@ export interface RestManager {
|
|
|
2176
2417
|
* Re-registers the list of global application commands, overwriting the previous commands completely.
|
|
2177
2418
|
*
|
|
2178
2419
|
* @param commands - The list of commands to use to overwrite the previous list.
|
|
2179
|
-
* @
|
|
2420
|
+
* @param options - Additional options for the endpoint.
|
|
2421
|
+
* @returns A collection of {@link CamelizedDiscordApplicationCommand} objects assorted by command ID.
|
|
2180
2422
|
*
|
|
2181
2423
|
* @remarks
|
|
2182
2424
|
* ❗ Commands that are not present in the `commands` array will be __deleted__.
|
|
2183
2425
|
*
|
|
2184
2426
|
* ⚠️ Commands that do not already exist will count towards the daily limit of _200_ new commands.
|
|
2185
2427
|
*
|
|
2428
|
+
* When using the bearer token the token needs the `applications.commands.update` scope and must be a `Client grant` token.
|
|
2429
|
+
* You will be able to update only your own application commands
|
|
2430
|
+
*
|
|
2186
2431
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands}
|
|
2187
2432
|
*/
|
|
2188
|
-
upsertGlobalApplicationCommands: (commands: CreateApplicationCommand[]) => Promise<CamelizedDiscordApplicationCommand[]>;
|
|
2433
|
+
upsertGlobalApplicationCommands: (commands: CreateApplicationCommand[], options?: UpsertGlobalApplicationCommandOptions) => Promise<CamelizedDiscordApplicationCommand[]>;
|
|
2189
2434
|
/**
|
|
2190
2435
|
* Re-registers the list of application commands registered in a guild, overwriting the previous commands completely.
|
|
2191
2436
|
*
|
|
2192
2437
|
* @param guildId - The ID of the guild whose list of commands to overwrite.
|
|
2193
2438
|
* @param commands - The list of commands to use to overwrite the previous list.
|
|
2194
|
-
* @
|
|
2439
|
+
* @param options - Additional options for the endpoint.
|
|
2440
|
+
* @returns A collection of {@link CamelizedDiscordApplicationCommand} objects assorted by command ID.
|
|
2195
2441
|
*
|
|
2196
2442
|
* @remarks
|
|
2197
2443
|
* ❗ Commands that are not present in the `commands` array will be __deleted__.
|
|
2198
2444
|
*
|
|
2199
2445
|
* ⚠️ Commands that do not already exist will count towards the daily limit of _200_ new commands.
|
|
2200
2446
|
*
|
|
2447
|
+
* When using the bearer token the token needs the `applications.commands.update` scope and must be a `Client grant` token.
|
|
2448
|
+
* You will be able to update only your own application commands
|
|
2449
|
+
*
|
|
2201
2450
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands}
|
|
2202
2451
|
*/
|
|
2203
|
-
upsertGuildApplicationCommands: (guildId: BigString, commands: CreateApplicationCommand[]) => Promise<CamelizedDiscordApplicationCommand[]>;
|
|
2452
|
+
upsertGuildApplicationCommands: (guildId: BigString, commands: CreateApplicationCommand[], options?: UpsertGuildApplicationCommandOptions) => Promise<CamelizedDiscordApplicationCommand[]>;
|
|
2204
2453
|
/**
|
|
2205
2454
|
* Bans a user from a guild.
|
|
2206
2455
|
*
|
|
2207
2456
|
* @param guildId - The ID of the guild to ban the user from.
|
|
2208
2457
|
* @param userId - The ID of the user to ban from the guild.
|
|
2209
|
-
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2210
2458
|
* @param options - The parameters for the creation of the ban.
|
|
2459
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2211
2460
|
*
|
|
2212
2461
|
* @remarks
|
|
2213
2462
|
* Requires the `BAN_MEMBERS` permission.
|
|
@@ -2217,6 +2466,23 @@ export interface RestManager {
|
|
|
2217
2466
|
* @see {@link https://discord.com/developers/docs/resources/guild#create-guild-ban}
|
|
2218
2467
|
*/
|
|
2219
2468
|
banMember: (guildId: BigString, userId: BigString, options?: CreateGuildBan, reason?: string) => Promise<void>;
|
|
2469
|
+
/**
|
|
2470
|
+
* Bans up to 200 users from a guild.
|
|
2471
|
+
*
|
|
2472
|
+
* @param guildId - The ID of the guild to ban the users from.
|
|
2473
|
+
* @param options - The users to ban and the other options for the ban.
|
|
2474
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2475
|
+
*
|
|
2476
|
+
* @remarks
|
|
2477
|
+
* Requires the `BAN_MEMBERS` and `MANAGE_GUILD` permissions.
|
|
2478
|
+
*
|
|
2479
|
+
* If all provided users fail to be banned, discord will respond with an error (code: `500000: Failed to ban users`)
|
|
2480
|
+
*
|
|
2481
|
+
* Fires as many _Guild Ban Add_ gateway events as many user where banned.
|
|
2482
|
+
*
|
|
2483
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#bulk-guild-ban}
|
|
2484
|
+
*/
|
|
2485
|
+
bulkBanMembers: (guildId: BigString, options: CreateGuildBulkBan, reason?: string) => Promise<Camelize<DiscordBulkBan>>;
|
|
2220
2486
|
/**
|
|
2221
2487
|
* Edits the nickname of the bot user.
|
|
2222
2488
|
*
|
|
@@ -2259,6 +2525,19 @@ export interface RestManager {
|
|
|
2259
2525
|
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-member}
|
|
2260
2526
|
*/
|
|
2261
2527
|
getMember: (guildId: BigString, userId: BigString) => Promise<CamelizedDiscordMemberWithUser>;
|
|
2528
|
+
/**
|
|
2529
|
+
* Gets the current member object.
|
|
2530
|
+
*
|
|
2531
|
+
* @param bearerToken - The access token of the user
|
|
2532
|
+
* @param guildId - The ID of the guild to get the member object for.
|
|
2533
|
+
* @returns An instance of {@link CamelizedDiscordMemberWithUser}.
|
|
2534
|
+
*
|
|
2535
|
+
* @remarks
|
|
2536
|
+
* The access tokens needs the `guilds.members.read` scope
|
|
2537
|
+
*
|
|
2538
|
+
* @see {@link https://discord.com/developers/docs/resources/user#get-current-user-guild-member}
|
|
2539
|
+
*/
|
|
2540
|
+
getCurrentMember: (guildId: BigString, bearerToken: string) => Promise<CamelizedDiscordMemberWithUser>;
|
|
2262
2541
|
/**
|
|
2263
2542
|
* Gets the list of members for a guild.
|
|
2264
2543
|
*
|
|
@@ -2323,7 +2602,7 @@ export interface RestManager {
|
|
|
2323
2602
|
* @returns A number indicating how many members were pruned.
|
|
2324
2603
|
*
|
|
2325
2604
|
* @remarks
|
|
2326
|
-
* Requires the `KICK_MEMBERS`
|
|
2605
|
+
* Requires the `MANAGE_GUILD` and `KICK_MEMBERS` permissions.
|
|
2327
2606
|
*
|
|
2328
2607
|
* ❗ Requests to this endpoint will time out for large guilds. To prevent this from happening, set the {@link BeginGuildPrune.computePruneCount} property of the {@link 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.
|
|
2329
2608
|
*
|
|
@@ -2381,6 +2660,63 @@ export interface RestManager {
|
|
|
2381
2660
|
* @see {@link https://discord.com/developers/docs/resources/channel#unpin-message}
|
|
2382
2661
|
*/
|
|
2383
2662
|
unpinMessage: (channelId: BigString, messageId: BigString, reason?: string) => Promise<void>;
|
|
2663
|
+
/**
|
|
2664
|
+
* Get the guild onboarding
|
|
2665
|
+
*
|
|
2666
|
+
* @param guildId - The guild to get the onboarding from
|
|
2667
|
+
*/
|
|
2668
|
+
getGuildOnboarding: (guildId: BigString) => Promise<CamelizedDiscordGuildOnboarding>;
|
|
2669
|
+
/**
|
|
2670
|
+
* Modifies the onboarding configuration of the guild.
|
|
2671
|
+
*
|
|
2672
|
+
* @param guildId - The guild to get the onboarding from
|
|
2673
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2674
|
+
*
|
|
2675
|
+
* @remarks
|
|
2676
|
+
* Requires the `MANAGE_GUILD` and `MANAGE_ROLES` permissions.
|
|
2677
|
+
*
|
|
2678
|
+
* Onboarding enforces constraints when enabled. These constraints are:
|
|
2679
|
+
* - at least 7 default channels
|
|
2680
|
+
* - at least 5 of the 7 channels must allow sending messages to the @everyone role
|
|
2681
|
+
*
|
|
2682
|
+
* The `mode` field modifies what is considered when enforcing these constraints.
|
|
2683
|
+
*/
|
|
2684
|
+
editGuildOnboarding: (guildId: BigString, options: EditGuildOnboarding, reason?: string) => Promise<CamelizedDiscordGuildOnboarding>;
|
|
2685
|
+
/**
|
|
2686
|
+
* Returns all entitlements for a given app, active and expired.
|
|
2687
|
+
*
|
|
2688
|
+
* @param applicationId - The id of the application to get the entitlements
|
|
2689
|
+
* @param {GetEntitlements} [options] - The optional query params for the endpoint
|
|
2690
|
+
*/
|
|
2691
|
+
listEntitlements: (applicationId: BigString, options?: GetEntitlements) => Promise<CamelizedDiscordEntitlement[]>;
|
|
2692
|
+
/**
|
|
2693
|
+
* 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.
|
|
2694
|
+
*
|
|
2695
|
+
* @param applicationId - The id of the application to create the entitlement
|
|
2696
|
+
* @param body - The options for new entitlement
|
|
2697
|
+
*
|
|
2698
|
+
* @remarks
|
|
2699
|
+
* This endpoint returns a partial entitlement object.
|
|
2700
|
+
* It will not contain subscription_id, starts_at, or ends_at, as it's valid in perpetuity.
|
|
2701
|
+
*/
|
|
2702
|
+
createTestEntitlement: (applicationId: BigString, body: CreateEntitlement) => Promise<Partial<CamelizedDiscordEntitlement>>;
|
|
2703
|
+
/**
|
|
2704
|
+
* Deletes a currently-active test entitlement. Discord will act as though that user or guild no longer has entitlement to your premium offering.
|
|
2705
|
+
*
|
|
2706
|
+
* @param applicationId - The id of the application from where delete the entitlement
|
|
2707
|
+
* @param entitlementId - The id of the entitlement to delete
|
|
2708
|
+
*/
|
|
2709
|
+
deleteTestEntitlement: (applicationId: BigString, entitlementId: BigString) => Promise<void>;
|
|
2710
|
+
/**
|
|
2711
|
+
* For One-Time Purchase consumable SKUs, marks a given entitlement for the user as consumed. The entitlement will have `consumed: true` when using {@link RestManager.listEntitlements | List Entitlements}
|
|
2712
|
+
*/
|
|
2713
|
+
consumeEntitlement: (applicationId: BigString, entitlementId: BigString) => Promise<void>;
|
|
2714
|
+
/**
|
|
2715
|
+
* Returns all SKUs for a given application
|
|
2716
|
+
*
|
|
2717
|
+
* @param applicationId - The id of the application to get the SKUs
|
|
2718
|
+
*/
|
|
2719
|
+
listSkus: (applicationId: BigString) => Promise<CamelizedDiscordSku[]>;
|
|
2384
2720
|
}
|
|
2385
2721
|
export type RequestMethods = 'GET' | 'POST' | 'DELETE' | 'PATCH' | 'PUT';
|
|
2386
2722
|
export type ApiVersions = 9 | 10;
|