@discordeno/rest 21.0.0 → 21.0.1-next.01dd69b

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.
@@ -1,4 +1,4 @@
1
- import type { AddDmRecipientOptions, AddGuildMemberOptions, AtLeastOne, BeginGuildPrune, BigString, Camelize, CreateApplicationCommand, CreateApplicationEmoji, CreateAutoModerationRuleOptions, CreateChannelInvite, CreateEntitlement, CreateForumPostWithMessage, CreateGlobalApplicationCommandOptions, CreateGuild, CreateGuildApplicationCommandOptions, CreateGuildBan, CreateGuildBulkBan, CreateGuildChannel, CreateGuildEmoji, CreateGuildFromTemplate, CreateGuildRole, CreateGuildSoundboardSound, CreateGuildStickerOptions, CreateMessageOptions, CreateScheduledEvent, CreateStageInstance, CreateTemplate, CreateWebhook, DeleteWebhookMessageOptions, DiscordAccessTokenResponse, DiscordActiveThreads, DiscordActivityInstance, DiscordApplication, DiscordApplicationCommand, DiscordApplicationCommandPermissions, DiscordApplicationRoleConnection, DiscordArchivedThreads, DiscordAuditLog, DiscordAutoModerationRule, DiscordBan, DiscordBulkBan, DiscordChannel, DiscordConnection, DiscordCurrentAuthorization, DiscordEmoji, DiscordEntitlement, DiscordFollowedChannel, DiscordGetAnswerVotesResponse, DiscordGetGatewayBot, DiscordGuild, DiscordGuildApplicationCommandPermissions, DiscordGuildOnboarding, DiscordGuildPreview, DiscordGuildWidget, DiscordGuildWidgetSettings, DiscordIntegration, DiscordInteractionCallbackResponse, DiscordInvite, DiscordInviteMetadata, DiscordMember, DiscordMemberWithUser, DiscordMessage, DiscordModifyGuildWelcomeScreen, DiscordPrunedCount, DiscordRole, DiscordScheduledEvent, DiscordSku, DiscordSoundboardSound, DiscordStageInstance, DiscordSticker, DiscordStickerPack, DiscordSubscription, DiscordTemplate, DiscordThreadMember, DiscordTokenExchange, DiscordTokenRevocation, DiscordUser, DiscordVanityUrl, DiscordVoiceRegion, DiscordVoiceState, DiscordWebhook, DiscordWelcomeScreen, EditApplication, EditAutoModerationRuleOptions, EditBotMemberOptions, EditChannelPermissionOverridesOptions, EditGuildOnboarding, EditGuildRole, EditGuildStickerOptions, EditMessage, EditOwnVoiceState, EditScheduledEvent, EditUserVoiceState, ExecuteWebhook, FileContent, GetApplicationCommandPermissionOptions, GetBans, GetEntitlements, GetGroupDmOptions, GetGuildAuditLog, GetGuildPruneCountQuery, GetInvite, GetMessagesOptions, GetPollAnswerVotes, GetReactions, GetScheduledEventUsers, GetScheduledEvents, GetUserGuilds, GetWebhookMessageOptions, InteractionCallbackData, InteractionCallbackOptions, InteractionResponse, ListArchivedThreads, ListGuildMembers, ListSkuSubscriptionsOptions, MfaLevels, ModifyApplicationEmoji, ModifyChannel, ModifyGuild, ModifyGuildChannelPositions, ModifyGuildEmoji, ModifyGuildMember, ModifyGuildSoundboardSound, ModifyGuildTemplate, ModifyRolePositions, ModifyWebhook, SearchMembers, SendSoundboardSound, StartThreadWithMessage, StartThreadWithoutMessage, UpsertGlobalApplicationCommandOptions, UpsertGuildApplicationCommandOptions } from '@discordeno/types';
1
+ import type { AddDmRecipientOptions, AddGuildMemberOptions, AddLobbyMember, AtLeastOne, BeginGuildPrune, BigString, Camelize, CreateApplicationCommand, CreateApplicationEmoji, CreateAutoModerationRuleOptions, CreateChannelInvite, CreateForumPostWithMessage, CreateGlobalApplicationCommandOptions, CreateGuildApplicationCommandOptions, CreateGuildBan, CreateGuildBulkBan, CreateGuildChannel, CreateGuildEmoji, CreateGuildRole, CreateGuildSoundboardSound, CreateGuildStickerOptions, CreateLobby, CreateMessageOptions, CreateScheduledEvent, CreateStageInstance, CreateTemplate, CreateTestEntitlement, CreateWebhook, DeleteWebhookMessageOptions, DiscordAccessTokenResponse, DiscordActivityInstance, DiscordApplication, DiscordApplicationCommand, DiscordApplicationCommandPermissions, DiscordApplicationRoleConnection, DiscordApplicationRoleConnectionMetadata, DiscordAuditLog, DiscordAutoModerationRule, DiscordBan, DiscordBulkBan, DiscordChannel, DiscordConnection, DiscordCurrentAuthorization, DiscordEmoji, DiscordEntitlement, DiscordFollowedChannel, DiscordGetAnswerVotesResponse, DiscordGetChannelPins, DiscordGetGatewayBot, DiscordGuild, DiscordGuildApplicationCommandPermissions, DiscordGuildOnboarding, DiscordGuildPreview, DiscordGuildWidget, DiscordGuildWidgetSettings, DiscordIncidentsData, DiscordIntegration, DiscordInteractionCallbackResponse, DiscordInvite, DiscordInviteMetadata, DiscordListActiveThreads, DiscordListArchivedThreads, DiscordLobby, DiscordLobbyMember, DiscordMember, DiscordMemberWithUser, DiscordMessage, DiscordPrunedCount, DiscordRole, DiscordScheduledEvent, DiscordSku, DiscordSoundboardSound, DiscordStageInstance, DiscordSticker, DiscordStickerPack, DiscordSubscription, DiscordTemplate, DiscordThreadMember, DiscordTokenExchange, DiscordTokenRevocation, DiscordUser, DiscordVanityUrl, DiscordVoiceRegion, DiscordVoiceState, DiscordWebhook, DiscordWelcomeScreen, EditApplication, EditAutoModerationRuleOptions, EditBotMemberOptions, EditChannelPermissionOverridesOptions, EditGuildOnboarding, EditGuildRole, EditGuildStickerOptions, EditMessage, EditOwnVoiceState, EditScheduledEvent, EditUserVoiceState, EditWebhookMessageOptions, ExecuteWebhook, FileContent, GetApplicationCommandPermissionOptions, GetBans, GetChannelPinsOptions, GetEntitlements, GetGlobalApplicationCommandsOptions, GetGroupDmOptions, GetGuildApplicationCommandsOptions, GetGuildAuditLog, GetGuildPruneCountQuery, GetInvite, GetMessagesOptions, GetPollAnswerVotes, GetReactions, GetScheduledEvents, GetScheduledEventUsers, GetThreadMember, GetUserGuilds, GetWebhookMessageOptions, InteractionCallbackData, InteractionCallbackOptions, InteractionResponse, LinkChannelToLobby, ListArchivedThreads, ListGuildMembers, ListSkuSubscriptionsOptions, ListThreadMembers, ModifyApplicationEmoji, ModifyChannel, ModifyGuild, ModifyGuildChannelPositions, ModifyGuildEmoji, ModifyGuildIncidentActions, ModifyGuildMember, ModifyGuildSoundboardSound, ModifyGuildTemplate, ModifyGuildWelcomeScreen, ModifyLobby, ModifyRolePositions, ModifyWebhook, SearchMembers, SendSoundboardSound, StartThreadWithMessage, StartThreadWithoutMessage, UpsertGlobalApplicationCommandOptions, UpsertGuildApplicationCommandOptions } from '@discordeno/types';
2
2
  import type { logger } from '@discordeno/utils';
3
3
  import type { InvalidRequestBucket } from './invalidBucket.js';
4
4
  import type { Queue } from './queue.js';
@@ -51,6 +51,8 @@ export interface CreateRestManagerOptions {
51
51
  * @default logger // The logger exported by `@discordeno/utils`
52
52
  */
53
53
  logger?: Pick<typeof logger, 'debug' | 'info' | 'warn' | 'error' | 'fatal'>;
54
+ /** Events for the rest manager */
55
+ events?: Partial<RestManagerEvents>;
54
56
  }
55
57
  export interface RestManager {
56
58
  /** The bot token which will be used to make requests. */
@@ -95,6 +97,8 @@ export interface RestManager {
95
97
  routes: RestRoutes;
96
98
  /** The logger to use for the rest manager */
97
99
  logger: Pick<typeof logger, 'debug' | 'info' | 'warn' | 'error' | 'fatal'>;
100
+ /** Events for the rest manager */
101
+ events: RestManagerEvents;
98
102
  /** Allows the user to inject custom headers that will be sent with every request. */
99
103
  createBaseHeaders: () => Record<string, string>;
100
104
  /** Whether or not the rest manager should keep objects in raw snake case from discord. */
@@ -324,20 +328,6 @@ export interface RestManager {
324
328
  * @see {@link https://discord.com/developers/docs/interactions/application-commands#create-global-application-command}
325
329
  */
326
330
  createGlobalApplicationCommand: (command: CreateApplicationCommand, options?: CreateGlobalApplicationCommandOptions) => Promise<Camelize<DiscordApplicationCommand>>;
327
- /**
328
- * Creates a guild.
329
- *
330
- * @param options - The parameters for the creation of the guild.
331
- * @returns An instance of the created {@link DiscordGuild}.
332
- *
333
- * @remarks
334
- * ⚠️ This route can only be used by bots in __fewer than 10 guilds__.
335
- *
336
- * Fires a _Guild Create_ gateway event.
337
- *
338
- * @see {@link https://discord.com/developers/docs/resources/guild#create-guild}
339
- */
340
- createGuild: (options: CreateGuild) => Promise<Camelize<DiscordGuild>>;
341
331
  /**
342
332
  * Creates an application command only accessible in a specific guild.
343
333
  *
@@ -356,21 +346,6 @@ export interface RestManager {
356
346
  * @see {@link https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command}
357
347
  */
358
348
  createGuildApplicationCommand: (command: CreateApplicationCommand, guildId: BigString, options?: CreateGuildApplicationCommandOptions) => Promise<Camelize<DiscordApplicationCommand>>;
359
- /**
360
- * Creates a guild from a template.
361
- *
362
- * @param templateCode - The code of the template.
363
- * @param options - The parameters for the creation of the guild.
364
- * @returns An instance of the created {@link DiscordGuild}.
365
- *
366
- * @remarks
367
- * ⚠️ This route can only be used by bots in __fewer than 10 guilds__.
368
- *
369
- * Fires a _Guild Create_ gateway event.
370
- *
371
- * @see {@link https://discord.com/developers/docs/resources/guild-template#create-guild-from-guild-template}
372
- */
373
- createGuildFromTemplate: (templateCode: string, options: CreateGuildFromTemplate) => Promise<Camelize<DiscordGuild>>;
374
349
  /**
375
350
  * Create a new sticker for the guild.
376
351
  *
@@ -590,19 +565,6 @@ export interface RestManager {
590
565
  * @see {@link https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command}
591
566
  */
592
567
  deleteGlobalApplicationCommand: (commandId: BigString) => Promise<void>;
593
- /**
594
- * Deletes a guild.
595
- *
596
- * @param guildId - The ID of the guild to delete.
597
- *
598
- * @remarks
599
- * The bot user must be the owner of the guild.
600
- *
601
- * Fires a _Guild Delete_ gateway event.
602
- *
603
- * @see {@link https://discord.com/developers/docs/resources/guild#delete-guild}
604
- */
605
- deleteGuild: (guildId: BigString) => Promise<void>;
606
568
  /**
607
569
  * Deletes an application command registered in a guild.
608
570
  *
@@ -1058,10 +1020,6 @@ export interface RestManager {
1058
1020
  * @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command}
1059
1021
  */
1060
1022
  editGuildApplicationCommand: (commandId: BigString, guildId: BigString, options: CreateApplicationCommand) => Promise<Camelize<DiscordApplicationCommand>>;
1061
- /** Modify a guild's MFA level. Requires guild ownership.
1062
- * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
1063
- */
1064
- editGuildMfaLevel: (guildId: BigString, mfaLevel: MfaLevels, reason?: string) => Promise<void>;
1065
1023
  /**
1066
1024
  * Edit the given sticker.
1067
1025
  *
@@ -1128,22 +1086,6 @@ export interface RestManager {
1128
1086
  * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response}
1129
1087
  */
1130
1088
  editOriginalInteractionResponse: (token: string, options: InteractionCallbackData) => Promise<Camelize<DiscordMessage>>;
1131
- /**
1132
- * Edits the original webhook message.
1133
- *
1134
- * @param webhookId - The ID of the webhook to edit the original message of.
1135
- * @param token - The webhook token, used to edit the message.
1136
- * @param options - The parameters for the edit of the message.
1137
- * @returns An instance of the edited {@link DiscordMessage}.
1138
- *
1139
- * @remarks
1140
- * Fires a _Message Update_ gateway event.
1141
- *
1142
- * @see {@link https://discord.com/developers/docs/resources/webhook#edit-webhook-message}
1143
- */
1144
- editOriginalWebhookMessage: (webhookId: BigString, token: string, options: InteractionCallbackData & {
1145
- threadId?: BigString;
1146
- }) => Promise<Camelize<DiscordMessage>>;
1147
1089
  /**
1148
1090
  * Edits the voice state of the bot user.
1149
1091
  *
@@ -1288,9 +1230,7 @@ export interface RestManager {
1288
1230
  *
1289
1231
  * @see {@link https://discord.com/developers/docs/resources/webhook#edit-webhook-message}
1290
1232
  */
1291
- editWebhookMessage: (webhookId: BigString, token: string, messageId: BigString, options: InteractionCallbackData & {
1292
- threadId?: BigString;
1293
- }) => Promise<Camelize<DiscordMessage>>;
1233
+ editWebhookMessage: (webhookId: BigString, token: string, messageId: BigString, options: EditWebhookMessageOptions) => Promise<Camelize<DiscordMessage>>;
1294
1234
  /**
1295
1235
  * Edits a webhook using the webhook token, thereby bypassing the need for authentication + permissions.
1296
1236
  *
@@ -1321,7 +1261,7 @@ export interface RestManager {
1321
1261
  *
1322
1262
  * @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen}
1323
1263
  */
1324
- editWelcomeScreen: (guildId: BigString, options: Camelize<DiscordModifyGuildWelcomeScreen>, reason?: string) => Promise<Camelize<DiscordWelcomeScreen>>;
1264
+ editWelcomeScreen: (guildId: BigString, options: ModifyGuildWelcomeScreen, reason?: string) => Promise<Camelize<DiscordWelcomeScreen>>;
1325
1265
  /**
1326
1266
  * Edits the settings of a guild's widget.
1327
1267
  *
@@ -1371,7 +1311,7 @@ export interface RestManager {
1371
1311
  * Gets the list of all active threads for a guild.
1372
1312
  *
1373
1313
  * @param guildId - The ID of the guild to get the threads of.
1374
- * @returns An instance of {@link DiscordActiveThreads}.
1314
+ * @returns An instance of {@link DiscordListActiveThreads}.
1375
1315
  *
1376
1316
  * @remarks
1377
1317
  * Returns both public and private threads.
@@ -1380,7 +1320,7 @@ export interface RestManager {
1380
1320
  *
1381
1321
  * @see {@link https://discord.com/developers/docs/resources/guild#list-active-guild-threads}
1382
1322
  */
1383
- getActiveThreads: (guildId: BigString) => Promise<Camelize<DiscordActiveThreads>>;
1323
+ getActiveThreads: (guildId: BigString) => Promise<Camelize<DiscordListActiveThreads>>;
1384
1324
  /** Get the applications info */
1385
1325
  getApplicationInfo: () => Promise<Camelize<DiscordApplication>>;
1386
1326
  /**
@@ -1673,11 +1613,12 @@ export interface RestManager {
1673
1613
  /**
1674
1614
  * Gets the list of your bot's global application commands.
1675
1615
  *
1616
+ * @param options - The parameters for the fetching of global application commands
1676
1617
  * @returns A collection of {@link DiscordApplicationCommand} objects assorted by command ID.
1677
1618
  *
1678
1619
  * @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands}
1679
1620
  */
1680
- getGlobalApplicationCommands: () => Promise<Camelize<DiscordApplicationCommand>[]>;
1621
+ getGlobalApplicationCommands: (options?: GetGlobalApplicationCommandsOptions) => Promise<Camelize<DiscordApplicationCommand>[]>;
1681
1622
  /**
1682
1623
  * Gets a guild by its ID.
1683
1624
  *
@@ -1717,11 +1658,12 @@ export interface RestManager {
1717
1658
  * Gets the list of application commands registered by your bot in a guild.
1718
1659
  *
1719
1660
  * @param guildId - The ID of the guild the commands are registered in.
1661
+ * @param options - The parameters for the fetching of guild application commands
1720
1662
  * @returns A collection of {@link DiscordApplicationCommand} objects assorted by command ID.
1721
1663
  *
1722
1664
  * @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-commandss}
1723
1665
  */
1724
- getGuildApplicationCommands: (guildId: BigString) => Promise<Camelize<DiscordApplicationCommand>[]>;
1666
+ getGuildApplicationCommands: (guildId: BigString, options?: GetGuildApplicationCommandsOptions) => Promise<Camelize<DiscordApplicationCommand>[]>;
1725
1667
  /**
1726
1668
  * Gets the preview of a guild by a guild's ID.
1727
1669
  *
@@ -1848,7 +1790,7 @@ export interface RestManager {
1848
1790
  *
1849
1791
  * @param channelId - The ID of the channel from which to get the messages.
1850
1792
  * @param options - The parameters for the fetching of the messages.
1851
- * @returns A collection of {@link DiscordMessage} objects assorted by message ID.
1793
+ * @returns Returns an array of {@link DiscordMessage} objects from newest to oldest on success.
1852
1794
  *
1853
1795
  * @remarks
1854
1796
  * Requires that the bot user be able to see the contents of the channel in which the messages were posted.
@@ -1891,6 +1833,21 @@ export interface RestManager {
1891
1833
  * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response}
1892
1834
  */
1893
1835
  getOriginalInteractionResponse: (token: string) => Promise<Camelize<DiscordMessage>>;
1836
+ /**
1837
+ * Retrieves the list of pins in a channel.
1838
+ *
1839
+ * @param channelId - The ID of the channel to get the pins for.
1840
+ * @param options - The options for the fetching of the pins.
1841
+ * @returns A {@link DiscordGetChannelPins} objects
1842
+ *
1843
+ * @remarks
1844
+ * Requires the `VIEW_CHANNEL` permission.
1845
+ *
1846
+ * If the user is missing the `READ_MESSAGE_HISTORY` permission in the channel, then no pins will be returned.
1847
+ *
1848
+ * @see {@link https://discord.com/developers/docs/resources/message#get-channel-pins}
1849
+ */
1850
+ getChannelPins: (channelId: BigString, options?: GetChannelPinsOptions) => Promise<Camelize<DiscordGetChannelPins>>;
1894
1851
  /**
1895
1852
  * Gets the pinned messages for a channel.
1896
1853
  *
@@ -1903,7 +1860,8 @@ export interface RestManager {
1903
1860
  * If getting a message from a guild channel:
1904
1861
  * - Requires the `READ_MESSAGE_HISTORY` permission.
1905
1862
  *
1906
- * @see {@link https://discord.com/developers/docs/resources/channel#get-pinned-messages}
1863
+ * @see {@link https://discord.com/developers/docs/resources/message#get-pinned-messages-deprecated}
1864
+ * @deprecated Use {@link getChannelPins} instead.
1907
1865
  */
1908
1866
  getPinnedMessages: (channelId: BigString) => Promise<Camelize<DiscordMessage>[]>;
1909
1867
  /**
@@ -1911,7 +1869,7 @@ export interface RestManager {
1911
1869
  *
1912
1870
  * @param channelId - The ID of the channel to get the archived threads for.
1913
1871
  * @param options - The parameters for the fetching of threads.
1914
- * @returns An instance of {@link DiscordArchivedThreads}.
1872
+ * @returns An instance of {@link DiscordListArchivedThreads}.
1915
1873
  *
1916
1874
  * @remarks
1917
1875
  * Requires the `READ_MESSAGE_HISTORY` permission.
@@ -1923,7 +1881,7 @@ export interface RestManager {
1923
1881
  *
1924
1882
  * @see {@link https://discord.com/developers/docs/resources/channel#list-private-archived-threads}
1925
1883
  */
1926
- getPrivateArchivedThreads: (channelId: BigString, options?: ListArchivedThreads) => Promise<Camelize<DiscordArchivedThreads>>;
1884
+ getPrivateArchivedThreads: (channelId: BigString, options?: ListArchivedThreads) => Promise<Camelize<DiscordListArchivedThreads>>;
1927
1885
  /**
1928
1886
  * Gets the list of private archived threads the bot is a member of for a channel.
1929
1887
  *
@@ -1940,7 +1898,7 @@ export interface RestManager {
1940
1898
  *
1941
1899
  * @see {@link https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads}
1942
1900
  */
1943
- getPrivateJoinedArchivedThreads: (channelId: BigString, options?: ListArchivedThreads) => Promise<Camelize<DiscordArchivedThreads>>;
1901
+ getPrivateJoinedArchivedThreads: (channelId: BigString, options?: ListArchivedThreads) => Promise<Camelize<DiscordListArchivedThreads>>;
1944
1902
  /**
1945
1903
  * Gets the number of members that would be kicked from a guild during pruning.
1946
1904
  *
@@ -1971,7 +1929,7 @@ export interface RestManager {
1971
1929
  *
1972
1930
  * @see {@link https://discord.com/developers/docs/resources/channel#list-public-archived-threads}
1973
1931
  */
1974
- getPublicArchivedThreads: (channelId: BigString, options?: ListArchivedThreads) => Promise<Camelize<DiscordArchivedThreads>>;
1932
+ getPublicArchivedThreads: (channelId: BigString, options?: ListArchivedThreads) => Promise<Camelize<DiscordListArchivedThreads>>;
1975
1933
  /**
1976
1934
  * Gets the list of roles for a guild.
1977
1935
  *
@@ -2080,15 +2038,17 @@ export interface RestManager {
2080
2038
  *
2081
2039
  * @param channelId - The ID of the thread to get the thread member of.
2082
2040
  * @param userId - The user ID of the thread member to get.
2041
+ * @param options - The parameters for the fetching of the thread member.
2083
2042
  * @returns An instance of {@link DiscordThreadMember}.
2084
2043
  *
2085
2044
  * @see {@link https://discord.com/developers/docs/resources/channel#get-thread-member}
2086
2045
  */
2087
- getThreadMember: (channelId: BigString, userId: BigString) => Promise<Camelize<DiscordThreadMember>>;
2046
+ getThreadMember: (channelId: BigString, userId: BigString, options?: GetThreadMember) => Promise<Camelize<DiscordThreadMember>>;
2088
2047
  /**
2089
2048
  * Gets the list of thread members for a thread.
2090
2049
  *
2091
2050
  * @param channelId - The ID of the thread to get the thread members of.
2051
+ * @param options - The parameters for the fetching of the thread members.
2092
2052
  * @returns A collection of {@link DiscordThreadMember} assorted by user ID.
2093
2053
  *
2094
2054
  * @remarks
@@ -2096,7 +2056,7 @@ export interface RestManager {
2096
2056
  *
2097
2057
  * @see {@link https://discord.com/developers/docs/resources/channel#list-thread-members}
2098
2058
  */
2099
- getThreadMembers: (channelId: BigString) => Promise<Camelize<DiscordThreadMember>[]>;
2059
+ getThreadMembers: (channelId: BigString, options?: ListThreadMembers) => Promise<Camelize<DiscordThreadMember>[]>;
2100
2060
  /**
2101
2061
  * Gets the list of users that reacted with an emoji to a message.
2102
2062
  *
@@ -2680,15 +2640,11 @@ export interface RestManager {
2680
2640
  * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
2681
2641
  *
2682
2642
  * @remarks
2683
- * Requires that the bot user be able to see the contents of the channel in which the messages were posted.
2684
- *
2685
2643
  * Requires the `MANAGE_MESSAGES` permission.
2686
2644
  *
2687
- * ⚠️ There can only be at max 50 messages pinned in a channel.
2688
- *
2689
2645
  * Fires a _Channel Pins Update_ event.
2690
2646
  *
2691
- * @see {@link https://discord.com/developers/docs/resources/channel#pin-message}
2647
+ * @see {@link https://discord.com/developers/docs/resources/message#pin-message}
2692
2648
  */
2693
2649
  pinMessage: (channelId: BigString, messageId: BigString, reason?: string) => Promise<void>;
2694
2650
  /**
@@ -2743,20 +2699,18 @@ export interface RestManager {
2743
2699
  */
2744
2700
  unbanMember: (guildId: BigString, userId: BigString, reason?: string) => Promise<void>;
2745
2701
  /**
2746
- * Unpins a pinned message in a channel.
2702
+ * Unpin a message in a channel.
2747
2703
  *
2748
2704
  * @param channelId - The ID of the channel where the message is pinned.
2749
2705
  * @param messageId - The ID of the message to unpin.
2750
2706
  * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
2751
2707
  *
2752
2708
  * @remarks
2753
- * Requires that the bot user be able to see the contents of the channel in which the messages were posted.
2754
- *
2755
2709
  * Requires the `MANAGE_MESSAGES` permission.
2756
2710
  *
2757
2711
  * Fires a _Channel Pins Update_ event.
2758
2712
  *
2759
- * @see {@link https://discord.com/developers/docs/resources/channel#unpin-message}
2713
+ * @see {@link https://discord.com/developers/docs/resources/message#unpin-message}
2760
2714
  */
2761
2715
  unpinMessage: (channelId: BigString, messageId: BigString, reason?: string) => Promise<void>;
2762
2716
  /**
@@ -2768,7 +2722,7 @@ export interface RestManager {
2768
2722
  /**
2769
2723
  * Modifies the onboarding configuration of the guild.
2770
2724
  *
2771
- * @param guildId - The guild to get the onboarding from
2725
+ * @param guildId - The guild to edit the onboarding from
2772
2726
  * @param {string} [reason] - An optional reason for the action, to be included in the audit log.
2773
2727
  *
2774
2728
  * @remarks
@@ -2781,6 +2735,16 @@ export interface RestManager {
2781
2735
  * The `mode` field modifies what is considered when enforcing these constraints.
2782
2736
  */
2783
2737
  editGuildOnboarding: (guildId: BigString, options: EditGuildOnboarding, reason?: string) => Promise<Camelize<DiscordGuildOnboarding>>;
2738
+ /**
2739
+ * Modifies the incident actions of the guild.
2740
+ *
2741
+ * @param guildId - The guild to edit the incident actions from
2742
+ * @param options - The options for the incident actions
2743
+ *
2744
+ * @remarks
2745
+ * Requires the `MANAGE_GUILD` permission.
2746
+ */
2747
+ modifyGuildIncidentActions: (guildId: BigString, options: ModifyGuildIncidentActions) => Promise<Camelize<DiscordIncidentsData>>;
2784
2748
  /**
2785
2749
  * Returns all entitlements for a given app, active and expired.
2786
2750
  *
@@ -2805,7 +2769,7 @@ export interface RestManager {
2805
2769
  * This endpoint returns a partial entitlement object.
2806
2770
  * It will not contain subscription_id, starts_at, or ends_at, as it's valid in perpetuity.
2807
2771
  */
2808
- createTestEntitlement: (applicationId: BigString, body: CreateEntitlement) => Promise<Partial<Camelize<DiscordEntitlement>>>;
2772
+ createTestEntitlement: (applicationId: BigString, body: CreateTestEntitlement) => Promise<Partial<Camelize<DiscordEntitlement>>>;
2809
2773
  /**
2810
2774
  * Deletes a currently-active test entitlement. Discord will act as though that user or guild no longer has entitlement to your premium offering.
2811
2775
  *
@@ -2915,6 +2879,106 @@ export interface RestManager {
2915
2879
  * For other sounds, requires the `MANAGE_GUILD_EXPRESSIONS` permission.
2916
2880
  */
2917
2881
  deleteGuildSoundboardSound: (guildId: BigString, soundId: BigString, reason?: string) => Promise<void>;
2882
+ /**
2883
+ * Returns a list of application role connection metadata objects for the given application.
2884
+ *
2885
+ * @param applicationId - The application to get the role connections from
2886
+ * @returns A list of application role connection metadata objects
2887
+ */
2888
+ listApplicationRoleConnectionsMetadataRecords: (applicationId: BigString) => Promise<Camelize<DiscordApplicationRoleConnectionMetadata>[]>;
2889
+ /**
2890
+ * Updates and returns a list of application role connection metadata objects for the given application.
2891
+ *
2892
+ * @param applicationId - The application to get the role connections from
2893
+ * @param options - The options to update the role connections
2894
+ * @returns A list of application role connection metadata objects
2895
+ *
2896
+ * @remarks
2897
+ * An application can have a maximum of 5 metadata records.
2898
+ */
2899
+ updateApplicationRoleConnectionsMetadataRecords: (applicationId: BigString, options: Camelize<DiscordApplicationRoleConnectionMetadata>[]) => Promise<Camelize<DiscordApplicationRoleConnectionMetadata>[]>;
2900
+ /**
2901
+ * Creates a new lobby, adding any of the specified members to it, if provided.
2902
+ *
2903
+ * @param options - The options to create the lobby
2904
+ * @returns The created lobby
2905
+ */
2906
+ createLobby: (options: CreateLobby) => Promise<Camelize<DiscordLobby>>;
2907
+ /**
2908
+ * Returns a lobby object for the specified lobby id, if it exists.
2909
+ *
2910
+ * @param lobbyId - The ID of the lobby to get
2911
+ * @returns The lobby object
2912
+ */
2913
+ getLobby: (lobbyId: BigString) => Promise<Camelize<DiscordLobby>>;
2914
+ /**
2915
+ * Modifies the specified lobby with new values, if provided.
2916
+ *
2917
+ * @param lobbyId - The ID of the lobby to modify
2918
+ * @param options - The options to modify the lobby
2919
+ * @returns The modified lobby
2920
+ */
2921
+ modifyLobby: (lobbyId: BigString, options: ModifyLobby) => Promise<Camelize<DiscordLobby>>;
2922
+ /**
2923
+ * Deletes the specified lobby if it exists.
2924
+ *
2925
+ * It is safe to call even if the lobby is already deleted as well.
2926
+ *
2927
+ * @param lobbyId - The ID of the lobby to delete
2928
+ * @returns Nothing
2929
+ */
2930
+ deleteLobby: (lobbyId: BigString) => Promise<void>;
2931
+ /**
2932
+ * Adds the provided user to the specified lobby. If called when the user is already a member of the lobby will update fields such as metadata on that user instead.
2933
+ *
2934
+ * @param lobbyId - The ID of the lobby to add the user to
2935
+ * @param userId - The ID of the user to add to the lobby
2936
+ * @param options - The options to add the user to the lobby
2937
+ * @returns The lobby member object
2938
+ */
2939
+ addMemberToLobby: (lobbyId: BigString, userId: BigString, options: AddLobbyMember) => Promise<Camelize<DiscordLobbyMember>>;
2940
+ /**
2941
+ * Removes the provided user from the specified lobby. It is safe to call this even if the user is no longer a member of the lobby, but will fail if the lobby does not exist.
2942
+ *
2943
+ * @param lobbyId - The ID of the lobby to remove the user from
2944
+ * @param userId - The ID of the user to remove from the lobby
2945
+ * @returns Nothing
2946
+ */
2947
+ removeMemberFromLobby: (lobbyId: BigString, userId: BigString) => Promise<void>;
2948
+ /**
2949
+ * Removes the current user from the specified lobby. It is safe to call this even if the user is no longer a member of the lobby, but will fail if the lobby does not exist.
2950
+ *
2951
+ * @param lobbyId - The ID of the lobby to remove the user from
2952
+ * @param bearerToken - The access token of the user
2953
+ * @returns Nothing
2954
+ *
2955
+ * @remarks
2956
+ * This requires a bearer token for authorization
2957
+ */
2958
+ leaveLobby: (lobbyId: BigString, bearerToken: string) => Promise<void>;
2959
+ /**
2960
+ * Links an existing text channel to a lobby.
2961
+ *
2962
+ * @param lobbyId - The ID of the lobby to link the channel to
2963
+ * @param bearerToken - The access token of the user
2964
+ * @param options - The options to link the channel to the lobby
2965
+ * @returns The updated lobby object
2966
+ *
2967
+ * @remarks
2968
+ * Uses bearer token for authorization and the user must be a lobby member with the CanLinkLobby lobby member flag.
2969
+ */
2970
+ linkChannelToLobby: (lobbyId: BigString, bearerToken: string, options: LinkChannelToLobby) => Promise<Camelize<DiscordLobby>>;
2971
+ /**
2972
+ * Unlinks any currently linked channels from the specified lobby.
2973
+ *
2974
+ * @param lobbyId - The ID of the lobby to unlink the channel from
2975
+ * @param bearerToken - The access token of the user
2976
+ * @returns The updated lobby object
2977
+ *
2978
+ * @remarks
2979
+ * Uses bearer token for authorization and the user must be a lobby member with the CanLinkLobby lobby member flag.
2980
+ */
2981
+ unlinkChannelToLobby: (lobbyId: BigString, bearerToken: string) => Promise<Camelize<DiscordLobby>>;
2918
2982
  }
2919
2983
  export type RequestMethods = 'GET' | 'POST' | 'DELETE' | 'PATCH' | 'PUT';
2920
2984
  export type ApiVersions = 9 | 10;
@@ -2962,12 +3026,48 @@ export interface RestRateLimitedPath {
2962
3026
  export interface RestRequestResponse {
2963
3027
  ok: boolean;
2964
3028
  status: number;
2965
- body?: string;
3029
+ /** The returned body parsed if it was JSON, otherwise it will be the raw body as a string */
3030
+ body?: string | object;
2966
3031
  }
2967
3032
  export interface RestRequestRejection {
2968
3033
  ok: boolean;
2969
3034
  status: number;
2970
- body?: string;
3035
+ /** The HTTP 1.1 status code text */
3036
+ statusText?: string;
3037
+ /** The returned body parsed if it was JSON, otherwise it will be the raw body as a string */
3038
+ body?: string | object;
2971
3039
  error?: string;
2972
3040
  }
3041
+ export interface RestManagerEvents {
3042
+ /**
3043
+ * Emitted when a request is made to the API.
3044
+ *
3045
+ * @remarks
3046
+ * The body that will be sent to the API is available in the `extra` parameter. Do not consume the body in the `Request` object and use the one in the `extra` parameter instead.
3047
+ */
3048
+ request: (request: Request, extra: {
3049
+ body: any;
3050
+ }) => void;
3051
+ /**
3052
+ * Emitted when a response is received from the API.
3053
+ *
3054
+ * @remarks
3055
+ * This is fired for both successful and failed requests, you should check the Response object to determine if the request was successful or not.
3056
+ *
3057
+ * Both the request and the response body are available in the `extra` parameter. Do not consume the body in the `Request` or `Response` object and use the one in the `extra` parameter instead.
3058
+ */
3059
+ response: (request: Request, response: Response, extra: {
3060
+ requestBody: any;
3061
+ responseBody: string | object;
3062
+ }) => void;
3063
+ /**
3064
+ * Emitted when a request errors due to fetch error.
3065
+ *
3066
+ * @remarks
3067
+ * The body that was sent to the API is available in the `extra` parameter.
3068
+ */
3069
+ requestError: (request: Request, error: any, extra: {
3070
+ body: any;
3071
+ }) => void;
3072
+ }
2973
3073
  //# sourceMappingURL=types.d.ts.map