@discordeno/rest 19.0.0-next.e2d86ea → 19.0.0-next.e33b44e
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 +1395 -0
- package/dist/cjs/queue.cjs +167 -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 +1353 -0
- package/dist/esm/queue.js +157 -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} +5 -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} +435 -108
- 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 -1112
- 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, 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,
|
|
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,33 @@ 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;
|
|
23
34
|
};
|
|
24
35
|
/**
|
|
25
36
|
* The api versions which can be used to make requests.
|
|
26
37
|
* @default 10
|
|
27
38
|
*/
|
|
28
39
|
version?: ApiVersions;
|
|
40
|
+
/**
|
|
41
|
+
* The logger that the rest manager will use
|
|
42
|
+
* @default logger // The logger exported by `@discordeno/utils`
|
|
43
|
+
*/
|
|
44
|
+
logger?: Pick<typeof logger, 'debug' | 'info' | 'warn' | 'error' | 'fatal'>;
|
|
29
45
|
}
|
|
30
46
|
export interface RestManager {
|
|
31
47
|
/** The bot token which will be used to make requests. */
|
|
32
|
-
token
|
|
48
|
+
token: string;
|
|
33
49
|
/** 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
50
|
applicationId: bigint;
|
|
35
51
|
/** The api version to use when making requests. Only the latest supported version will be tested. */
|
|
@@ -46,8 +62,10 @@ export interface RestManager {
|
|
|
46
62
|
* Mostly used only for intern functions.
|
|
47
63
|
*/
|
|
48
64
|
isProxied: boolean;
|
|
49
|
-
/** The authorization header to attach when sending requests to the proxy. */
|
|
65
|
+
/** The authorization header value to attach when sending requests to the proxy. */
|
|
50
66
|
authorization?: string;
|
|
67
|
+
/** The authorization header name to attach when sending requests to the proxy */
|
|
68
|
+
authorizationHeader: string;
|
|
51
69
|
/** The maximum amount of times a request should be retried. Defaults to Infinity */
|
|
52
70
|
maxRetryCount: number;
|
|
53
71
|
/** Whether or not the manager is rate limited globally across all requests. Defaults to false. */
|
|
@@ -64,16 +82,27 @@ export interface RestManager {
|
|
|
64
82
|
invalidBucket: InvalidRequestBucket;
|
|
65
83
|
/** The routes that are available for this manager. */
|
|
66
84
|
routes: RestRoutes;
|
|
85
|
+
/** The logger to use for the rest manager */
|
|
86
|
+
logger: Pick<typeof logger, 'debug' | 'info' | 'warn' | 'error' | 'fatal'>;
|
|
87
|
+
/** Allows the user to inject custom headers that will be sent with every request. */
|
|
88
|
+
createBaseHeaders: () => Record<string, string>;
|
|
89
|
+
/** Whether or not the rest manager should keep objects in raw snake case from discord. */
|
|
90
|
+
preferSnakeCase: (enabled: boolean) => RestManager;
|
|
67
91
|
/** Check the rate limits for a url or a bucket. */
|
|
68
|
-
checkRateLimits: (url: string) => number | false;
|
|
92
|
+
checkRateLimits: (url: string, headers?: Record<string, string>) => number | false;
|
|
69
93
|
/** Reshapes and modifies the obj as needed to make it ready for discords api. */
|
|
70
94
|
changeToDiscordFormat: (obj: any) => any;
|
|
71
95
|
/** Creates the request body and headers that are necessary to send a request. Will handle different types of methods and everything necessary for discord. */
|
|
72
96
|
createRequestBody: (method: RequestMethods, options?: CreateRequestBodyOptions) => RequestBody;
|
|
73
97
|
/** 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
98
|
processRateLimitedPaths: () => void;
|
|
75
|
-
/**
|
|
76
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Processes the rate limit headers and determines if it needs to be rate limited and returns the bucket id if available
|
|
101
|
+
*
|
|
102
|
+
* @remarks
|
|
103
|
+
* The authenticationHeader should be defined ONLY if the request was done using a OAuth2 Access Token, in other cases it should be passed as an empty string
|
|
104
|
+
*/
|
|
105
|
+
processHeaders: (url: string, headers: Headers, authenticationHeader?: string) => string | undefined;
|
|
77
106
|
/** Sends a request to the api. */
|
|
78
107
|
sendRequest: (options: SendRequestOptions) => Promise<void>;
|
|
79
108
|
/** Split a url to separate rate limit buckets based on major/minor parameters. */
|
|
@@ -161,6 +190,35 @@ export interface RestManager {
|
|
|
161
190
|
* @see {@link https://discord.com/developers/docs/resources/channel#add-thread-member}
|
|
162
191
|
*/
|
|
163
192
|
addThreadMember: (channelId: BigString, userId: BigString) => Promise<void>;
|
|
193
|
+
/**
|
|
194
|
+
* Adds a recipient to a group DM.
|
|
195
|
+
*
|
|
196
|
+
* @param channelId - The ID of the group dm to add the user to.
|
|
197
|
+
* @param userId - The user ID of the user to add to the group dm.
|
|
198
|
+
* @param options - The options for adding the user
|
|
199
|
+
*
|
|
200
|
+
* @remarks
|
|
201
|
+
* Requires an OAuth2 access token with the `gdm.join` scope
|
|
202
|
+
*
|
|
203
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#group-dm-add-recipient}
|
|
204
|
+
*/
|
|
205
|
+
addDmRecipient: (channelId: BigString, userId: BigString, options: AddDmRecipientOptions) => Promise<void>;
|
|
206
|
+
/**
|
|
207
|
+
* Adds a member to a guild.
|
|
208
|
+
*
|
|
209
|
+
* @param guildId - The ID of the thread to add the member to.
|
|
210
|
+
* @param userId - The user ID of the member to add to the thread.
|
|
211
|
+
* @param options - The options for the add of a guild member
|
|
212
|
+
*
|
|
213
|
+
* @remarks
|
|
214
|
+
* Requires the bot to be in the specified server
|
|
215
|
+
* Requires an OAuth2 access token with the `guilds.join` scope
|
|
216
|
+
*
|
|
217
|
+
* Fires a _Guild Member Add_ gateway event.
|
|
218
|
+
*
|
|
219
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#add-guild-member}
|
|
220
|
+
*/
|
|
221
|
+
addGuildMember: (guildId: BigString, userId: BigString, options: AddGuildMemberOptions) => Promise<void>;
|
|
164
222
|
/**
|
|
165
223
|
* Creates an automod rule in a guild.
|
|
166
224
|
*
|
|
@@ -206,7 +264,7 @@ export interface RestManager {
|
|
|
206
264
|
* @returns An instance of the created {@link CamelizedDiscordEmoji}.
|
|
207
265
|
*
|
|
208
266
|
* @remarks
|
|
209
|
-
* Requires the `
|
|
267
|
+
* Requires the `CREATE_GUILD_EXPRESSIONS` permission.
|
|
210
268
|
*
|
|
211
269
|
* 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
270
|
*
|
|
@@ -216,12 +274,12 @@ export interface RestManager {
|
|
|
216
274
|
*/
|
|
217
275
|
createEmoji: (guildId: BigString, options: CreateGuildEmoji, reason?: string) => Promise<CamelizedDiscordEmoji>;
|
|
218
276
|
/**
|
|
219
|
-
* Creates a new thread in a forum channel, and sends a message within the created thread.
|
|
277
|
+
* Creates a new thread in a forum channel or media channel, and sends a message within the created thread.
|
|
220
278
|
*
|
|
221
279
|
* @param channelId - The ID of the forum channel to create the thread within.
|
|
222
280
|
* @param options - The parameters for the creation of the thread.
|
|
223
281
|
* @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
|
|
282
|
+
* @returns An instance of {@link CamelizedDiscordChannel} with a nested {@link CamelizedDiscordChannel} object.
|
|
225
283
|
*
|
|
226
284
|
* @remarks
|
|
227
285
|
* Requires the `CREATE_MESSAGES` permission.
|
|
@@ -229,25 +287,27 @@ export interface RestManager {
|
|
|
229
287
|
* Fires a _Thread Create_ gateway event.
|
|
230
288
|
* Fires a _Message Create_ gateway event.
|
|
231
289
|
*
|
|
232
|
-
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-channel}
|
|
233
|
-
*
|
|
234
|
-
* @experimental
|
|
290
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-or-media-channel}
|
|
235
291
|
*/
|
|
236
292
|
createForumThread: (channelId: BigString, options: CreateForumPostWithMessage, reason?: string) => Promise<CamelizedDiscordChannel>;
|
|
237
293
|
/**
|
|
238
294
|
* Creates an application command accessible globally; across different guilds and channels.
|
|
239
295
|
*
|
|
240
296
|
* @param command - The command to create.
|
|
241
|
-
* @
|
|
297
|
+
* @param options - Additional options for the endpoint
|
|
298
|
+
* @returns An instance of the created {@link CamelizedDiscordApplicationCommand}.
|
|
242
299
|
*
|
|
243
300
|
* @remarks
|
|
244
301
|
* ⚠️ Creating a command with the same name as an existing command for your application will overwrite the old command.
|
|
245
302
|
* ⚠️ Global commands once created are cached for periods of __an hour__, so changes made to existing commands will take an hour to surface.
|
|
246
303
|
* ⚠️ You can only create up to 200 _new_ commands daily.
|
|
247
304
|
*
|
|
305
|
+
* When using the bearer token the token needs the `applications.commands.update` scope and must be a `Client grant` token.
|
|
306
|
+
* You will be able to update only your own application commands
|
|
307
|
+
*
|
|
248
308
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#create-global-application-command}
|
|
249
309
|
*/
|
|
250
|
-
createGlobalApplicationCommand: (command: CreateApplicationCommand) => Promise<CamelizedDiscordApplicationCommand>;
|
|
310
|
+
createGlobalApplicationCommand: (command: CreateApplicationCommand, options?: CreateGlobalApplicationCommandOptions) => Promise<CamelizedDiscordApplicationCommand>;
|
|
251
311
|
/**
|
|
252
312
|
* Creates a guild.
|
|
253
313
|
*
|
|
@@ -267,21 +327,25 @@ export interface RestManager {
|
|
|
267
327
|
*
|
|
268
328
|
* @param command - The command to create.
|
|
269
329
|
* @param guildId - The ID of the guild to create the command for.
|
|
270
|
-
* @
|
|
330
|
+
* @param options - Additional options for the endpoint
|
|
331
|
+
* @returns An instance of the created {@link CamelizedDiscordApplicationCommand}.
|
|
271
332
|
*
|
|
272
333
|
* @remarks
|
|
273
334
|
* ⚠️ Creating a command with the same name as an existing command for your application will overwrite the old command.
|
|
274
335
|
* ⚠️ You can only create up to 200 _new_ commands daily.
|
|
275
336
|
*
|
|
337
|
+
* When using the bearer token the token needs the `applications.commands.update` scope and must be a `Client grant` token.
|
|
338
|
+
* You will be able to update only your own application commands
|
|
339
|
+
*
|
|
276
340
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command}
|
|
277
341
|
*/
|
|
278
|
-
createGuildApplicationCommand: (command: CreateApplicationCommand, guildId: BigString) => Promise<CamelizedDiscordApplicationCommand>;
|
|
342
|
+
createGuildApplicationCommand: (command: CreateApplicationCommand, guildId: BigString, options?: CreateGuildApplicationCommandOptions) => Promise<CamelizedDiscordApplicationCommand>;
|
|
279
343
|
/**
|
|
280
344
|
* Creates a guild from a template.
|
|
281
345
|
*
|
|
282
346
|
* @param templateCode - The code of the template.
|
|
283
347
|
* @param options - The parameters for the creation of the guild.
|
|
284
|
-
* @returns An instance of the created {@link
|
|
348
|
+
* @returns An instance of the created {@link CamelizedDiscordGuild}.
|
|
285
349
|
*
|
|
286
350
|
* @remarks
|
|
287
351
|
* ⚠️ This route can only be used by bots in __fewer than 10 guilds__.
|
|
@@ -299,7 +363,7 @@ export interface RestManager {
|
|
|
299
363
|
* @return A {@link CamelizedDiscordSticker}
|
|
300
364
|
*
|
|
301
365
|
* @remarks
|
|
302
|
-
* Requires the `
|
|
366
|
+
* Requires the `CREATE_GUILD_EXPRESSIONS` permission.
|
|
303
367
|
* Fires a Guild Stickers Update Gateway event.
|
|
304
368
|
* Every guilds has five free sticker slots by default, and each Boost level will grant access to more slots.
|
|
305
369
|
* Lottie stickers can only be uploaded on guilds that have either the `VERIFIED` and/or the `PARTNERED` guild feature.
|
|
@@ -312,7 +376,7 @@ export interface RestManager {
|
|
|
312
376
|
*
|
|
313
377
|
* @param guildId - The ID of the guild to create the template from.
|
|
314
378
|
* @param options - The parameters for the creation of the template.
|
|
315
|
-
* @returns An instance of the created {@link
|
|
379
|
+
* @returns An instance of the created {@link CamelizedDiscordTemplate}.
|
|
316
380
|
*
|
|
317
381
|
* @remarks
|
|
318
382
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -363,12 +427,12 @@ export interface RestManager {
|
|
|
363
427
|
* @param guildId - The ID of the guild to create the scheduled event in.
|
|
364
428
|
* @param options - The parameters for the creation of the scheduled event.
|
|
365
429
|
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
366
|
-
* @returns An instance of the created {@link
|
|
430
|
+
* @returns An instance of the created {@link CamelizedDiscordScheduledEvent}.
|
|
367
431
|
*
|
|
368
432
|
* @remarks
|
|
369
433
|
* Requires the `MANAGE_EVENTS` permission.
|
|
370
434
|
*
|
|
371
|
-
* A guild can only have a maximum of 100 events with a status of {@link ScheduledEventStatus.Active
|
|
435
|
+
* A guild can only have a maximum of 100 events with a status of {@link ScheduledEventStatus}.Active or {@link ScheduledEventStatus}.Scheduled (inclusive).
|
|
372
436
|
*
|
|
373
437
|
* Fires a _Guild Scheduled Event Create_ gateway event.
|
|
374
438
|
*
|
|
@@ -428,7 +492,7 @@ export interface RestManager {
|
|
|
428
492
|
*
|
|
429
493
|
* @param channelId - The ID of the channel to delete.
|
|
430
494
|
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
431
|
-
* @returns
|
|
495
|
+
* @returns nothing
|
|
432
496
|
*
|
|
433
497
|
* @remarks
|
|
434
498
|
* For community guilds, the _Rules_, _Guidelines_ and _Community Update_ channels cannot be deleted.
|
|
@@ -472,7 +536,8 @@ export interface RestManager {
|
|
|
472
536
|
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
473
537
|
*
|
|
474
538
|
* @remarks
|
|
475
|
-
*
|
|
539
|
+
* For emojis created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
540
|
+
* For other emojis, requires the `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
476
541
|
*
|
|
477
542
|
* Fires a _Guild Emojis Update_ gateway event.
|
|
478
543
|
*
|
|
@@ -531,7 +596,8 @@ export interface RestManager {
|
|
|
531
596
|
* @return A {@link CamelizedDiscordSticker}
|
|
532
597
|
*
|
|
533
598
|
* @remarks
|
|
534
|
-
*
|
|
599
|
+
* For stickers created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
600
|
+
* For other stickers, requires the `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
535
601
|
* Fires a Guild Stickers Update Gateway event.
|
|
536
602
|
* Every guilds has five free sticker slots by default, and each Boost level will grant access to more slots.
|
|
537
603
|
* Lottie stickers can only be uploaded on guilds that have either the `VERIFIED` and/or the `PARTNERED` guild feature.
|
|
@@ -786,7 +852,7 @@ export interface RestManager {
|
|
|
786
852
|
* @param commandId - The ID of the command to edit the permissions of.
|
|
787
853
|
* @param bearerToken - The bearer token to use to make the request.
|
|
788
854
|
* @param options - The parameters for the edit of the command permissions.
|
|
789
|
-
* @returns An instance of the edited {@link
|
|
855
|
+
* @returns An instance of the edited {@link CamelizedDiscordGuildApplicationCommandPermissions}.
|
|
790
856
|
*
|
|
791
857
|
* @remarks
|
|
792
858
|
* 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.
|
|
@@ -828,7 +894,7 @@ export interface RestManager {
|
|
|
828
894
|
* @returns An instance of the edited {@link CamelizedDiscordChannel}.
|
|
829
895
|
*
|
|
830
896
|
* @remarks
|
|
831
|
-
* If editing a channel of type {@link ChannelTypes.GroupDm
|
|
897
|
+
* If editing a channel of type {@link ChannelTypes}.GroupDm:
|
|
832
898
|
* - Fires a _Channel Update_ gateway event.
|
|
833
899
|
*
|
|
834
900
|
* If editing a thread channel:
|
|
@@ -844,7 +910,7 @@ export interface RestManager {
|
|
|
844
910
|
*
|
|
845
911
|
* - 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
912
|
*
|
|
847
|
-
* - If modifying a channel of type {@link ChannelTypes.GuildCategory
|
|
913
|
+
* - If modifying a channel of type {@link ChannelTypes}.GuildCategory:
|
|
848
914
|
* - Fires a _Channel Update_ gateway event for each child channel impacted in this change.
|
|
849
915
|
* - Otherwise:
|
|
850
916
|
* - Fires a _Channel Update_ gateway event.
|
|
@@ -891,7 +957,8 @@ export interface RestManager {
|
|
|
891
957
|
* @returns An instance of the updated {@link CamelizedDiscordEmoji}.
|
|
892
958
|
*
|
|
893
959
|
* @remarks
|
|
894
|
-
*
|
|
960
|
+
* For emojis created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
961
|
+
* For other emojis, requires the `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
895
962
|
*
|
|
896
963
|
* Fires a `Guild Emojis Update` gateway event.
|
|
897
964
|
*
|
|
@@ -904,7 +971,7 @@ export interface RestManager {
|
|
|
904
971
|
* @param token - The interaction token to use, provided in the original interaction.
|
|
905
972
|
* @param messageId - The ID of the message to edit.
|
|
906
973
|
* @param options - The parameters for the edit of the message.
|
|
907
|
-
* @returns An instance of the edited {@link
|
|
974
|
+
* @returns An instance of the edited {@link CamelizedDiscordMessage}.
|
|
908
975
|
*
|
|
909
976
|
* @remarks
|
|
910
977
|
* Unlike `editMessage()`, this endpoint allows the bot user to act without needing to see the channel the message is in.
|
|
@@ -921,7 +988,7 @@ export interface RestManager {
|
|
|
921
988
|
*
|
|
922
989
|
* @param commandId - The ID of the command to edit.
|
|
923
990
|
* @param options - The parameters for the edit of the command.
|
|
924
|
-
* @returns An instance of the edited {@link
|
|
991
|
+
* @returns An instance of the edited {@link CamelizedDiscordApplicationCommand}.
|
|
925
992
|
*
|
|
926
993
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command}
|
|
927
994
|
*/
|
|
@@ -933,12 +1000,12 @@ export interface RestManager {
|
|
|
933
1000
|
* @param shardId - The ID of the shard the guild is in.
|
|
934
1001
|
* @param options - The parameters for the edit of the guild.
|
|
935
1002
|
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
936
|
-
* @returns An instance of the edited {@link
|
|
1003
|
+
* @returns An instance of the edited {@link CamelizedDiscordGuild}.
|
|
937
1004
|
*
|
|
938
1005
|
* @remarks
|
|
939
1006
|
* Requires the `MANAGE_GUILD` permission.
|
|
940
1007
|
*
|
|
941
|
-
* If attempting to add or remove the {@link GuildFeatures.Community
|
|
1008
|
+
* If attempting to add or remove the {@link GuildFeatures}.Community feature:
|
|
942
1009
|
* - Requires the `ADMINISTRATOR` permission.
|
|
943
1010
|
*
|
|
944
1011
|
* Fires a _Guild Update_ gateway event.
|
|
@@ -952,7 +1019,7 @@ export interface RestManager {
|
|
|
952
1019
|
* @param guildId - The ID of the guild the command is registered in.
|
|
953
1020
|
* @param commandId - The ID of the command to edit.
|
|
954
1021
|
* @param options - The parameters for the edit of the command.
|
|
955
|
-
* @returns An instance of the edited {@link
|
|
1022
|
+
* @returns An instance of the edited {@link CamelizedDiscordApplicationCommand}.
|
|
956
1023
|
*
|
|
957
1024
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command}
|
|
958
1025
|
*/
|
|
@@ -969,7 +1036,8 @@ export interface RestManager {
|
|
|
969
1036
|
* @return A {@link CamelizedDiscordSticker}
|
|
970
1037
|
*
|
|
971
1038
|
* @remarks
|
|
972
|
-
*
|
|
1039
|
+
* For stickers created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
1040
|
+
* For other stickers, requires the `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
973
1041
|
* Fires a Guild Stickers Update Gateway event.
|
|
974
1042
|
*
|
|
975
1043
|
* @see {@link https://discord.com/developers/docs/resources/sticker#modify-guild-sticker}
|
|
@@ -981,7 +1049,7 @@ export interface RestManager {
|
|
|
981
1049
|
* @param guildId - The ID of the guild to edit a template of.
|
|
982
1050
|
* @param templateCode - The code of the template to edit.
|
|
983
1051
|
* @param options - The parameters for the edit of the template.
|
|
984
|
-
* @returns An instance of the edited {@link
|
|
1052
|
+
* @returns An instance of the edited {@link CamelizedDiscordTemplate}.
|
|
985
1053
|
*
|
|
986
1054
|
* @remarks
|
|
987
1055
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -997,7 +1065,7 @@ export interface RestManager {
|
|
|
997
1065
|
* @param channelId - The ID of the channel to edit the message in.
|
|
998
1066
|
* @param messageId - The IDs of the message to edit.
|
|
999
1067
|
* @param options - The parameters for the edit of the message.
|
|
1000
|
-
* @returns An instance of the edited {@link
|
|
1068
|
+
* @returns An instance of the edited {@link CamelizedDiscordMessage}.
|
|
1001
1069
|
*
|
|
1002
1070
|
* @remarks
|
|
1003
1071
|
* If editing another user's message:
|
|
@@ -1014,7 +1082,7 @@ export interface RestManager {
|
|
|
1014
1082
|
*
|
|
1015
1083
|
* @param token - The interaction token to use, provided in the original interaction.
|
|
1016
1084
|
* @param options - The parameters for the edit of the response.
|
|
1017
|
-
* @returns An instance of the edited {@link
|
|
1085
|
+
* @returns An instance of the edited {@link CamelizedDiscordMessage}.
|
|
1018
1086
|
*
|
|
1019
1087
|
* @remarks
|
|
1020
1088
|
* Unlike `editMessage()`, this endpoint allows the bot user to act without needing to see the channel the message is in.
|
|
@@ -1025,7 +1093,7 @@ export interface RestManager {
|
|
|
1025
1093
|
*
|
|
1026
1094
|
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response}
|
|
1027
1095
|
*/
|
|
1028
|
-
editOriginalInteractionResponse: (token: string, options: InteractionCallbackData) => Promise<CamelizedDiscordMessage
|
|
1096
|
+
editOriginalInteractionResponse: (token: string, options: InteractionCallbackData) => Promise<CamelizedDiscordMessage>;
|
|
1029
1097
|
/**
|
|
1030
1098
|
* Edits the original webhook message.
|
|
1031
1099
|
*
|
|
@@ -1099,14 +1167,14 @@ export interface RestManager {
|
|
|
1099
1167
|
* @param guildId - The ID of the guild to edit the scheduled event in.
|
|
1100
1168
|
* @param eventId - The ID of the scheduled event to edit.
|
|
1101
1169
|
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
1102
|
-
* @returns An instance of the edited {@link
|
|
1170
|
+
* @returns An instance of the edited {@link CamelizedDiscordScheduledEvent}.
|
|
1103
1171
|
*
|
|
1104
1172
|
* @remarks
|
|
1105
1173
|
* Requires the `MANAGE_EVENTS` permission.
|
|
1106
1174
|
*
|
|
1107
1175
|
* To start or end an event, modify the event's `status` property.
|
|
1108
1176
|
*
|
|
1109
|
-
* The `entity_metadata` property is discarded for events whose `entity_type` is not {@link ScheduledEventEntityType.External
|
|
1177
|
+
* The `entity_metadata` property is discarded for events whose `entity_type` is not {@link ScheduledEventEntityType}.External.
|
|
1110
1178
|
*
|
|
1111
1179
|
* Fires a _Guild Scheduled Event Update_ gateway event.
|
|
1112
1180
|
*
|
|
@@ -1143,6 +1211,20 @@ export interface RestManager {
|
|
|
1143
1211
|
* @see {@link https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state}
|
|
1144
1212
|
*/
|
|
1145
1213
|
editUserVoiceState: (guildId: BigString, options: EditUserVoiceState) => Promise<void>;
|
|
1214
|
+
/**
|
|
1215
|
+
* Edit the current user application role connection for the application.
|
|
1216
|
+
*
|
|
1217
|
+
* @param bearerToken - The access token of the user
|
|
1218
|
+
* @param applicationId - The id of the application to edit the role connection
|
|
1219
|
+
* @param options - The options to edit
|
|
1220
|
+
* @returns {CamelizedDiscordApplicationRoleConnection}
|
|
1221
|
+
*
|
|
1222
|
+
* @remarks
|
|
1223
|
+
* This requires the `role_connections.write` scope.
|
|
1224
|
+
*
|
|
1225
|
+
* @see {@link https://discord.com/developers/docs/resources/user#update-user-application-role-connection}
|
|
1226
|
+
*/
|
|
1227
|
+
editUserApplicationRoleConnection: (bearerToken: string, applicationId: BigString, options: CamelizedDiscordApplicationRoleConnection) => Promise<CamelizedDiscordApplicationRoleConnection>;
|
|
1146
1228
|
/**
|
|
1147
1229
|
* Edits a webhook.
|
|
1148
1230
|
*
|
|
@@ -1196,7 +1278,7 @@ export interface RestManager {
|
|
|
1196
1278
|
* @param guildId - The ID of the guild to edit the welcome screen of.
|
|
1197
1279
|
* @param options - The parameters for the edit of the welcome screen.
|
|
1198
1280
|
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
1199
|
-
* @returns An instance of the edited {@link
|
|
1281
|
+
* @returns An instance of the edited {@link CamelizedDiscordWelcomeScreen}.
|
|
1200
1282
|
*
|
|
1201
1283
|
* @remarks
|
|
1202
1284
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -1211,7 +1293,7 @@ export interface RestManager {
|
|
|
1211
1293
|
*
|
|
1212
1294
|
* @param guildId - The ID of the guild to edit the settings of the widget of.
|
|
1213
1295
|
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
1214
|
-
* @returns An instance of the edited {@link
|
|
1296
|
+
* @returns An instance of the edited {@link CamelizedDiscordGuildWidgetSettings}.
|
|
1215
1297
|
*
|
|
1216
1298
|
* @remarks
|
|
1217
1299
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -1266,31 +1348,73 @@ export interface RestManager {
|
|
|
1266
1348
|
getActiveThreads: (guildId: BigString) => Promise<CamelizedDiscordActiveThreads>;
|
|
1267
1349
|
/** Get the applications info */
|
|
1268
1350
|
getApplicationInfo: () => Promise<CamelizedDiscordApplication>;
|
|
1351
|
+
/**
|
|
1352
|
+
* Edit properties of the app associated with the requesting bot user.
|
|
1353
|
+
*
|
|
1354
|
+
* @remarks
|
|
1355
|
+
* Only properties that are passed will be updated.
|
|
1356
|
+
*/
|
|
1357
|
+
editApplicationInfo: (body: EditApplication) => Promise<CamelizedDiscordApplication>;
|
|
1358
|
+
/**
|
|
1359
|
+
* Get the current authentication info for the authenticated user
|
|
1360
|
+
*
|
|
1361
|
+
* @param bearerToken - Any OAuth2 derived access token
|
|
1362
|
+
* @returns An instance of {@link CamelizedDiscordCurrentAuthorization}
|
|
1363
|
+
*
|
|
1364
|
+
* @remarks
|
|
1365
|
+
* The user object is not defined if the scopes do not include `identify`.
|
|
1366
|
+
* In the user object, if defined, the email is not included if the scopes do not include `email`
|
|
1367
|
+
*/
|
|
1368
|
+
getCurrentAuthenticationInfo: (bearerToken: string) => Promise<CamelizedDiscordCurrentAuthorization>;
|
|
1369
|
+
/**
|
|
1370
|
+
* Exchange the information to get a OAuth2 accessToken token
|
|
1371
|
+
*
|
|
1372
|
+
* @param clientId - Application's client id
|
|
1373
|
+
* @param clientSecret - application's client secret
|
|
1374
|
+
* @param options - The options to make the exchange with discord
|
|
1375
|
+
*/
|
|
1376
|
+
exchangeToken: (clientId: BigString, clientSecret: string, options: CamelizedDiscordTokenExchange) => Promise<CamelizedDiscordAccessTokenResponse>;
|
|
1377
|
+
/**
|
|
1378
|
+
* Revoke an access_token
|
|
1379
|
+
*
|
|
1380
|
+
* @param clientId - Application's client id
|
|
1381
|
+
* @param clientSecret - application's client secret
|
|
1382
|
+
* @param options - The options to revoke the access_token
|
|
1383
|
+
*/
|
|
1384
|
+
revokeToken: (clientId: BigString, clientSecret: string, options: CamelizedDiscordTokenRevocation) => Promise<void>;
|
|
1269
1385
|
/**
|
|
1270
1386
|
* Gets the permissions of a guild application command.
|
|
1271
1387
|
*
|
|
1272
1388
|
* @param guildId - The ID of the guild the command is registered in.
|
|
1273
1389
|
* @param commandId - The ID of the command to get the permissions of.
|
|
1274
|
-
* @
|
|
1390
|
+
* @param options - The OAuth2 related optional parameters for the endpoint
|
|
1391
|
+
* @returns An instance of {@link CamelizedDiscordGuildApplicationCommandPermissions}.
|
|
1392
|
+
*
|
|
1393
|
+
* @remarks
|
|
1394
|
+
* Then specifying the options object the access token passed-in requires the OAuth2 scope `applications.commands.permissions.update`
|
|
1275
1395
|
*
|
|
1276
1396
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions}
|
|
1277
1397
|
*/
|
|
1278
|
-
getApplicationCommandPermission: (guildId: BigString, commandId: BigString) => Promise<CamelizedDiscordGuildApplicationCommandPermissions>;
|
|
1398
|
+
getApplicationCommandPermission: (guildId: BigString, commandId: BigString, options?: GetApplicationCommandPermissionOptions) => Promise<CamelizedDiscordGuildApplicationCommandPermissions>;
|
|
1279
1399
|
/**
|
|
1280
|
-
* Gets the permissions of all application commands registered in a guild by the ID of the guild.
|
|
1400
|
+
* Gets the permissions of all application commands registered in a guild by the ID of the guild and optionally an external application.
|
|
1281
1401
|
*
|
|
1282
1402
|
* @param guildId - The ID of the guild to get the permissions objects of.
|
|
1283
|
-
* @
|
|
1403
|
+
* @param options - The OAuth2 related optional parameters for the endpoint
|
|
1404
|
+
* @returns A collection of {@link CamelizedDiscordGuildApplicationCommandPermissions} objects assorted by command ID.
|
|
1405
|
+
*
|
|
1406
|
+
* @remarks
|
|
1407
|
+
* Then specifying the options object the access token passed-in requires the OAuth2 scope `applications.commands.permissions.update`
|
|
1284
1408
|
*
|
|
1285
1409
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions}
|
|
1286
1410
|
*/
|
|
1287
|
-
getApplicationCommandPermissions: (guildId: BigString) => Promise<CamelizedDiscordGuildApplicationCommandPermissions[]>;
|
|
1411
|
+
getApplicationCommandPermissions: (guildId: BigString, options?: GetApplicationCommandPermissionOptions) => Promise<CamelizedDiscordGuildApplicationCommandPermissions[]>;
|
|
1288
1412
|
/**
|
|
1289
1413
|
* Gets a guild's audit log.
|
|
1290
1414
|
*
|
|
1291
1415
|
* @param guildId - The ID of the guild to get the audit log of.
|
|
1292
1416
|
* @param options - The parameters for the fetching of the audit log.
|
|
1293
|
-
* @returns An instance of {@link
|
|
1417
|
+
* @returns An instance of {@link CamelizedDiscordAuditLog}.
|
|
1294
1418
|
*
|
|
1295
1419
|
* @remarks
|
|
1296
1420
|
* Requires the `VIEW_AUDIT_LOG` permission.
|
|
@@ -1326,7 +1450,7 @@ export interface RestManager {
|
|
|
1326
1450
|
/**
|
|
1327
1451
|
* Gets the list of available voice regions.
|
|
1328
1452
|
*
|
|
1329
|
-
* @returns A collection of {@link
|
|
1453
|
+
* @returns A collection of {@link CamelizedDiscordVoiceRegion} objects assorted by voice region ID.
|
|
1330
1454
|
*/
|
|
1331
1455
|
getAvailableVoiceRegions: () => Promise<CamelizedDiscordVoiceRegion[]>;
|
|
1332
1456
|
/**
|
|
@@ -1364,7 +1488,7 @@ export interface RestManager {
|
|
|
1364
1488
|
* @returns An instance of {@link CamelizedDiscordChannel}.
|
|
1365
1489
|
*
|
|
1366
1490
|
* @remarks
|
|
1367
|
-
* If the channel is a thread, a {@link
|
|
1491
|
+
* If the channel is a thread, a {@link CamelizedDiscordThreadMember} object is included in the result.
|
|
1368
1492
|
*
|
|
1369
1493
|
* @see {@link https://discord.com/developers/docs/resources/channel#get-channel}
|
|
1370
1494
|
*/
|
|
@@ -1416,6 +1540,22 @@ export interface RestManager {
|
|
|
1416
1540
|
* @see {@link https://discord.com/developers/docs/resources/user#create-dm}
|
|
1417
1541
|
*/
|
|
1418
1542
|
getDmChannel: (userId: BigString) => Promise<CamelizedDiscordChannel>;
|
|
1543
|
+
/**
|
|
1544
|
+
* Create a new group DM channel with multiple users.
|
|
1545
|
+
*
|
|
1546
|
+
* @param options - The options for create a new group dm
|
|
1547
|
+
* @returns An instance of {@link CamelizedDiscordChannel}.
|
|
1548
|
+
*
|
|
1549
|
+
* @remarks
|
|
1550
|
+
* The access tokens require to have the `gdm.join` scope
|
|
1551
|
+
*
|
|
1552
|
+
* This endpoint is limited to 10 active group DMs.
|
|
1553
|
+
*
|
|
1554
|
+
* Fires a _Channel create_ gateway event.
|
|
1555
|
+
*
|
|
1556
|
+
* @see {@link https://discord.com/developers/docs/resources/user#create-group-dm}
|
|
1557
|
+
*/
|
|
1558
|
+
getGroupDmChannel: (options: GetGroupDmOptions) => Promise<CamelizedDiscordChannel>;
|
|
1419
1559
|
/**
|
|
1420
1560
|
* Gets an emoji by its ID.
|
|
1421
1561
|
*
|
|
@@ -1423,6 +1563,10 @@ export interface RestManager {
|
|
|
1423
1563
|
* @param emojiId - The ID of the emoji to get.
|
|
1424
1564
|
* @returns An instance of {@link CamelizedDiscordEmoji}.
|
|
1425
1565
|
*
|
|
1566
|
+
* @remarks
|
|
1567
|
+
* Includes the `user` field if the bot has the `MANAGE_GUILD_EXPRESSIONS` permission,
|
|
1568
|
+
* or if the bot created the emoji and has the the `CREATE_GUILD_EXPRESSIONS` permission.
|
|
1569
|
+
*
|
|
1426
1570
|
* @see {@link https://discord.com/developers/docs/resources/emoji#get-guild-emoji}
|
|
1427
1571
|
*/
|
|
1428
1572
|
getEmoji: (guildId: BigString, emojiId: BigString) => Promise<CamelizedDiscordEmoji>;
|
|
@@ -1432,6 +1576,9 @@ export interface RestManager {
|
|
|
1432
1576
|
* @param guildId - The ID of the guild which to get the emojis of.
|
|
1433
1577
|
* @returns A collection of {@link CamelizedDiscordEmoji} objects assorted by emoji ID.
|
|
1434
1578
|
*
|
|
1579
|
+
* @remarks
|
|
1580
|
+
* Includes `user` fields if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
1581
|
+
*
|
|
1435
1582
|
* @see {@link https://discord.com/developers/docs/resources/emoji#list-guild-emojis}
|
|
1436
1583
|
*/
|
|
1437
1584
|
getEmojis: (guildId: BigString) => Promise<CamelizedDiscordEmoji[]>;
|
|
@@ -1440,7 +1587,7 @@ export interface RestManager {
|
|
|
1440
1587
|
*
|
|
1441
1588
|
* @param token - The interaction token to use, provided in the original interaction.
|
|
1442
1589
|
* @param messageId - The ID of the message to get.
|
|
1443
|
-
* @returns An instance of {@link
|
|
1590
|
+
* @returns An instance of {@link CamelizedDiscordMessage}.
|
|
1444
1591
|
*
|
|
1445
1592
|
* @remarks
|
|
1446
1593
|
* Unlike `getMessage()`, this endpoint allows the bot user to act without:
|
|
@@ -1458,7 +1605,7 @@ export interface RestManager {
|
|
|
1458
1605
|
* Gets a global application command by its ID.
|
|
1459
1606
|
*
|
|
1460
1607
|
* @param commandId - The ID of the command to get.
|
|
1461
|
-
* @returns An instance of {@link
|
|
1608
|
+
* @returns An instance of {@link CamelizedDiscordApplicationCommand}.
|
|
1462
1609
|
*
|
|
1463
1610
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-command}
|
|
1464
1611
|
*/
|
|
@@ -1466,7 +1613,7 @@ export interface RestManager {
|
|
|
1466
1613
|
/**
|
|
1467
1614
|
* Gets the list of your bot's global application commands.
|
|
1468
1615
|
*
|
|
1469
|
-
* @returns A collection of {@link
|
|
1616
|
+
* @returns A collection of {@link CamelizedDiscordApplicationCommand} objects assorted by command ID.
|
|
1470
1617
|
*
|
|
1471
1618
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands}
|
|
1472
1619
|
*/
|
|
@@ -1476,19 +1623,32 @@ export interface RestManager {
|
|
|
1476
1623
|
*
|
|
1477
1624
|
* @param guildId - The ID of the guild to get.
|
|
1478
1625
|
* @param options - The parameters for the fetching of the guild.
|
|
1479
|
-
* @returns An instance of {@link
|
|
1626
|
+
* @returns An instance of {@link CamelizedDiscordGuild}.
|
|
1480
1627
|
*
|
|
1481
1628
|
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild}
|
|
1482
1629
|
*/
|
|
1483
1630
|
getGuild: (guildId: BigString, options?: {
|
|
1484
1631
|
counts?: boolean;
|
|
1485
1632
|
}) => Promise<CamelizedDiscordGuild>;
|
|
1633
|
+
/**
|
|
1634
|
+
* Get the user guilds.
|
|
1635
|
+
*
|
|
1636
|
+
* @param bearerToken - The access token of the user, if unspecified the bot token is used instead
|
|
1637
|
+
* @param options - The parameters for the fetching of the guild.
|
|
1638
|
+
* @returns An instance of {@link CamelizedDiscordGuild}.
|
|
1639
|
+
*
|
|
1640
|
+
* @remarks
|
|
1641
|
+
* If used with an access token, the token needs to have the `guilds` scope
|
|
1642
|
+
*
|
|
1643
|
+
* @see {@link https://discord.com/developers/docs/resources/user#get-current-user-guilds}
|
|
1644
|
+
*/
|
|
1645
|
+
getGuilds: (bearerToken?: string, options?: GetUserGuilds) => Promise<CamelizedDiscordPartialGuild[]>;
|
|
1486
1646
|
/**
|
|
1487
1647
|
* Gets a guild application command by its ID.
|
|
1488
1648
|
*
|
|
1489
1649
|
* @param guildId - The ID of the guild the command is registered in.
|
|
1490
1650
|
* @param commandId - The ID of the command to get.
|
|
1491
|
-
* @returns An instance of {@link
|
|
1651
|
+
* @returns An instance of {@link CamelizedDiscordApplicationCommand}.
|
|
1492
1652
|
*
|
|
1493
1653
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command}
|
|
1494
1654
|
*/
|
|
@@ -1497,7 +1657,7 @@ export interface RestManager {
|
|
|
1497
1657
|
* Gets the list of application commands registered by your bot in a guild.
|
|
1498
1658
|
*
|
|
1499
1659
|
* @param guildId - The ID of the guild the commands are registered in.
|
|
1500
|
-
* @returns A collection of {@link
|
|
1660
|
+
* @returns A collection of {@link CamelizedDiscordApplicationCommand} objects assorted by command ID.
|
|
1501
1661
|
*
|
|
1502
1662
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-commandss}
|
|
1503
1663
|
*/
|
|
@@ -1506,10 +1666,10 @@ export interface RestManager {
|
|
|
1506
1666
|
* Gets the preview of a guild by a guild's ID.
|
|
1507
1667
|
*
|
|
1508
1668
|
* @param guildId - The ID of the guild to get the preview of.
|
|
1509
|
-
* @returns An instance of {@link
|
|
1669
|
+
* @returns An instance of {@link CamelizedDiscordGuildPreview}.
|
|
1510
1670
|
*
|
|
1511
1671
|
* @remarks
|
|
1512
|
-
* If the bot user is not in the guild, the guild must be
|
|
1672
|
+
* If the bot user is not in the guild, the guild must be discoverable.
|
|
1513
1673
|
*
|
|
1514
1674
|
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-preview}
|
|
1515
1675
|
*/
|
|
@@ -1521,7 +1681,7 @@ export interface RestManager {
|
|
|
1521
1681
|
* @param stickerId The ID of the sticker to get
|
|
1522
1682
|
* @return A {@link CamelizedDiscordSticker}
|
|
1523
1683
|
*
|
|
1524
|
-
* @remarks Includes the user field if the bot has the `
|
|
1684
|
+
* @remarks Includes the user field if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
1525
1685
|
*
|
|
1526
1686
|
* @see {@link https://discord.com/developers/docs/resources/sticker#get-guild-sticker}
|
|
1527
1687
|
*/
|
|
@@ -1532,7 +1692,7 @@ export interface RestManager {
|
|
|
1532
1692
|
* @param guildId The ID of the guild to get
|
|
1533
1693
|
* @returns A collection of {@link CamelizedDiscordSticker} objects assorted by sticker ID.
|
|
1534
1694
|
*
|
|
1535
|
-
* @remarks Includes user fields if the bot has the `
|
|
1695
|
+
* @remarks Includes user fields if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission.
|
|
1536
1696
|
*
|
|
1537
1697
|
* @see {@link https://discord.com/developers/docs/resources/sticker#list-guild-stickers}
|
|
1538
1698
|
*/
|
|
@@ -1541,7 +1701,7 @@ export interface RestManager {
|
|
|
1541
1701
|
* Gets a template by its code.
|
|
1542
1702
|
*
|
|
1543
1703
|
* @param templateCode - The code of the template to get.
|
|
1544
|
-
* @returns An instance of {@link
|
|
1704
|
+
* @returns An instance of {@link CamelizedDiscordTemplate}.
|
|
1545
1705
|
*
|
|
1546
1706
|
* @remarks
|
|
1547
1707
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -1553,7 +1713,7 @@ export interface RestManager {
|
|
|
1553
1713
|
* Gets the list of templates for a guild.
|
|
1554
1714
|
*
|
|
1555
1715
|
* @param guildId - The ID of the guild to get the list of templates for.
|
|
1556
|
-
* @returns A collection of {@link
|
|
1716
|
+
* @returns A collection of {@link CamelizedDiscordTemplate} objects assorted by template code.
|
|
1557
1717
|
*
|
|
1558
1718
|
* @remarks
|
|
1559
1719
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -1577,7 +1737,7 @@ export interface RestManager {
|
|
|
1577
1737
|
* Gets the list of integrations attached to a guild.
|
|
1578
1738
|
*
|
|
1579
1739
|
* @param guildId - The ID of the guild to get the list of integrations from.
|
|
1580
|
-
* @returns A collection of {@link
|
|
1740
|
+
* @returns A collection of {@link CamelizedDiscordIntegration} objects assorted by integration ID.
|
|
1581
1741
|
*
|
|
1582
1742
|
* @remarks
|
|
1583
1743
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -1599,7 +1759,7 @@ export interface RestManager {
|
|
|
1599
1759
|
* Gets the list of invites for a guild.
|
|
1600
1760
|
*
|
|
1601
1761
|
* @param guildId - The ID of the guild to get the invites from.
|
|
1602
|
-
* @returns A collection of {@link
|
|
1762
|
+
* @returns A collection of {@link CamelizedDiscordInviteMetadata} objects assorted by invite code.
|
|
1603
1763
|
*
|
|
1604
1764
|
* @remarks
|
|
1605
1765
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -1612,7 +1772,7 @@ export interface RestManager {
|
|
|
1612
1772
|
*
|
|
1613
1773
|
* @param channelId - The ID of the channel from which to get the message.
|
|
1614
1774
|
* @param messageId - The ID of the message to get.
|
|
1615
|
-
* @returns An instance of {@link
|
|
1775
|
+
* @returns An instance of {@link CamelizedDiscordMessage}.
|
|
1616
1776
|
*
|
|
1617
1777
|
* @remarks
|
|
1618
1778
|
* Requires that the bot user be able to see the contents of the channel in which the message was posted.
|
|
@@ -1628,7 +1788,7 @@ export interface RestManager {
|
|
|
1628
1788
|
*
|
|
1629
1789
|
* @param channelId - The ID of the channel from which to get the messages.
|
|
1630
1790
|
* @param options - The parameters for the fetching of the messages.
|
|
1631
|
-
* @returns A collection of {@link
|
|
1791
|
+
* @returns A collection of {@link CamelizedDiscordMessage} objects assorted by message ID.
|
|
1632
1792
|
*
|
|
1633
1793
|
* @remarks
|
|
1634
1794
|
* Requires that the bot user be able to see the contents of the channel in which the messages were posted.
|
|
@@ -1640,18 +1800,18 @@ export interface RestManager {
|
|
|
1640
1800
|
*/
|
|
1641
1801
|
getMessages: (channelId: BigString, options?: GetMessagesOptions) => Promise<CamelizedDiscordMessage[]>;
|
|
1642
1802
|
/**
|
|
1643
|
-
* Returns the list of sticker packs available
|
|
1803
|
+
* Returns the list of sticker packs available.
|
|
1644
1804
|
*
|
|
1645
|
-
* @returns A collection of {@link
|
|
1805
|
+
* @returns A collection of {@link CamelizedDiscordStickerPack} objects assorted by sticker ID.
|
|
1646
1806
|
*
|
|
1647
|
-
* @see {@link https://discord.com/developers/docs/resources/sticker#list-
|
|
1807
|
+
* @see {@link https://discord.com/developers/docs/resources/sticker#list-sticker-packs}
|
|
1648
1808
|
*/
|
|
1649
|
-
|
|
1809
|
+
getStickerPacks: () => Promise<CamelizedDiscordStickerPack[]>;
|
|
1650
1810
|
/**
|
|
1651
1811
|
* Gets the initial message response to an interaction.
|
|
1652
1812
|
*
|
|
1653
1813
|
* @param token - The interaction token to use, provided in the original interaction.
|
|
1654
|
-
* @returns An instance of {@link
|
|
1814
|
+
* @returns An instance of {@link CamelizedDiscordMessage}.
|
|
1655
1815
|
*
|
|
1656
1816
|
* @remarks
|
|
1657
1817
|
* Unlike `getMessage()`, this endpoint allows the bot user to act without:
|
|
@@ -1667,7 +1827,7 @@ export interface RestManager {
|
|
|
1667
1827
|
* Gets the pinned messages for a channel.
|
|
1668
1828
|
*
|
|
1669
1829
|
* @param channelId - The ID of the channel to get the pinned messages for.
|
|
1670
|
-
* @returns A collection of {@link
|
|
1830
|
+
* @returns A collection of {@link CamelizedDiscordMessage} objects assorted by message ID.
|
|
1671
1831
|
*
|
|
1672
1832
|
* @remarks
|
|
1673
1833
|
* Requires that the bot user be able to see the contents of the channel in which the messages were posted.
|
|
@@ -1689,7 +1849,7 @@ export interface RestManager {
|
|
|
1689
1849
|
* Requires the `READ_MESSAGE_HISTORY` permission.
|
|
1690
1850
|
* Requires the `MANAGE_THREADS` permission.
|
|
1691
1851
|
*
|
|
1692
|
-
* Returns threads of type {@link ChannelTypes.GuildPrivateThread
|
|
1852
|
+
* Returns threads of type {@link ChannelTypes}.GuildPrivateThread.
|
|
1693
1853
|
*
|
|
1694
1854
|
* Threads are ordered by the `archive_timestamp` property included in the metadata of the object in descending order.
|
|
1695
1855
|
*
|
|
@@ -1706,7 +1866,7 @@ export interface RestManager {
|
|
|
1706
1866
|
* @remarks
|
|
1707
1867
|
* Requires the `READ_MESSAGE_HISTORY` permission.
|
|
1708
1868
|
*
|
|
1709
|
-
* Returns threads of type {@link ChannelTypes.GuildPrivateThread
|
|
1869
|
+
* Returns threads of type {@link ChannelTypes}.GuildPrivateThread.
|
|
1710
1870
|
*
|
|
1711
1871
|
* Threads are ordered by the `id` property in descending order.
|
|
1712
1872
|
*
|
|
@@ -1721,7 +1881,7 @@ export interface RestManager {
|
|
|
1721
1881
|
* @returns A number indicating the number of members that would be kicked.
|
|
1722
1882
|
*
|
|
1723
1883
|
* @remarks
|
|
1724
|
-
* Requires the `KICK_MEMBERS`
|
|
1884
|
+
* Requires the `MANAGE_GUILD` and `KICK_MEMBERS` permissions.
|
|
1725
1885
|
*
|
|
1726
1886
|
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-prune-count}
|
|
1727
1887
|
*/
|
|
@@ -1731,13 +1891,13 @@ export interface RestManager {
|
|
|
1731
1891
|
*
|
|
1732
1892
|
* @param channelId - The ID of the channel to get the archived threads for.
|
|
1733
1893
|
* @param options - The parameters for the fetching of threads.
|
|
1734
|
-
* @returns An instance of {@link
|
|
1894
|
+
* @returns An instance of {@link CamelizedDiscordArchivedThreads}.
|
|
1735
1895
|
*
|
|
1736
1896
|
* @remarks
|
|
1737
1897
|
* Requires the `READ_MESSAGE_HISTORY` permission.
|
|
1738
1898
|
*
|
|
1739
|
-
* If called on a channel of type {@link ChannelTypes.GuildText
|
|
1740
|
-
* If called on a channel of type {@link ChannelTypes.GuildNews
|
|
1899
|
+
* If called on a channel of type {@link ChannelTypes}.GuildText, returns threads of type {@link ChannelTypes}.GuildPublicThread.
|
|
1900
|
+
* If called on a channel of type {@link ChannelTypes}.GuildNews, returns threads of type {@link ChannelTypes}.GuildNewsThread.
|
|
1741
1901
|
*
|
|
1742
1902
|
* Threads are ordered by the `archive_timestamp` property included in the metadata of the object in descending order.
|
|
1743
1903
|
*
|
|
@@ -1748,10 +1908,10 @@ export interface RestManager {
|
|
|
1748
1908
|
* Gets the list of roles for a guild.
|
|
1749
1909
|
*
|
|
1750
1910
|
* @param guildId - The ID of the guild to get the list of roles for.
|
|
1751
|
-
* @returns A collection of {@link
|
|
1911
|
+
* @returns A collection of {@link CamelizedDiscordRole} objects assorted by role ID.
|
|
1752
1912
|
*
|
|
1753
1913
|
* @remarks
|
|
1754
|
-
* ⚠️ This endpoint should be used sparingly due to {@link
|
|
1914
|
+
* ⚠️ This endpoint should be used sparingly due to {@link CamelizedDiscordRole} objects already being included in guild payloads.
|
|
1755
1915
|
*
|
|
1756
1916
|
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-roles}
|
|
1757
1917
|
*/
|
|
@@ -1762,7 +1922,7 @@ export interface RestManager {
|
|
|
1762
1922
|
* @param guildId - The ID of the guild to get the scheduled event from.
|
|
1763
1923
|
* @param eventId - The ID of the scheduled event to get.
|
|
1764
1924
|
* @param options - The parameters for the fetching of the scheduled event.
|
|
1765
|
-
* @returns An instance of {@link
|
|
1925
|
+
* @returns An instance of {@link CamelizedDiscordScheduledEvent}.
|
|
1766
1926
|
*
|
|
1767
1927
|
* @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event}
|
|
1768
1928
|
*/
|
|
@@ -1774,7 +1934,7 @@ export interface RestManager {
|
|
|
1774
1934
|
*
|
|
1775
1935
|
* @param guildId - The ID of the guild to get the scheduled events from.
|
|
1776
1936
|
* @param options - The parameters for the fetching of the scheduled events.
|
|
1777
|
-
* @returns A collection of {@link
|
|
1937
|
+
* @returns A collection of {@link CamelizedDiscordScheduledEvent} objects assorted by event ID.
|
|
1778
1938
|
*
|
|
1779
1939
|
* @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild}
|
|
1780
1940
|
*/
|
|
@@ -1785,7 +1945,7 @@ export interface RestManager {
|
|
|
1785
1945
|
* @param guildId - The ID of the guild to get the subscribers to the scheduled event from.
|
|
1786
1946
|
* @param eventId - The ID of the scheduled event to get the subscribers of.
|
|
1787
1947
|
* @param options - The parameters for the fetching of the subscribers.
|
|
1788
|
-
* @returns A collection of {@link
|
|
1948
|
+
* @returns A collection of {@link CamelizedDiscordUser} objects assorted by user ID.
|
|
1789
1949
|
*
|
|
1790
1950
|
* @remarks
|
|
1791
1951
|
* Requires the `MANAGE_EVENTS` permission.
|
|
@@ -1847,7 +2007,7 @@ export interface RestManager {
|
|
|
1847
2007
|
* @param messageId - The ID of the message to get the users for.
|
|
1848
2008
|
* @param reaction - The reaction for which to get the users.
|
|
1849
2009
|
* @param options - The parameters for the fetching of the users.
|
|
1850
|
-
* @returns A collection of {@link
|
|
2010
|
+
* @returns A collection of {@link CamelizedDiscordUser} objects assorted by user ID.
|
|
1851
2011
|
*
|
|
1852
2012
|
* @see {@link https://discord.com/developers/docs/resources/channel#get-reactions}
|
|
1853
2013
|
*/
|
|
@@ -1859,11 +2019,46 @@ export interface RestManager {
|
|
|
1859
2019
|
* @returns {CamelizedDiscordUser}
|
|
1860
2020
|
*/
|
|
1861
2021
|
getUser: (id: BigString) => Promise<CamelizedDiscordUser>;
|
|
2022
|
+
/**
|
|
2023
|
+
* Get the current user data.
|
|
2024
|
+
*
|
|
2025
|
+
* @param bearerToken - The access token of the user
|
|
2026
|
+
* @returns {CamelizedDiscordUser}
|
|
2027
|
+
*
|
|
2028
|
+
* @remarks
|
|
2029
|
+
* This requires the `identify` scope.
|
|
2030
|
+
*
|
|
2031
|
+
* To get the mail this also requires the `email` scope
|
|
2032
|
+
*/
|
|
2033
|
+
getCurrentUser: (bearerToken: string) => Promise<CamelizedDiscordUser>;
|
|
2034
|
+
/**
|
|
2035
|
+
* Get the current user connections.
|
|
2036
|
+
*
|
|
2037
|
+
* @param bearerToken - The access token of the user
|
|
2038
|
+
* @returns {CamelizedDiscordConnection[]}
|
|
2039
|
+
*
|
|
2040
|
+
* @remarks
|
|
2041
|
+
* This requires the `connections` scope.
|
|
2042
|
+
*/
|
|
2043
|
+
getUserConnections: (bearerToken: string) => Promise<CamelizedDiscordConnection[]>;
|
|
2044
|
+
/**
|
|
2045
|
+
* Get the current user application role connection for the application.
|
|
2046
|
+
*
|
|
2047
|
+
* @param bearerToken - The access token of the user
|
|
2048
|
+
* @param applicationId - The id of the application to get the role connection
|
|
2049
|
+
* @returns {CamelizedDiscordApplicationRoleConnection}
|
|
2050
|
+
*
|
|
2051
|
+
* @remarks
|
|
2052
|
+
* The access token requires the `role_connections.write` scope.
|
|
2053
|
+
*
|
|
2054
|
+
* @see {@link https://discord.com/developers/docs/resources/user#get-user-application-role-connection}
|
|
2055
|
+
*/
|
|
2056
|
+
getUserApplicationRoleConnection: (bearerToken: string, applicationId: BigString) => Promise<CamelizedDiscordApplicationRoleConnection>;
|
|
1862
2057
|
/**
|
|
1863
2058
|
* Gets information about the vanity url of a guild.
|
|
1864
2059
|
*
|
|
1865
2060
|
* @param guildId - The ID of the guild to get the vanity url information for.
|
|
1866
|
-
* @returns An instance of {@link
|
|
2061
|
+
* @returns An instance of {@link CamelizedDiscordVanityUrl}.
|
|
1867
2062
|
*
|
|
1868
2063
|
* @remarks
|
|
1869
2064
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -1877,7 +2072,7 @@ export interface RestManager {
|
|
|
1877
2072
|
* Gets the list of voice regions for a guild.
|
|
1878
2073
|
*
|
|
1879
2074
|
* @param guildId - The ID of the guild to get the voice regions for.
|
|
1880
|
-
* @returns A collection of {@link
|
|
2075
|
+
* @returns A collection of {@link CamelizedDiscordVoiceRegion} objects assorted by voice region ID.
|
|
1881
2076
|
*
|
|
1882
2077
|
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-voice-regions}
|
|
1883
2078
|
*/
|
|
@@ -1920,7 +2115,7 @@ export interface RestManager {
|
|
|
1920
2115
|
* Gets the welcome screen for a guild.
|
|
1921
2116
|
*
|
|
1922
2117
|
* @param guildId - The ID of the guild to get the welcome screen for.
|
|
1923
|
-
* @returns An instance of {@link
|
|
2118
|
+
* @returns An instance of {@link CamelizedDiscordWelcomeScreen}.
|
|
1924
2119
|
*
|
|
1925
2120
|
* @remarks
|
|
1926
2121
|
* If the welcome screen is not enabled:
|
|
@@ -1933,7 +2128,10 @@ export interface RestManager {
|
|
|
1933
2128
|
* Gets the guild widget by guild ID.
|
|
1934
2129
|
*
|
|
1935
2130
|
* @param guildId - The ID of the guild to get the widget of.
|
|
1936
|
-
* @returns An instance of {@link
|
|
2131
|
+
* @returns An instance of {@link CamelizedDiscordGuildWidget}.
|
|
2132
|
+
*
|
|
2133
|
+
* @remarks
|
|
2134
|
+
* Fires an `INVITE_CREATED` Gateway event when an invite channel is defined and a new `Invite` is generated.
|
|
1937
2135
|
*
|
|
1938
2136
|
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-widget}
|
|
1939
2137
|
*/
|
|
@@ -1942,7 +2140,7 @@ export interface RestManager {
|
|
|
1942
2140
|
* Gets the settings of a guild's widget.
|
|
1943
2141
|
*
|
|
1944
2142
|
* @param guildId - The ID of the guild to get the widget of.
|
|
1945
|
-
* @returns An instance of {@link
|
|
2143
|
+
* @returns An instance of {@link CamelizedDiscordGuildWidgetSettings}.
|
|
1946
2144
|
*
|
|
1947
2145
|
* @remarks
|
|
1948
2146
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -1992,7 +2190,7 @@ export interface RestManager {
|
|
|
1992
2190
|
*
|
|
1993
2191
|
* @param channelId - The ID of the announcement channel.
|
|
1994
2192
|
* @param messageId - The ID of the message to cross-post.
|
|
1995
|
-
* @returns An instance of the cross-posted {@link
|
|
2193
|
+
* @returns An instance of the cross-posted {@link CamelizedDiscordMessage}.
|
|
1996
2194
|
*
|
|
1997
2195
|
* @remarks
|
|
1998
2196
|
* Requires the `SEND_MESSAGES` permission.
|
|
@@ -2028,7 +2226,7 @@ export interface RestManager {
|
|
|
2028
2226
|
* @param userId - The user ID of the thread member to remove.
|
|
2029
2227
|
*
|
|
2030
2228
|
* @remarks
|
|
2031
|
-
* If the thread is of type {@link ChannelTypes.GuildPrivateThread
|
|
2229
|
+
* If the thread is of type {@link ChannelTypes}.GuildPrivateThread, requires to be the creator of the thread.
|
|
2032
2230
|
* Otherwise, requires the `MANAGE_THREADS` permission.
|
|
2033
2231
|
*
|
|
2034
2232
|
* Requires the thread not be archived.
|
|
@@ -2038,6 +2236,15 @@ export interface RestManager {
|
|
|
2038
2236
|
* @see {@link https://discord.com/developers/docs/resources/channel#remove-thread-member}
|
|
2039
2237
|
*/
|
|
2040
2238
|
removeThreadMember: (channelId: BigString, userId: BigString) => Promise<void>;
|
|
2239
|
+
/**
|
|
2240
|
+
* Removes a member from a Group DM.
|
|
2241
|
+
*
|
|
2242
|
+
* @param channelId - The ID of the channel to remove the recipient user of.
|
|
2243
|
+
* @param userId - The user ID of the user to remove.
|
|
2244
|
+
*
|
|
2245
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#group-dm-remove-recipient}
|
|
2246
|
+
*/
|
|
2247
|
+
removeDmRecipient: (channelId: BigString, userId: BigString) => Promise<void>;
|
|
2041
2248
|
/**
|
|
2042
2249
|
* Sends a message to a channel.
|
|
2043
2250
|
*
|
|
@@ -2070,7 +2277,7 @@ export interface RestManager {
|
|
|
2070
2277
|
*
|
|
2071
2278
|
* @param token - The interaction token to use, provided in the original interaction.
|
|
2072
2279
|
* @param options - The parameters for the creation of the message.
|
|
2073
|
-
* @returns An instance of the created {@link
|
|
2280
|
+
* @returns An instance of the created {@link CamelizedDiscordMessage}.
|
|
2074
2281
|
*
|
|
2075
2282
|
* @remarks
|
|
2076
2283
|
* ⚠️ Interaction tokens are only valid for _15 minutes_.
|
|
@@ -2092,7 +2299,7 @@ export interface RestManager {
|
|
|
2092
2299
|
* @param interactionId - The ID of the interaction to respond to.
|
|
2093
2300
|
* @param token - The interaction token to use, provided in the original interaction.
|
|
2094
2301
|
* @param options - The parameters for the creation of the message.
|
|
2095
|
-
* @returns An instance of the created {@link
|
|
2302
|
+
* @returns An instance of the created {@link CamelizedDiscordMessage}.
|
|
2096
2303
|
*
|
|
2097
2304
|
* @remarks
|
|
2098
2305
|
* ⚠️ Interaction tokens are only valid for _15 minutes_.
|
|
@@ -2115,12 +2322,12 @@ export interface RestManager {
|
|
|
2115
2322
|
* @param messageId - The ID of the message to use as the thread's point of origin.
|
|
2116
2323
|
* @param options - The parameters to use for the creation of the thread.
|
|
2117
2324
|
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2118
|
-
* @returns An instance of the created {@link
|
|
2325
|
+
* @returns An instance of the created {@link CamelizedDiscordChannel}.
|
|
2119
2326
|
*
|
|
2120
2327
|
* @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
|
|
2328
|
+
* If called on a channel of type {@link ChannelTypes}.GuildText, creates a {@link ChannelTypes}.GuildPublicThread.
|
|
2329
|
+
* If called on a channel of type {@link ChannelTypes}.GuildNews, creates a {@link ChannelTypes}.GuildNewsThread.
|
|
2330
|
+
* Does not work on channels of type {@link ChannelTypes}.GuildForum.
|
|
2124
2331
|
*
|
|
2125
2332
|
* The ID of the created thread will be the same as the ID of the source message.
|
|
2126
2333
|
*
|
|
@@ -2145,11 +2352,34 @@ export interface RestManager {
|
|
|
2145
2352
|
* @see {@link https://discord.com/developers/docs/resources/channel#start-thread-without-message}
|
|
2146
2353
|
*/
|
|
2147
2354
|
startThreadWithoutMessage: (channelId: BigString, options: StartThreadWithoutMessage, reason?: string) => Promise<CamelizedDiscordChannel>;
|
|
2355
|
+
/**
|
|
2356
|
+
* Get a list of users that voted for this specific answer.
|
|
2357
|
+
*
|
|
2358
|
+
* @param channelId - The ID of the channel in which the message with the poll lives
|
|
2359
|
+
* @param messageId - The ID of the message in which the poll lives
|
|
2360
|
+
* @param answerId - The ID of the answer to get the users that voted that answer
|
|
2361
|
+
* @param options - The options for the request
|
|
2362
|
+
* @returns The list of users that voted for the specific answer.
|
|
2363
|
+
*/
|
|
2364
|
+
getPollAnswerVoters: (channelId: BigString, messageId: BigString, answerId: number, options?: GetPollAnswerVotes) => Promise<CamelizedDiscordGetAnswerVotesResponse>;
|
|
2365
|
+
/**
|
|
2366
|
+
* Immediately ends the poll.
|
|
2367
|
+
*
|
|
2368
|
+
* @param channelId - The ID of the channel in which the message with the poll lives
|
|
2369
|
+
* @param messageId - The ID of the message in which the poll lives
|
|
2370
|
+
* @returns The message with the expired poll
|
|
2371
|
+
*
|
|
2372
|
+
* @remarks
|
|
2373
|
+
* You cannot end polls from other users.
|
|
2374
|
+
*
|
|
2375
|
+
* Fires a _Message Update_ gateway event
|
|
2376
|
+
*/
|
|
2377
|
+
endPoll: (channelId: BigString, messageId: BigString) => Promise<CamelizedDiscordMessage>;
|
|
2148
2378
|
/**
|
|
2149
2379
|
* Synchronises a template with the current state of a guild.
|
|
2150
2380
|
*
|
|
2151
2381
|
* @param guildId - The ID of the guild to synchronise a template of.
|
|
2152
|
-
* @returns An instance of the edited {@link
|
|
2382
|
+
* @returns An instance of the edited {@link CamelizedDiscordTemplate}.
|
|
2153
2383
|
*
|
|
2154
2384
|
* @remarks
|
|
2155
2385
|
* Requires the `MANAGE_GUILD` permission.
|
|
@@ -2160,12 +2390,14 @@ export interface RestManager {
|
|
|
2160
2390
|
*/
|
|
2161
2391
|
syncGuildTemplate: (guildId: BigString) => Promise<CamelizedDiscordTemplate>;
|
|
2162
2392
|
/**
|
|
2163
|
-
* Triggers a typing indicator for the
|
|
2393
|
+
* Triggers a typing indicator for the specified channel, which expires after 10 seconds.
|
|
2164
2394
|
*
|
|
2165
2395
|
* @param channelId - The ID of the channel in which to trigger the typing indicator.
|
|
2166
2396
|
*
|
|
2167
2397
|
* @remarks
|
|
2168
|
-
* Generally
|
|
2398
|
+
* Generally bots should **not** use this route.
|
|
2399
|
+
* However, if a bot is responding to a command and expects the computation to take a few seconds,
|
|
2400
|
+
* this endpoint may be called to let the user know that the bot is processing their message.
|
|
2169
2401
|
*
|
|
2170
2402
|
* Fires a _Typing Start_ gateway event.
|
|
2171
2403
|
*
|
|
@@ -2176,38 +2408,46 @@ export interface RestManager {
|
|
|
2176
2408
|
* Re-registers the list of global application commands, overwriting the previous commands completely.
|
|
2177
2409
|
*
|
|
2178
2410
|
* @param commands - The list of commands to use to overwrite the previous list.
|
|
2179
|
-
* @
|
|
2411
|
+
* @param options - Additional options for the endpoint.
|
|
2412
|
+
* @returns A collection of {@link CamelizedDiscordApplicationCommand} objects assorted by command ID.
|
|
2180
2413
|
*
|
|
2181
2414
|
* @remarks
|
|
2182
2415
|
* ❗ Commands that are not present in the `commands` array will be __deleted__.
|
|
2183
2416
|
*
|
|
2184
2417
|
* ⚠️ Commands that do not already exist will count towards the daily limit of _200_ new commands.
|
|
2185
2418
|
*
|
|
2419
|
+
* When using the bearer token the token needs the `applications.commands.update` scope and must be a `Client grant` token.
|
|
2420
|
+
* You will be able to update only your own application commands
|
|
2421
|
+
*
|
|
2186
2422
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands}
|
|
2187
2423
|
*/
|
|
2188
|
-
upsertGlobalApplicationCommands: (commands: CreateApplicationCommand[]) => Promise<CamelizedDiscordApplicationCommand[]>;
|
|
2424
|
+
upsertGlobalApplicationCommands: (commands: CreateApplicationCommand[], options?: UpsertGlobalApplicationCommandOptions) => Promise<CamelizedDiscordApplicationCommand[]>;
|
|
2189
2425
|
/**
|
|
2190
2426
|
* Re-registers the list of application commands registered in a guild, overwriting the previous commands completely.
|
|
2191
2427
|
*
|
|
2192
2428
|
* @param guildId - The ID of the guild whose list of commands to overwrite.
|
|
2193
2429
|
* @param commands - The list of commands to use to overwrite the previous list.
|
|
2194
|
-
* @
|
|
2430
|
+
* @param options - Additional options for the endpoint.
|
|
2431
|
+
* @returns A collection of {@link CamelizedDiscordApplicationCommand} objects assorted by command ID.
|
|
2195
2432
|
*
|
|
2196
2433
|
* @remarks
|
|
2197
2434
|
* ❗ Commands that are not present in the `commands` array will be __deleted__.
|
|
2198
2435
|
*
|
|
2199
2436
|
* ⚠️ Commands that do not already exist will count towards the daily limit of _200_ new commands.
|
|
2200
2437
|
*
|
|
2438
|
+
* When using the bearer token the token needs the `applications.commands.update` scope and must be a `Client grant` token.
|
|
2439
|
+
* You will be able to update only your own application commands
|
|
2440
|
+
*
|
|
2201
2441
|
* @see {@link https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands}
|
|
2202
2442
|
*/
|
|
2203
|
-
upsertGuildApplicationCommands: (guildId: BigString, commands: CreateApplicationCommand[]) => Promise<CamelizedDiscordApplicationCommand[]>;
|
|
2443
|
+
upsertGuildApplicationCommands: (guildId: BigString, commands: CreateApplicationCommand[], options?: UpsertGuildApplicationCommandOptions) => Promise<CamelizedDiscordApplicationCommand[]>;
|
|
2204
2444
|
/**
|
|
2205
2445
|
* Bans a user from a guild.
|
|
2206
2446
|
*
|
|
2207
2447
|
* @param guildId - The ID of the guild to ban the user from.
|
|
2208
2448
|
* @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
2449
|
* @param options - The parameters for the creation of the ban.
|
|
2450
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2211
2451
|
*
|
|
2212
2452
|
* @remarks
|
|
2213
2453
|
* Requires the `BAN_MEMBERS` permission.
|
|
@@ -2217,6 +2457,23 @@ export interface RestManager {
|
|
|
2217
2457
|
* @see {@link https://discord.com/developers/docs/resources/guild#create-guild-ban}
|
|
2218
2458
|
*/
|
|
2219
2459
|
banMember: (guildId: BigString, userId: BigString, options?: CreateGuildBan, reason?: string) => Promise<void>;
|
|
2460
|
+
/**
|
|
2461
|
+
* Bans up to 200 users from a guild.
|
|
2462
|
+
*
|
|
2463
|
+
* @param guildId - The ID of the guild to ban the users from.
|
|
2464
|
+
* @param options - The users to ban and the other options for the ban.
|
|
2465
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2466
|
+
*
|
|
2467
|
+
* @remarks
|
|
2468
|
+
* Requires the `BAN_MEMBERS` and `MANAGE_GUILD` permissions.
|
|
2469
|
+
*
|
|
2470
|
+
* If all provided users fail to be banned, discord will respond with an error (code: `500000: Failed to ban users`)
|
|
2471
|
+
*
|
|
2472
|
+
* Fires as many _Guild Ban Add_ gateway events as many user where banned.
|
|
2473
|
+
*
|
|
2474
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#bulk-guild-ban}
|
|
2475
|
+
*/
|
|
2476
|
+
bulkBanMembers: (guildId: BigString, options: CreateGuildBulkBan, reason?: string) => Promise<Camelize<DiscordBulkBan>>;
|
|
2220
2477
|
/**
|
|
2221
2478
|
* Edits the nickname of the bot user.
|
|
2222
2479
|
*
|
|
@@ -2259,6 +2516,19 @@ export interface RestManager {
|
|
|
2259
2516
|
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-member}
|
|
2260
2517
|
*/
|
|
2261
2518
|
getMember: (guildId: BigString, userId: BigString) => Promise<CamelizedDiscordMemberWithUser>;
|
|
2519
|
+
/**
|
|
2520
|
+
* Gets the current member object.
|
|
2521
|
+
*
|
|
2522
|
+
* @param bearerToken - The access token of the user
|
|
2523
|
+
* @param guildId - The ID of the guild to get the member object for.
|
|
2524
|
+
* @returns An instance of {@link CamelizedDiscordMemberWithUser}.
|
|
2525
|
+
*
|
|
2526
|
+
* @remarks
|
|
2527
|
+
* The access tokens needs the `guilds.members.read` scope
|
|
2528
|
+
*
|
|
2529
|
+
* @see {@link https://discord.com/developers/docs/resources/user#get-current-user-guild-member}
|
|
2530
|
+
*/
|
|
2531
|
+
getCurrentMember: (guildId: BigString, bearerToken: string) => Promise<CamelizedDiscordMemberWithUser>;
|
|
2262
2532
|
/**
|
|
2263
2533
|
* Gets the list of members for a guild.
|
|
2264
2534
|
*
|
|
@@ -2323,7 +2593,7 @@ export interface RestManager {
|
|
|
2323
2593
|
* @returns A number indicating how many members were pruned.
|
|
2324
2594
|
*
|
|
2325
2595
|
* @remarks
|
|
2326
|
-
* Requires the `KICK_MEMBERS`
|
|
2596
|
+
* Requires the `MANAGE_GUILD` and `KICK_MEMBERS` permissions.
|
|
2327
2597
|
*
|
|
2328
2598
|
* ❗ 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
2599
|
*
|
|
@@ -2381,6 +2651,63 @@ export interface RestManager {
|
|
|
2381
2651
|
* @see {@link https://discord.com/developers/docs/resources/channel#unpin-message}
|
|
2382
2652
|
*/
|
|
2383
2653
|
unpinMessage: (channelId: BigString, messageId: BigString, reason?: string) => Promise<void>;
|
|
2654
|
+
/**
|
|
2655
|
+
* Get the guild onboarding
|
|
2656
|
+
*
|
|
2657
|
+
* @param guildId - The guild to get the onboarding from
|
|
2658
|
+
*/
|
|
2659
|
+
getGuildOnboarding: (guildId: BigString) => Promise<CamelizedDiscordGuildOnboarding>;
|
|
2660
|
+
/**
|
|
2661
|
+
* Modifies the onboarding configuration of the guild.
|
|
2662
|
+
*
|
|
2663
|
+
* @param guildId - The guild to get the onboarding from
|
|
2664
|
+
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
|
|
2665
|
+
*
|
|
2666
|
+
* @remarks
|
|
2667
|
+
* Requires the `MANAGE_GUILD` and `MANAGE_ROLES` permissions.
|
|
2668
|
+
*
|
|
2669
|
+
* Onboarding enforces constraints when enabled. These constraints are:
|
|
2670
|
+
* - at least 7 default channels
|
|
2671
|
+
* - at least 5 of the 7 channels must allow sending messages to the @everyone role
|
|
2672
|
+
*
|
|
2673
|
+
* The `mode` field modifies what is considered when enforcing these constraints.
|
|
2674
|
+
*/
|
|
2675
|
+
editGuildOnboarding: (guildId: BigString, options: EditGuildOnboarding, reason?: string) => Promise<CamelizedDiscordGuildOnboarding>;
|
|
2676
|
+
/**
|
|
2677
|
+
* Returns all entitlements for a given app, active and expired.
|
|
2678
|
+
*
|
|
2679
|
+
* @param applicationId - The id of the application to get the entitlements
|
|
2680
|
+
* @param {GetEntitlements} [options] - The optional query params for the endpoint
|
|
2681
|
+
*/
|
|
2682
|
+
listEntitlements: (applicationId: BigString, options?: GetEntitlements) => Promise<CamelizedDiscordEntitlement[]>;
|
|
2683
|
+
/**
|
|
2684
|
+
* 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.
|
|
2685
|
+
*
|
|
2686
|
+
* @param applicationId - The id of the application to create the entitlement
|
|
2687
|
+
* @param body - The options for new entitlement
|
|
2688
|
+
*
|
|
2689
|
+
* @remarks
|
|
2690
|
+
* This endpoint returns a partial entitlement object.
|
|
2691
|
+
* It will not contain subscription_id, starts_at, or ends_at, as it's valid in perpetuity.
|
|
2692
|
+
*/
|
|
2693
|
+
createTestEntitlement: (applicationId: BigString, body: CreateEntitlement) => Promise<Partial<CamelizedDiscordEntitlement>>;
|
|
2694
|
+
/**
|
|
2695
|
+
* Deletes a currently-active test entitlement. Discord will act as though that user or guild no longer has entitlement to your premium offering.
|
|
2696
|
+
*
|
|
2697
|
+
* @param applicationId - The id of the application from where delete the entitlement
|
|
2698
|
+
* @param entitlementId - The id of the entitlement to delete
|
|
2699
|
+
*/
|
|
2700
|
+
deleteTestEntitlement: (applicationId: BigString, entitlementId: BigString) => Promise<void>;
|
|
2701
|
+
/**
|
|
2702
|
+
* 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}
|
|
2703
|
+
*/
|
|
2704
|
+
consumeEntitlement: (applicationId: BigString, entitlementId: BigString) => Promise<void>;
|
|
2705
|
+
/**
|
|
2706
|
+
* Returns all SKUs for a given application
|
|
2707
|
+
*
|
|
2708
|
+
* @param applicationId - The id of the application to get the SKUs
|
|
2709
|
+
*/
|
|
2710
|
+
listSkus: (applicationId: BigString) => Promise<CamelizedDiscordSku[]>;
|
|
2384
2711
|
}
|
|
2385
2712
|
export type RequestMethods = 'GET' | 'POST' | 'DELETE' | 'PATCH' | 'PUT';
|
|
2386
2713
|
export type ApiVersions = 9 | 10;
|