snowtransfer 0.17.2 → 0.17.4

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/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  Part of the WeatherStack
7
7
 
8
8
  SnowTransfer is a small library specially made to **only** cover the REST/HTTP area of the discord api.
9
- It makes no assumptions about the rest of your stack, therefore you can use it anywhere as long as you use node 16.15.0 or higher.
9
+ It makes no assumptions about the rest of your stack, therefore you can use it anywhere as long as you use node 22.0.0 or higher.
10
10
 
11
11
  ### Some of the things that make SnowTransfer awesome:
12
12
  - No requirement for other components
@@ -27,7 +27,7 @@ I've written a general whitepaper on the idea of microservice bots, which you ca
27
27
  You can find the docs at [https://daswolke.github.io/SnowTransfer/](https://daswolke.github.io/SnowTransfer/)
28
28
 
29
29
  ### Installation:
30
- To install SnowTransfer, make sure that you have node 16.15.0 or higher and npm installed on your computer.
30
+ To install SnowTransfer, make sure that you have node 22.0.0 or higher and npm installed on your computer.
31
31
 
32
32
  Then run the following command in a terminal `npm install snowtransfer`
33
33
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
2
- import { RESTGetAPIAuditLogQuery, RESTGetAPIAuditLogResult, RESTGetAPIAutoModerationRulesResult, RESTGetAPIAutoModerationRuleResult, RESTPostAPIAutoModerationRuleJSONBody, RESTPostAPIAutoModerationRuleResult, RESTPatchAPIAutoModerationRuleJSONBody, RESTPatchAPIAutoModerationRuleResult, RESTDeleteAPIAutoModerationRuleResult, RESTGetAPIGatewayResult, RESTGetAPIGatewayBotResult, APIApplication, RESTPatchCurrentApplicationJSONBody, RESTGetAPIGuildEmojisResult, RESTGetAPIGuildEmojiResult, RESTPostAPIGuildEmojiJSONBody, RESTPostAPIGuildEmojiResult, RESTPatchAPIGuildEmojiJSONBody, RESTPatchAPIGuildEmojiResult, RESTDeleteAPIGuildEmojiResult, RESTGetAPIStickerResult, RESTGetAPIGuildStickersResult, RESTGetAPIGuildStickerResult, RESTPostAPIGuildStickerFormDataBody, RESTPostAPIGuildStickerResult, RESTPatchAPIGuildStickerJSONBody, RESTPatchAPIGuildStickerResult, RESTDeleteAPIGuildStickerResult, RESTGetAPIApplicationEmojisResult, RESTGetAPIApplicationEmojiResult, RESTPostAPIApplicationEmojiJSONBody, RESTPostAPIApplicationEmojiResult, RESTPatchAPIApplicationEmojiJSONBody, RESTPatchAPIApplicationEmojiResult, RESTDeleteAPIApplicationEmojiResult, RESTGetAPIEntitlementsResult, RESTGetAPIEntitlementResult, RESTPostAPIEntitlementConsumeResult, RESTPostAPIEntitlementJSONBody, RESTPostAPIEntitlementResult, RESTDeleteAPIEntitlementResult, RESTGetAPIGuildResult, RESTGetAPIGuildPreviewResult, RESTPatchAPIGuildJSONBody, RESTPatchAPIGuildResult, RESTGetAPIGuildChannelsResult, RESTPostAPIGuildChannelJSONBody, RESTPostAPIGuildChannelResult, RESTPatchAPIGuildChannelPositionsJSONBody, RESTPatchAPIGuildChannelPositionsResult, RESTGetAPIGuildThreadsResult, RESTGetAPIGuildMemberResult, RESTGetAPIGuildMembersQuery, RESTGetAPIGuildMembersResult, RESTGetAPIGuildMembersSearchQuery, RESTGetAPIGuildMembersSearchResult, RESTPutAPIGuildMemberJSONBody, RESTPutAPIGuildMemberResult, RESTPatchAPIGuildMemberJSONBody, RESTPatchAPIGuildMemberResult, RESTPatchAPICurrentGuildMemberJSONBody, APIGuildMember, RESTPutAPIGuildMemberRoleResult, RESTDeleteAPIGuildMemberRoleResult, RESTDeleteAPIGuildMemberResult, RESTGetAPIGuildBansQuery, RESTGetAPIGuildBansResult, RESTGetAPIGuildBanResult, RESTPutAPIGuildBanJSONBody, RESTPutAPIGuildBanResult, RESTDeleteAPIGuildBanResult, RESTGetAPIGuildRolesResult, RESTPostAPIGuildRoleJSONBody, RESTPostAPIGuildRoleResult, RESTPatchAPIGuildRolePositionsJSONBody, RESTPatchAPIGuildRolePositionsResult, RESTPatchAPIGuildRoleJSONBody, RESTPatchAPIGuildRoleResult, RESTDeleteAPIGuildRoleResult, RESTGetAPIGuildPruneCountQuery, RESTGetAPIGuildPruneCountResult, RESTPostAPIGuildPruneJSONBody, RESTPostAPIGuildPruneResult, RESTGetAPIGuildVoiceRegionsResult, RESTGetAPIGuildInvitesResult, RESTGetAPIGuildIntegrationsResult, RESTDeleteAPIGuildIntegrationResult, RESTGetAPIGuildWidgetSettingsResult, RESTPatchAPIGuildWidgetSettingsJSONBody, RESTPatchAPIGuildWidgetSettingsResult, APIGuildWidget, RESTGetAPIGuildVanityUrlResult, RESTGetAPIGuildWelcomeScreenResult, RESTPatchAPIGuildWelcomeScreenJSONBody, RESTPatchAPIGuildWelcomeScreenResult, RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody, RESTPatchAPIGuildVoiceStateCurrentMemberResult, RESTPatchAPIGuildVoiceStateUserJSONBody, RESTPatchAPIGuildVoiceStateUserResult, RESTGetAPIGuildScheduledEventsResult, RESTPostAPIGuildScheduledEventJSONBody, RESTPostAPIGuildScheduledEventResult, RESTGetAPIGuildScheduledEventResult, RESTPatchAPIGuildScheduledEventJSONBody, RESTPatchAPIGuildScheduledEventResult, RESTDeleteAPIGuildScheduledEventResult, RESTGetAPIGuildScheduledEventUsersQuery, RESTGetAPIGuildScheduledEventUsersResult, RESTGetAPITemplateResult, RESTGetAPIGuildTemplatesResult, RESTPostAPIGuildTemplatesJSONBody, RESTPostAPIGuildTemplatesResult, RESTPutAPIGuildTemplateSyncResult, RESTPatchAPIGuildTemplateJSONBody, RESTPatchAPIGuildTemplateResult, RESTDeleteAPIGuildTemplateResult, RESTPostAPIChannelWebhookJSONBody, RESTPostAPIChannelWebhookResult, RESTGetAPIChannelWebhooksResult, RESTGetAPIGuildWebhooksResult, RESTGetAPIWebhookResult, RESTPatchAPIWebhookJSONBody, RESTPatchAPIWebhookResult, RESTPatchAPIWebhookWithTokenJSONBody, RESTPatchAPIWebhookWithTokenResult, RESTDeleteAPIWebhookResult, RESTPostAPIWebhookWithTokenJSONBody, RESTPostAPIWebhookWithTokenQuery, RESTPostAPIWebhookWithTokenResult, RESTPostAPIWebhookWithTokenWaitResult, RESTPostAPIWebhookWithTokenSlackQuery, RESTPostAPIWebhookWithTokenSlackResult, RESTPostAPIWebhookWithTokenSlackWaitResult, RESTPostAPIWebhookWithTokenGitHubQuery, RESTPostAPIWebhookWithTokenGitHubResult, RESTPostAPIWebhookWithTokenGitHubWaitResult, RESTGetAPIWebhookWithTokenMessageResult, RESTPatchAPIWebhookWithTokenMessageJSONBody, RESTPatchAPIWebhookWithTokenMessageResult, RESTDeleteAPIWebhookWithTokenMessageResult, RESTGetAPIApplicationCommandsResult, RESTPostAPIApplicationCommandsJSONBody, RESTPostAPIApplicationCommandsResult, RESTGetAPIApplicationCommandResult, RESTPatchAPIApplicationCommandJSONBody, RESTPatchAPIApplicationCommandResult, RESTPutAPIApplicationCommandsJSONBody, RESTPutAPIApplicationCommandsResult, RESTGetAPIApplicationGuildCommandsResult, RESTPostAPIApplicationGuildCommandsJSONBody, RESTPostAPIApplicationGuildCommandsResult, RESTGetAPIApplicationGuildCommandResult, RESTPatchAPIApplicationGuildCommandJSONBody, RESTPatchAPIApplicationGuildCommandResult, RESTPutAPIApplicationGuildCommandsJSONBody, RESTPutAPIApplicationGuildCommandsResult, RESTGetAPIApplicationCommandPermissionsResult, RESTPutAPIApplicationCommandPermissionsJSONBody, RESTPutAPIApplicationCommandPermissionsResult, RESTPostAPIInteractionCallbackJSONBody, RESTGetAPIInteractionOriginalResponseResult, RESTPatchAPIInteractionOriginalResponseJSONBody, RESTPatchAPIInteractionOriginalResponseResult, RESTDeleteAPIInteractionOriginalResponseResult, RESTPostAPIInteractionFollowupJSONBody, RESTPostAPIInteractionFollowupResult, RESTGetAPIInteractionFollowupResult, RESTPatchAPIInteractionFollowupJSONBody, RESTPatchAPIInteractionFollowupResult, RESTDeleteAPIInteractionFollowupResult, RESTGetAPIInviteQuery, RESTGetAPIInviteResult, RESTDeleteAPIInviteResult, RESTGetAPISKUsResult, RESTGetAPISKUSubscriptionsQuery, RESTGetAPISKUSubscriptionsResult, RESTGetAPISKUSubscriptionResult, RESTPostAPIStageInstanceJSONBody, RESTPostAPIStageInstanceResult, RESTGetAPIStageInstanceResult, RESTPatchAPIStageInstanceJSONBody, RESTPatchAPIStageInstanceResult, RESTDeleteAPIStageInstanceResult, RESTGetAPICurrentUserResult, RESTGetAPIUserResult, RESTPatchAPICurrentUserJSONBody, RESTPatchAPICurrentUserResult, RESTGetAPICurrentUserGuildsQuery, RESTGetAPICurrentUserGuildsResult, RESTDeleteAPICurrentUserGuildResult, RESTPostAPICurrentUserCreateDMChannelResult, RESTGetAPICurrentUserConnectionsResult, RESTGetAPICurrentUserApplicationRoleConnectionResult, RESTPutAPICurrentUserApplicationRoleConnectionJSONBody, RESTPutAPICurrentUserApplicationRoleConnectionResult, RESTGetAPIVoiceRegionsResult, APIVoiceState, APIAllowedMentions, RESTGetAPIChannelResult, RESTPatchAPIChannelJSONBody, RESTPatchAPIChannelResult, APIThreadChannel, RESTDeleteAPIChannelResult, RESTGetAPIChannelMessagesQuery, RESTGetAPIChannelMessagesResult, RESTGetAPIChannelMessageResult, RESTPostAPIChannelMessageJSONBody, RESTPostAPIChannelMessageResult, RESTPostAPIChannelMessageCrosspostResult, RESTPutAPIChannelMessageReactionResult, RESTDeleteAPIChannelMessageUserReactionResult, RESTDeleteAPIChannelMessageReactionResult, RESTGetAPIChannelMessageReactionUsersQuery, RESTGetAPIChannelMessageReactionUsersResult, RESTDeleteAPIChannelAllMessageReactionsResult, RESTPatchAPIChannelMessageJSONBody, RESTPatchAPIChannelMessageResult, RESTDeleteAPIChannelMessageResult, RESTPostAPIChannelMessagesBulkDeleteResult, RESTPutAPIChannelPermissionJSONBody, RESTPutAPIChannelPermissionResult, RESTGetAPIChannelInvitesResult, RESTPostAPIChannelInviteJSONBody, RESTPostAPIChannelInviteResult, RESTDeleteAPIChannelPermissionResult, RESTPostAPIChannelFollowersResult, RESTPostAPIChannelTypingResult, RESTGetAPIChannelMessagesPinsQuery, RESTGetAPIChannelMessagesPinsResult, RESTPutAPIChannelMessagesPinResult, RESTDeleteAPIChannelMessagesPinResult, RESTPostAPIChannelMessagesThreadsJSONBody, RESTPostAPIChannelMessagesThreadsResult, RESTPostAPIChannelThreadsJSONBody, APITextBasedChannel, ChannelType, RESTPutAPIChannelThreadMembersResult, RESTDeleteAPIChannelThreadMembersResult, RESTGetAPIChannelThreadMemberResult, RESTGetAPIChannelThreadMembersQuery, RESTGetAPIChannelThreadMembersResult, RESTGetAPIChannelThreadsArchivedQuery, RESTGetAPIChannelThreadsArchivedPublicResult, RESTGetAPIChannelThreadsArchivedPrivateResult, RESTGetAPIChannelUsersThreadsArchivedResult, RESTGetAPIPollAnswerVotersQuery, RESTGetAPIPollAnswerVotersResult, RESTPostAPIPollExpireResult, RESTPostOAuth2AccessTokenResult } from 'discord-api-types/v10';
2
+ import { RESTGetAPIAuditLogQuery, RESTGetAPIAuditLogResult, RESTGetAPIAutoModerationRulesResult, RESTGetAPIAutoModerationRuleResult, RESTPostAPIAutoModerationRuleJSONBody, RESTPostAPIAutoModerationRuleResult, RESTPatchAPIAutoModerationRuleJSONBody, RESTPatchAPIAutoModerationRuleResult, RESTGetAPIGatewayResult, RESTGetAPIGatewayBotResult, APIApplication, RESTPatchCurrentApplicationJSONBody, RESTGetAPIGuildEmojisResult, RESTGetAPIGuildEmojiResult, RESTPostAPIGuildEmojiJSONBody, RESTPostAPIGuildEmojiResult, RESTPatchAPIGuildEmojiJSONBody, RESTPatchAPIGuildEmojiResult, RESTGetAPIStickerResult, RESTGetAPIGuildStickersResult, RESTGetAPIGuildStickerResult, RESTPostAPIGuildStickerFormDataBody, RESTPostAPIGuildStickerResult, RESTPatchAPIGuildStickerJSONBody, RESTPatchAPIGuildStickerResult, RESTGetAPIApplicationEmojisResult, RESTGetAPIApplicationEmojiResult, RESTPostAPIApplicationEmojiJSONBody, RESTPostAPIApplicationEmojiResult, RESTPatchAPIApplicationEmojiJSONBody, RESTPatchAPIApplicationEmojiResult, RESTGetAPIEntitlementsResult, RESTGetAPIEntitlementResult, RESTPostAPIEntitlementJSONBody, RESTPostAPIEntitlementResult, RESTGetAPIGuildResult, RESTGetAPIGuildPreviewResult, RESTPatchAPIGuildJSONBody, RESTPatchAPIGuildResult, RESTGetAPIGuildChannelsResult, RESTPostAPIGuildChannelJSONBody, RESTPostAPIGuildChannelResult, RESTPatchAPIGuildChannelPositionsJSONBody, RESTGetAPIGuildThreadsResult, RESTGetAPIGuildMemberResult, RESTGetAPIGuildMembersQuery, RESTGetAPIGuildMembersResult, RESTGetAPIGuildMembersSearchQuery, RESTGetAPIGuildMembersSearchResult, RESTPutAPIGuildMemberJSONBody, RESTPutAPIGuildMemberResult, RESTPatchAPIGuildMemberJSONBody, RESTPatchAPIGuildMemberResult, RESTPatchAPICurrentGuildMemberJSONBody, APIGuildMember, RESTGetAPIGuildBansQuery, RESTGetAPIGuildBansResult, RESTGetAPIGuildBanResult, RESTPutAPIGuildBanJSONBody, RESTGetAPIGuildRolesResult, RESTPostAPIGuildRoleJSONBody, RESTPostAPIGuildRoleResult, RESTPatchAPIGuildRolePositionsJSONBody, RESTPatchAPIGuildRolePositionsResult, RESTPatchAPIGuildRoleJSONBody, RESTPatchAPIGuildRoleResult, RESTGetAPIGuildPruneCountQuery, RESTGetAPIGuildPruneCountResult, RESTPostAPIGuildPruneJSONBody, RESTPostAPIGuildPruneResult, RESTGetAPIGuildVoiceRegionsResult, RESTGetAPIGuildInvitesResult, RESTGetAPIGuildIntegrationsResult, RESTGetAPIGuildWidgetSettingsResult, RESTPatchAPIGuildWidgetSettingsJSONBody, RESTPatchAPIGuildWidgetSettingsResult, APIGuildWidget, RESTGetAPIGuildVanityUrlResult, RESTGetAPIGuildWelcomeScreenResult, RESTPatchAPIGuildWelcomeScreenJSONBody, RESTPatchAPIGuildWelcomeScreenResult, RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody, RESTPatchAPIGuildVoiceStateUserJSONBody, RESTGetAPIGuildScheduledEventsResult, RESTPostAPIGuildScheduledEventJSONBody, RESTPostAPIGuildScheduledEventResult, RESTGetAPIGuildScheduledEventResult, RESTPatchAPIGuildScheduledEventJSONBody, RESTPatchAPIGuildScheduledEventResult, RESTGetAPIGuildScheduledEventUsersQuery, RESTGetAPIGuildScheduledEventUsersResult, RESTGetAPITemplateResult, RESTGetAPIGuildTemplatesResult, RESTPostAPIGuildTemplatesJSONBody, RESTPostAPIGuildTemplatesResult, RESTPutAPIGuildTemplateSyncResult, RESTPatchAPIGuildTemplateJSONBody, RESTPatchAPIGuildTemplateResult, RESTDeleteAPIGuildTemplateResult, RESTPostAPIChannelWebhookJSONBody, RESTPostAPIChannelWebhookResult, RESTGetAPIChannelWebhooksResult, RESTGetAPIGuildWebhooksResult, RESTGetAPIWebhookResult, RESTPatchAPIWebhookJSONBody, RESTPatchAPIWebhookResult, RESTPatchAPIWebhookWithTokenJSONBody, RESTPatchAPIWebhookWithTokenResult, RESTPostAPIWebhookWithTokenJSONBody, RESTPostAPIWebhookWithTokenQuery, RESTPostAPIWebhookWithTokenResult, RESTPostAPIWebhookWithTokenWaitResult, RESTPostAPIWebhookWithTokenSlackQuery, RESTPostAPIWebhookWithTokenSlackResult, RESTPostAPIWebhookWithTokenSlackWaitResult, RESTPostAPIWebhookWithTokenGitHubQuery, RESTPostAPIWebhookWithTokenGitHubResult, RESTPostAPIWebhookWithTokenGitHubWaitResult, RESTGetAPIWebhookWithTokenMessageResult, RESTPatchAPIWebhookWithTokenMessageJSONBody, RESTPatchAPIWebhookWithTokenMessageResult, RESTGetAPIApplicationCommandsResult, RESTPostAPIApplicationCommandsJSONBody, RESTPostAPIApplicationCommandsResult, RESTGetAPIApplicationCommandResult, RESTPatchAPIApplicationCommandJSONBody, RESTPatchAPIApplicationCommandResult, RESTPutAPIApplicationCommandsJSONBody, RESTPutAPIApplicationCommandsResult, RESTGetAPIApplicationGuildCommandsResult, RESTPostAPIApplicationGuildCommandsJSONBody, RESTPostAPIApplicationGuildCommandsResult, RESTGetAPIApplicationGuildCommandResult, RESTPatchAPIApplicationGuildCommandJSONBody, RESTPatchAPIApplicationGuildCommandResult, RESTPutAPIApplicationGuildCommandsJSONBody, RESTPutAPIApplicationGuildCommandsResult, RESTGetAPIApplicationCommandPermissionsResult, RESTPutAPIApplicationCommandPermissionsJSONBody, RESTPutAPIApplicationCommandPermissionsResult, RESTPostAPIInteractionCallbackJSONBody, RESTGetAPIInteractionOriginalResponseResult, RESTPatchAPIInteractionOriginalResponseJSONBody, RESTPatchAPIInteractionOriginalResponseResult, RESTPostAPIInteractionFollowupJSONBody, RESTPostAPIInteractionFollowupResult, RESTGetAPIInteractionFollowupResult, RESTPatchAPIInteractionFollowupJSONBody, RESTPatchAPIInteractionFollowupResult, RESTGetAPIInviteQuery, RESTGetAPIInviteResult, RESTDeleteAPIInviteResult, RESTGetAPISKUsResult, RESTGetAPISKUSubscriptionsQuery, RESTGetAPISKUSubscriptionsResult, RESTGetAPISKUSubscriptionResult, RESTPostAPIStageInstanceJSONBody, RESTPostAPIStageInstanceResult, RESTGetAPIStageInstanceResult, RESTPatchAPIStageInstanceJSONBody, RESTPatchAPIStageInstanceResult, RESTGetAPICurrentUserResult, RESTGetAPIUserResult, RESTPatchAPICurrentUserJSONBody, RESTPatchAPICurrentUserResult, RESTGetAPICurrentUserGuildsQuery, RESTGetAPICurrentUserGuildsResult, RESTPostAPICurrentUserCreateDMChannelResult, RESTGetAPICurrentUserConnectionsResult, RESTGetAPICurrentUserApplicationRoleConnectionResult, RESTPutAPICurrentUserApplicationRoleConnectionJSONBody, RESTPutAPICurrentUserApplicationRoleConnectionResult, RESTGetAPIVoiceRegionsResult, APIVoiceState, APIAllowedMentions, RESTGetAPIChannelResult, RESTPatchAPIChannelJSONBody, RESTPatchAPIChannelResult, APIThreadChannel, RESTDeleteAPIChannelResult, RESTGetAPIChannelMessagesQuery, RESTGetAPIChannelMessagesResult, RESTGetAPIChannelMessageResult, RESTPostAPIChannelMessageJSONBody, RESTPostAPIChannelMessageResult, RESTPostAPIChannelMessageCrosspostResult, RESTGetAPIChannelMessageReactionUsersQuery, RESTGetAPIChannelMessageReactionUsersResult, RESTPatchAPIChannelMessageJSONBody, RESTPatchAPIChannelMessageResult, RESTPutAPIChannelPermissionJSONBody, RESTGetAPIChannelInvitesResult, RESTPostAPIChannelInviteJSONBody, RESTPostAPIChannelInviteResult, RESTPostAPIChannelFollowersResult, RESTGetAPIChannelMessagesPinsQuery, RESTGetAPIChannelMessagesPinsResult, RESTPostAPIChannelMessagesThreadsJSONBody, RESTPostAPIChannelMessagesThreadsResult, RESTPostAPIChannelThreadsJSONBody, APITextBasedChannel, ChannelType, RESTGetAPIChannelThreadMemberResult, RESTGetAPIChannelThreadMembersQuery, RESTGetAPIChannelThreadMembersResult, RESTGetAPIChannelThreadsArchivedQuery, RESTGetAPIChannelThreadsArchivedPublicResult, RESTGetAPIChannelThreadsArchivedPrivateResult, RESTGetAPIChannelUsersThreadsArchivedResult, RESTGetAPIPollAnswerVotersQuery, RESTGetAPIPollAnswerVotersResult, RESTPostAPIPollExpireResult, RESTPostOAuth2AccessTokenResult } from 'discord-api-types/v10';
3
3
  import { Blob, File as File$1 } from 'buffer';
4
4
  import { Readable } from 'stream';
5
5
  import { ReadableStream } from 'stream/web';
@@ -560,7 +560,7 @@ declare class AutoModerationMethods {
560
560
  * const client = new SnowTransfer("TOKEN")
561
561
  * client.autoMod.deleteAutoModerationRules("guild id", "rule id", "was useless")
562
562
  */
563
- deleteAutoModerationRule(guildId: string, ruleId: string, reason?: string): Promise<RESTDeleteAPIAutoModerationRuleResult>;
563
+ deleteAutoModerationRule(guildId: string, ruleId: string, reason?: string): Promise<void>;
564
564
  }
565
565
 
566
566
  /**
@@ -728,7 +728,7 @@ declare class AssetsMethods {
728
728
  * const client = new SnowTransfer("TOKEN")
729
729
  * client.assets.deleteGuildEmoji("guild id", "emoji id", "wasn't nice")
730
730
  */
731
- deleteGuildEmoji(guildId: string, emojiId: string, reason?: string): Promise<RESTDeleteAPIGuildEmojiResult>;
731
+ deleteGuildEmoji(guildId: string, emojiId: string, reason?: string): Promise<void>;
732
732
  /**
733
733
  * Get a global sticker
734
734
  * @since 0.13.0
@@ -838,7 +838,7 @@ declare class AssetsMethods {
838
838
  * const client = new SnowTransfer("TOKEN")
839
839
  * client.assets.deleteGuildSticker("guild id", "sticker id", "It was too nice")
840
840
  */
841
- deleteGuildSticker(guildId: string, stickerId: string, reason?: string): Promise<RESTDeleteAPIGuildStickerResult>;
841
+ deleteGuildSticker(guildId: string, stickerId: string, reason?: string): Promise<void>;
842
842
  /**
843
843
  * Get all emojis for an app
844
844
  * @since 0.13.0
@@ -912,7 +912,7 @@ declare class AssetsMethods {
912
912
  * client.assets.deleteAppEmoji("app id", "emoji id") // OH GOD THE UNIVERSE IS COLLAPSING
913
913
  * // We're safe. The emoji is gone. For now...
914
914
  */
915
- deleteAppEmoji(appId: string, emojiId: string): Promise<RESTDeleteAPIApplicationEmojiResult>;
915
+ deleteAppEmoji(appId: string, emojiId: string): Promise<void>;
916
916
  }
917
917
 
918
918
  /**
@@ -968,7 +968,7 @@ declare class EntitlementMethods {
968
968
  * const client = new SnowTransfer("TOKEN")
969
969
  * client.entitlement.consumeEntitlement("app id", "entitlement id")
970
970
  */
971
- consumeEntitlement(appId: string, entitlementId: string): Promise<RESTPostAPIEntitlementConsumeResult>;
971
+ consumeEntitlement(appId: string, entitlementId: string): Promise<void>;
972
972
  /**
973
973
  * 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
974
974
  * @since 0.13.0
@@ -998,7 +998,7 @@ declare class EntitlementMethods {
998
998
  * const client = new SnowTransfer("TOKEN")
999
999
  * client.entitlement.deleteTestEntitlement("app id", "entitlement id")
1000
1000
  */
1001
- deleteTestEntitlement(appId: string, entitlementId: string): Promise<RESTDeleteAPIEntitlementResult>;
1001
+ deleteTestEntitlement(appId: string, entitlementId: string): Promise<void>;
1002
1002
  }
1003
1003
 
1004
1004
  /**
@@ -1118,7 +1118,7 @@ declare class GuildMethods {
1118
1118
  * const client = new SnowTransfer("TOKEN")
1119
1119
  * client.guild.updateChannelPositions("guild id", [{ id: "channel id", position: 2, parent_id: "category id" }], "they looked out of order")
1120
1120
  */
1121
- updateChannelPositions(guildId: string, data: RESTPatchAPIGuildChannelPositionsJSONBody, reason?: string): Promise<RESTPatchAPIGuildChannelPositionsResult>;
1121
+ updateChannelPositions(guildId: string, data: RESTPatchAPIGuildChannelPositionsJSONBody, reason?: string): Promise<void>;
1122
1122
  /**
1123
1123
  * Returns all active threads in the guild, including public and private threads. Threads are ordered by their `id`, in descending order
1124
1124
  * @since 0.3.0
@@ -1270,7 +1270,7 @@ declare class GuildMethods {
1270
1270
  * const client = new SnowTransfer("TOKEN")
1271
1271
  * client.guild.addGuildMemberRole("guildId", "memberId", "roleId", "I want to add a role")
1272
1272
  */
1273
- addGuildMemberRole(guildId: string, memberId: string, roleId: string, reason?: string): Promise<RESTPutAPIGuildMemberRoleResult>;
1273
+ addGuildMemberRole(guildId: string, memberId: string, roleId: string, reason?: string): Promise<void>;
1274
1274
  /**
1275
1275
  * Remove a role from a guild member
1276
1276
  * @since 0.1.0
@@ -1289,7 +1289,7 @@ declare class GuildMethods {
1289
1289
  * const client = new SnowTransfer("TOKEN")
1290
1290
  * client.guild.removeGuildMemberRole("guildId", "memberId", "roleId", "I want to remove a role")
1291
1291
  */
1292
- removeGuildMemberRole(guildId: string, memberId: string, roleId: string, reason?: string): Promise<RESTDeleteAPIGuildMemberRoleResult>;
1292
+ removeGuildMemberRole(guildId: string, memberId: string, roleId: string, reason?: string): Promise<void>;
1293
1293
  /**
1294
1294
  * Remove a guild member (aka kick them)
1295
1295
  * @since 0.1.0
@@ -1307,7 +1307,7 @@ declare class GuildMethods {
1307
1307
  * const client = new SnowTransfer("TOKEN")
1308
1308
  * client.guild.removeGuildMember("guild Id", "memberId", "spam")
1309
1309
  */
1310
- removeGuildMember(guildId: string, memberId: string, reason?: string): Promise<RESTDeleteAPIGuildMemberResult>;
1310
+ removeGuildMember(guildId: string, memberId: string, reason?: string): Promise<void>;
1311
1311
  /**
1312
1312
  * Get bans of a guild
1313
1313
  * @since 0.1.0
@@ -1363,7 +1363,7 @@ declare class GuildMethods {
1363
1363
  * }
1364
1364
  * client.guild.createGuildBan("guild Id", "memberId", banData, "Memes were not good enough")
1365
1365
  */
1366
- createGuildBan(guildId: string, memberId: string, data?: RESTPutAPIGuildBanJSONBody, reason?: string): Promise<RESTPutAPIGuildBanResult>;
1366
+ createGuildBan(guildId: string, memberId: string, data?: RESTPutAPIGuildBanJSONBody, reason?: string): Promise<void>;
1367
1367
  /**
1368
1368
  * Remove a ban of a user
1369
1369
  * @since 0.1.0
@@ -1381,7 +1381,7 @@ declare class GuildMethods {
1381
1381
  * const client = new SnowTransfer("TOKEN")
1382
1382
  * client.guild.removeGuildBan("guildId", "memberId", "This guy was cool")
1383
1383
  */
1384
- removeGuildBan(guildId: string, memberId: string, reason?: string): Promise<RESTDeleteAPIGuildBanResult>;
1384
+ removeGuildBan(guildId: string, memberId: string, reason?: string): Promise<void>;
1385
1385
  /**
1386
1386
  * Get a list of roles for a guild
1387
1387
  * @since 0.1.0
@@ -1474,7 +1474,7 @@ declare class GuildMethods {
1474
1474
  * const client = new SnowTransfer("TOKEN")
1475
1475
  * client.guild.deleteGuildRole("guildId", "roleId", "This role is too cool")
1476
1476
  */
1477
- removeGuildRole(guildId: string, roleId: string, reason?: string): Promise<RESTDeleteAPIGuildRoleResult>;
1477
+ removeGuildRole(guildId: string, roleId: string, reason?: string): Promise<void>;
1478
1478
  /**
1479
1479
  * Get the amount of members that would be pruned when a prune with the passed amount of days would be started
1480
1480
  * @since 0.1.0
@@ -1574,7 +1574,7 @@ declare class GuildMethods {
1574
1574
  * const client = new SnowTransfer("TOKEN")
1575
1575
  * await client.guild.deleteGuildIntegration("guildId", "integrationId", "Didn't need anymore")
1576
1576
  */
1577
- removeGuildIntegration(guildId: string, integrationId: string, reason?: string): Promise<RESTDeleteAPIGuildIntegrationResult>;
1577
+ removeGuildIntegration(guildId: string, integrationId: string, reason?: string): Promise<void>;
1578
1578
  /**
1579
1579
  * Get a guild widget settings object
1580
1580
  * @since 0.3.0
@@ -1684,7 +1684,7 @@ declare class GuildMethods {
1684
1684
  * const client = new SnowTransfer("TOKEN")
1685
1685
  * client.guild.updateGuildVoiceState("guildId", { channel_id: "channel id", suppress: false })
1686
1686
  */
1687
- updateCurrentUserVoiceState(guildId: string, data: RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody): Promise<RESTPatchAPIGuildVoiceStateCurrentMemberResult>;
1687
+ updateCurrentUserVoiceState(guildId: string, data: RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody): Promise<void>;
1688
1688
  /**
1689
1689
  * Updates a user's voice state in a stage channel
1690
1690
  * @since 0.3.0
@@ -1702,7 +1702,7 @@ declare class GuildMethods {
1702
1702
  * const client = new SnowTransfer("TOKEN")
1703
1703
  * client.guild.updateGuildVoiceState("guildId", "userId", { channel_id: "channel id", suppress: true })
1704
1704
  */
1705
- updateUserVoiceState(guildId: string, userId: string, data: RESTPatchAPIGuildVoiceStateUserJSONBody): Promise<RESTPatchAPIGuildVoiceStateUserResult>;
1705
+ updateUserVoiceState(guildId: string, userId: string, data: RESTPatchAPIGuildVoiceStateUserJSONBody): Promise<void>;
1706
1706
  }
1707
1707
 
1708
1708
  /**
@@ -1822,7 +1822,7 @@ declare class GuildScheduledEventMethods {
1822
1822
  * const client = new SnowTransfer("TOKEN")
1823
1823
  * client.guildScheduledEvent.deleteGuildScheduledEvent(guildId, eventId)
1824
1824
  */
1825
- deleteGuildScheduledEvent(guildId: string, eventId: string): Promise<RESTDeleteAPIGuildScheduledEventResult>;
1825
+ deleteGuildScheduledEvent(guildId: string, eventId: string): Promise<void>;
1826
1826
  /**
1827
1827
  * Get a list of users attending a specific event
1828
1828
  * @since 0.3.6
@@ -2094,7 +2094,7 @@ declare class WebhookMethods {
2094
2094
  * const client = new SnowTransfer("TOKEN");
2095
2095
  * client.webhook.deleteWebhook("webhook Id")
2096
2096
  */
2097
- deleteWebhook(webhookId: string, reason?: string): Promise<RESTDeleteAPIWebhookResult>;
2097
+ deleteWebhook(webhookId: string, reason?: string): Promise<void>;
2098
2098
  /**
2099
2099
  * Delete a Webhook with a token
2100
2100
  * @since 0.17.0
@@ -2107,7 +2107,7 @@ declare class WebhookMethods {
2107
2107
  * const client = new SnowTransfer(); // No token needed if webhook token is provided
2108
2108
  * client.webhook.deleteWebhookToken("webhook Id", "webhook token")
2109
2109
  */
2110
- deleteWebhookToken(webhookId: string, token: string, reason?: string): Promise<RESTDeleteAPIWebhookResult>;
2110
+ deleteWebhookToken(webhookId: string, token: string, reason?: string): Promise<void>;
2111
2111
  /**
2112
2112
  * Send a message via Webhook
2113
2113
  * @since 0.1.0
@@ -2213,7 +2213,7 @@ declare class WebhookMethods {
2213
2213
  * @param threadId Id of the thread the message was sent in
2214
2214
  * @returns Resolves the Promise on successful execution
2215
2215
  */
2216
- deleteWebhookMessage(webhookId: string, token: string, messageId: string, threadId?: string): Promise<RESTDeleteAPIWebhookWithTokenMessageResult>;
2216
+ deleteWebhookMessage(webhookId: string, token: string, messageId: string, threadId?: string): Promise<void>;
2217
2217
  }
2218
2218
 
2219
2219
  /**
@@ -2295,7 +2295,7 @@ declare class InteractionMethods {
2295
2295
  * const client = new SnowTransfer("TOKEN")
2296
2296
  * client.interaction.deleteApplicationCommand("appId", "cmdId")
2297
2297
  */
2298
- deleteApplicationCommand(appId: string, cmdId: string): Promise<never>;
2298
+ deleteApplicationCommand(appId: string, cmdId: string): Promise<void>;
2299
2299
  /**
2300
2300
  * Takes a list of application commands, overwriting existing commands that are registered globally for this application.
2301
2301
  * Updates will be available in all guilds after 1 hour
@@ -2374,7 +2374,7 @@ declare class InteractionMethods {
2374
2374
  * const client = new SnowTransfer("TOKEN")
2375
2375
  * client.interaction.deleteGuildApplicationCommand("appId", "guildId", "cmdId")
2376
2376
  */
2377
- deleteGuildApplicationCommand(appId: string, guildId: string, cmdId: string): Promise<never>;
2377
+ deleteGuildApplicationCommand(appId: string, guildId: string, cmdId: string): Promise<void>;
2378
2378
  /**
2379
2379
  * Takes a list of application commands, overwriting existing commands for the guild
2380
2380
  * @since 0.5.0
@@ -2486,7 +2486,7 @@ declare class InteractionMethods {
2486
2486
  * const client = new SnowTransfer() // This endpoint does not require a Bot token. The interaction token alone will suffice
2487
2487
  * client.interaction.deleteOriginalInteractionResponse("appId", "token")
2488
2488
  */
2489
- deleteOriginalInteractionResponse(appId: string, token: string): Promise<RESTDeleteAPIInteractionOriginalResponseResult>;
2489
+ deleteOriginalInteractionResponse(appId: string, token: string): Promise<void>;
2490
2490
  /**
2491
2491
  * Create a followup message for an Interaction
2492
2492
  * @since 0.3.0
@@ -2549,7 +2549,7 @@ declare class InteractionMethods {
2549
2549
  * const client = new SnowTransfer() // This endpoint does not require a Bot token. The interaction token alone will suffice
2550
2550
  * client.interaction.deleteFollowupMessage("appId", "token", "messageId")
2551
2551
  */
2552
- deleteFollowupMessage(appId: string, token: string, messageId: string): Promise<RESTDeleteAPIInteractionFollowupResult>;
2552
+ deleteFollowupMessage(appId: string, token: string, messageId: string): Promise<void>;
2553
2553
  }
2554
2554
 
2555
2555
  /**
@@ -2619,7 +2619,7 @@ declare class InviteMethods {
2619
2619
  * const client = new SnowTransfer("TOKEN")
2620
2620
  * await client.invite.updateInviteTargetUsers("inviteId", someUserArray)
2621
2621
  */
2622
- updateInviteTargetUsers(inviteId: string, userIds: Array<string>): Promise<RESTPutAPIInviteTargetUsers>;
2622
+ updateInviteTargetUsers(inviteId: string, userIds: Array<string>): Promise<void>;
2623
2623
  /**
2624
2624
  * Gets the job status on setting target users to an invite
2625
2625
  * @param inviteId Id of the invite
@@ -2771,7 +2771,7 @@ declare class StageInstanceMethods {
2771
2771
  * const client = new SnowTransfer("TOKEN")
2772
2772
  * client.stageInstance.deleteStageInstance("channel id", "They already know who's house this is")
2773
2773
  */
2774
- deleteStageInstance(channelId: string, reason?: string): Promise<RESTDeleteAPIStageInstanceResult>;
2774
+ deleteStageInstance(channelId: string, reason?: string): Promise<void>;
2775
2775
  }
2776
2776
 
2777
2777
  /**
@@ -2853,7 +2853,7 @@ declare class UserMethods {
2853
2853
  * const client = new SnowTransfer("TOKEN")
2854
2854
  * client.user.leaveGuild("guildId")
2855
2855
  */
2856
- leaveGuild(guildId: string): Promise<RESTDeleteAPICurrentUserGuildResult>;
2856
+ leaveGuild(guildId: string): Promise<void>;
2857
2857
  /**
2858
2858
  * Create a direct message channel with another user
2859
2859
  *
@@ -3289,7 +3289,7 @@ declare class ChannelMethods {
3289
3289
  * const client = new SnowTransfer("TOKEN")
3290
3290
  * client.channel.createReaction("channel Id", "message Id", encodeURIComponent("😀"))
3291
3291
  */
3292
- createReaction(channelId: string, messageId: string, emoji: string): Promise<RESTPutAPIChannelMessageReactionResult>;
3292
+ createReaction(channelId: string, messageId: string, emoji: string): Promise<void>;
3293
3293
  /**
3294
3294
  * Delete a reaction added by the current user from a message
3295
3295
  * @since 0.1.0
@@ -3313,7 +3313,7 @@ declare class ChannelMethods {
3313
3313
  * const client = new SnowTransfer("TOKEN")
3314
3314
  * client.channel.deleteReactionSelf("channel Id", "message Id", encodeURIComponent("😀"))
3315
3315
  */
3316
- deleteReactionSelf(channelId: string, messageId: string, emoji: string): Promise<RESTDeleteAPIChannelMessageUserReactionResult>;
3316
+ deleteReactionSelf(channelId: string, messageId: string, emoji: string): Promise<void>;
3317
3317
  /**
3318
3318
  * Delete a reaction from a message in a guild channel
3319
3319
  * @since 0.1.0
@@ -3340,8 +3340,7 @@ declare class ChannelMethods {
3340
3340
  * // If a user Id is not supplied, the emoji from that message will be removed for all users
3341
3341
  * client.channel.deleteReaction("channel Id", "message Id", encodeURIComponent("😀"))
3342
3342
  */
3343
- deleteReaction(channelId: string, messageId: string, emoji: string): Promise<RESTDeleteAPIChannelMessageReactionResult>;
3344
- deleteReaction(channelId: string, messageId: string, emoji: string, userId: string): Promise<RESTDeleteAPIChannelMessageUserReactionResult>;
3343
+ deleteReaction(channelId: string, messageId: string, emoji: string, userId?: string): Promise<void>;
3345
3344
  /**
3346
3345
  * Get a list of users that reacted with a certain emoji on a certain message
3347
3346
  * @since 0.1.0
@@ -3379,7 +3378,7 @@ declare class ChannelMethods {
3379
3378
  * const client = new SnowTransfer("TOKEN")
3380
3379
  * client.channel.deleteAllReactions("channel Id", "message Id")
3381
3380
  */
3382
- deleteAllReactions(channelId: string, messageId: string): Promise<RESTDeleteAPIChannelAllMessageReactionsResult>;
3381
+ deleteAllReactions(channelId: string, messageId: string): Promise<void>;
3383
3382
  /**
3384
3383
  * Edit a message sent by the current user or edit the message flags of another user's message
3385
3384
  * @since 0.1.0
@@ -3425,7 +3424,7 @@ declare class ChannelMethods {
3425
3424
  * const client = new SnowTransfer("TOKEN")
3426
3425
  * client.channel.deleteMessage("channel id", "message id")
3427
3426
  */
3428
- deleteMessage(channelId: string, messageId: string, reason?: string): Promise<RESTDeleteAPIChannelMessageResult>;
3427
+ deleteMessage(channelId: string, messageId: string, reason?: string): Promise<void>;
3429
3428
  /**
3430
3429
  * Bulk delete messages from a guild channel, messages may not be older than 2 weeks
3431
3430
  * @since 0.1.0
@@ -3444,7 +3443,7 @@ declare class ChannelMethods {
3444
3443
  * const client = new SnowTransfer("TOKEN")
3445
3444
  * client.channel.bulkDeleteMessages("channel id", ["message id 1", "message id 2"], "spam")
3446
3445
  */
3447
- bulkDeleteMessages(channelId: string, messages: Array<string>, reason?: string): Promise<RESTPostAPIChannelMessagesBulkDeleteResult>;
3446
+ bulkDeleteMessages(channelId: string, messages: Array<string>, reason?: string): Promise<void>;
3448
3447
  /**
3449
3448
  * Modify the permission overwrites of a guild channel
3450
3449
  * @since 0.1.0
@@ -3466,7 +3465,7 @@ declare class ChannelMethods {
3466
3465
  * const client = new SnowTransfer("TOKEN")
3467
3466
  * client.channel.editChannelPermission("channel id", "user id", { allow: String(1 << 10), type: 1 })
3468
3467
  */
3469
- editChannelPermission(channelId: string, permissionId: string, data: RESTPutAPIChannelPermissionJSONBody, reason?: string): Promise<RESTPutAPIChannelPermissionResult>;
3468
+ editChannelPermission(channelId: string, permissionId: string, data: RESTPutAPIChannelPermissionJSONBody, reason?: string): Promise<void>;
3470
3469
  /**
3471
3470
  * Get a list of invites for a guild channel
3472
3471
  * @since 0.1.0
@@ -3528,7 +3527,7 @@ declare class ChannelMethods {
3528
3527
  * const client = new SnowTransfer("TOKEN")
3529
3528
  * client.channel.deleteChannelPermission("channel id", "user id", "Abusing channel")
3530
3529
  */
3531
- deleteChannelPermission(channelId: string, permissionId: string, reason?: string): Promise<RESTDeleteAPIChannelPermissionResult>;
3530
+ deleteChannelPermission(channelId: string, permissionId: string, reason?: string): Promise<void>;
3532
3531
  /**
3533
3532
  * Follow an announcement channel to another channel
3534
3533
  * @since 0.7.0
@@ -3565,7 +3564,7 @@ declare class ChannelMethods {
3565
3564
  * const client = new SnowTransfer("TOKEN")
3566
3565
  * client.channel.sendChannelTyping("channel id")
3567
3566
  */
3568
- startChannelTyping(channelId: string): Promise<RESTPostAPIChannelTypingResult>;
3567
+ startChannelTyping(channelId: string): Promise<void>;
3569
3568
  /**
3570
3569
  * Get a list of pinned messages for a channel
3571
3570
  * @since 0.1.0
@@ -3601,7 +3600,7 @@ declare class ChannelMethods {
3601
3600
  * const client = new SnowTransfer("TOKEN")
3602
3601
  * client.channel.addChannelPinnedMessage("channel id", "message id", "Good meme")
3603
3602
  */
3604
- addChannelPinnedMessage(channelId: string, messageId: string, reason?: string): Promise<RESTPutAPIChannelMessagesPinResult>;
3603
+ addChannelPinnedMessage(channelId: string, messageId: string, reason?: string): Promise<void>;
3605
3604
  /**
3606
3605
  * Remove a pinned message from a channel
3607
3606
  * @since 0.1.0
@@ -3621,7 +3620,7 @@ declare class ChannelMethods {
3621
3620
  * const client = new SnowTransfer("TOKEN")
3622
3621
  * client.channel.removeChannelPinnedMessage("channel id", "message id", "Mod abuse")
3623
3622
  */
3624
- removeChannelPinnedMessage(channelId: string, messageId: string, reason?: string): Promise<RESTDeleteAPIChannelMessagesPinResult>;
3623
+ removeChannelPinnedMessage(channelId: string, messageId: string, reason?: string): Promise<void>;
3625
3624
  /**
3626
3625
  * Creates a public thread off a message in a guild channel
3627
3626
  * @since 0.3.0
@@ -3684,7 +3683,7 @@ declare class ChannelMethods {
3684
3683
  * const client = new SnowTransfer("TOKEN")
3685
3684
  * client.channel.joinThread("thread id")
3686
3685
  */
3687
- joinThread(threadId: string): Promise<RESTPutAPIChannelThreadMembersResult>;
3686
+ joinThread(threadId: string): Promise<void>;
3688
3687
  /**
3689
3688
  * Add a user to a thread
3690
3689
  *
@@ -3703,7 +3702,7 @@ declare class ChannelMethods {
3703
3702
  * const client = new SnowTransfer("TOKEN")
3704
3703
  * client.channel.addThreadMember("thread id", "user id")
3705
3704
  */
3706
- addThreadMember(threadId: string, userId: string): Promise<RESTPutAPIChannelThreadMembersResult>;
3705
+ addThreadMember(threadId: string, userId: string): Promise<void>;
3707
3706
  /**
3708
3707
  * Leave a thread
3709
3708
  * @since 0.3.0
@@ -3714,7 +3713,7 @@ declare class ChannelMethods {
3714
3713
  * const client = new SnowTransfer("TOKEN")
3715
3714
  * client.channel.leaveThread("thread id")
3716
3715
  */
3717
- leaveThread(threadId: string): Promise<RESTDeleteAPIChannelThreadMembersResult>;
3716
+ leaveThread(threadId: string): Promise<void>;
3718
3717
  /**
3719
3718
  * Remove a user from a thread
3720
3719
  * @since 0.3.0
@@ -3730,7 +3729,7 @@ declare class ChannelMethods {
3730
3729
  * const client = new SnowTransfer("TOKEN")
3731
3730
  * client.channel.removeThreadMember("thread id", "user id")
3732
3731
  */
3733
- removeThreadMember(threadId: string, userId: string): Promise<RESTDeleteAPIChannelThreadMembersResult>;
3732
+ removeThreadMember(threadId: string, userId: string): Promise<void>;
3734
3733
  /**
3735
3734
  * Gets a member of a thread
3736
3735
  * @since 0.3.0
@@ -3883,7 +3882,7 @@ declare class ChannelMethods {
3883
3882
  * // clears the status
3884
3883
  * client.channel.setVoiceChannelStatus("channel id", "")
3885
3884
  */
3886
- setVoiceChannelStatus(channelId: string, status: string): Promise<RESTPutAPIChannelVoiceStatus>;
3885
+ setVoiceChannelStatus(channelId: string, status: string): Promise<void>;
3887
3886
  }
3888
3887
 
3889
3888
  /**
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ var web = require('stream/web');
6
6
  var events = require('events');
7
7
  var v10 = require('discord-api-types/v10');
8
8
 
9
- var __getOwnPropNames=Object.getOwnPropertyNames;var __require=(x=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(x,{get:(a,b)=>(typeof require<"u"?require:a)[b]}):x)(function(x){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+x+'" is not supported')});var __esm=(fn,res)=>function(){return fn&&(res=(0, fn[__getOwnPropNames(fn)[0]])(fn=0)),res};var __commonJS=(cb,mod)=>function(){return mod||(0, cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports};var require_StateMachine=__commonJS({"src/StateMachine.ts"(exports,module){var EventEmitter2=__require("events"),StateMachine=class extends EventEmitter2{constructor(currentStateName){super();this.currentStateName=currentStateName;this.deferredTransitionCreators.push(()=>{this.states.has(currentStateName)||this.defineState(currentStateName);});}states=new Map;editable=true;deferredTransitionCreators=[];history=[];guardEditable(){if(!this.editable)throw new Error("tried to edit state machine after machine has been frozen")}guardNotEditable(){if(this.editable)throw new Error("tried to do transition before machine has been frozen")}defineState(name,cbs={onEnter:[],onLeave:[],transitions:new Map}){if(this.guardEditable(),this.states.has(name))throw new Error(`attempt to redefine state ${name}, please edit it instead`);return this.states.set(name,{onEnter:cbs.onEnter,onLeave:cbs.onLeave,transitions:cbs.transitions}),this}defineTransition(from,event,to,cb){this.guardEditable();let state=this.states.get(from);if(state.transitions.has(event))throw new Error(`attempt to redefine transition ${from} --${event}--> *, please only create transitions once`);let onTransition=[];return cb&&onTransition.push(cb),state.transitions.set(event,{destination:to,onTransition}),this}defineUniversalTransition(event,to){return this.guardEditable(),this.deferredTransitionCreators.push(()=>{for(let[stateName,state]of this.states.entries())state.transitions.has(event)||this.defineTransition(stateName,event,to);}),this}freeze(){this.guardEditable();for(let cb of this.deferredTransitionCreators)cb();let problems=[];for(let[stateName,state]of this.states.entries())for(let[transitionName,transition]of state.transitions.entries())this.states.has(transition.destination)||problems.push(`transition ${stateName} --${transitionName}--> ${transition.destination} has an invalid destination`);if(problems.length)throw new Error(`Consistency problems in state machine: ${problems.join(";")}`);this.editable=false;}doTransition(event,...args){this.guardNotEditable();let from=this.currentStateName,transition=this.states.get(this.currentStateName).transitions.get(event);if(!transition)throw new Error(`undefined transition: ${this.currentStateName} -> ${event} -> ?`);this.history.push({from,event,to:transition.destination,time:Date.now()}),this.history.length>20&&this.history.shift();for(let cb of this.states.get(this.currentStateName).onLeave)try{cb(event);}catch(e){throw this.debug(),new Error(`onLeave callback for state ${from} (during transition ${from} --${event}--> ${transition.destination})`,{cause:e})}this.currentStateName=transition.destination;for(let cb of transition.onTransition??[])try{cb(...args);}catch(e){throw this.debug(),new Error(`onTransition callback during ${from} --${event}--> ${transition.destination}`,{cause:e})}this.emit("enter",this.currentStateName);for(let cb of this.states.get(this.currentStateName).onEnter)try{cb(event);}catch(e){throw this.debug(),new Error(`onEnter callback for state ${from} (during transition ${this.currentStateName} --${event}--> ${transition.destination})`,{cause:e})}}doTransitionLater(event,delayMs,...args){this.guardNotEditable();let timer=setTimeout(()=>{this.doTransition(event,...args);},delayMs);this.once("enter",()=>{clearTimeout(timer);});}debug(){console.table(this.history.map(h=>({At:new Date(h.time),"From -->":h.from,"-- Event -->":h.event,"--> To":h.to})).concat({At:new Date,"From -->":this.currentStateName,"-- Event -->":"(debug)","--> To":""}));}};module.exports=StateMachine;}});var require_Constants=__commonJS({"src/Constants.ts"(exports,module){var Constants3={REST_API_VERSION:10,GET_CHANNEL_MESSAGES_MIN_RESULTS:1,GET_CHANNEL_MESSAGES_MAX_RESULTS:100,GET_GUILD_SCHEDULED_EVENT_USERS_MIN_RESULTS:1,GET_GUILD_SCHEDULED_EVENT_USERS_MAX_RESULTS:100,SEARCH_MEMBERS_MIN_RESULTS:1,SEARCH_MEMBERS_MAX_RESULTS:1e3,BULK_DELETE_MESSAGES_MIN:2,BULK_DELETE_MESSAGES_MAX:100,OK_STATUS_CODES:new Set([200,201,204,304]),DO_NOT_RETRY_STATUS_CODES:new Set([401,403,404,405,411,413]),DEFAULT_RETRY_LIMIT:3,GLOBAL_REQUESTS_PER_SECOND:50,async standardMultipartHandler(data){let form=new FormData;if(data.files&&Array.isArray(data.files)&&data.files.every(f=>!!f.name&&!!f.file)){let index=0;for(let file of data.files)await Constants3.standardAddToFormHandler(form,`files[${index}]`,file.file,file.name),delete file.file,index++;}return data.data&&delete data.files,form.append("payload_json",JSON.stringify(data)),form},async standardAddToFormHandler(form,name,value,filename){if(value instanceof Buffer||typeof value=="string")form.append(name,new buffer.Blob([value]),filename);else if(value instanceof buffer.Blob||value instanceof buffer.File)form.append(name,value,filename);else if(value instanceof stream.Readable||value instanceof web.ReadableStream){let blob=await new Response(value instanceof web.ReadableStream?value:stream.Readable.toWeb(value)).blob();form.set(name,blob,filename);}else throw new Error(`Don't know how to add ${value?.constructor?.name??typeof value} to form`)},reasonHeader(reason){return reason?{"X-Audit-Log-Reason":reason}:{}}};module.exports=Constants3;}});var require_Endpoints=__commonJS({"src/Endpoints.ts"(exports,module){var Constants3=require_Constants(),Endpoints3={BASE_URL:"/api/v"+Constants3.REST_API_VERSION,BASE_HOST:"https://discord.com",CDN_URL:"https://cdn.discordapp.com",APPLICATION_COMMAND:(appId,cmdId)=>`${Endpoints3.APPLICATION_COMMANDS(appId)}/${cmdId}`,APPLICATION_COMMANDS:appId=>`/applications/${appId}/commands`,APPLICATION_EMOJI:(appId,emojiId)=>`${Endpoints3.APPLICATION_EMOJIS(appId)}/${emojiId}`,APPLICATION_EMOJIS:appId=>`/applications/${appId}/emojis`,APPLICATION_ENTITLEMENT:(appId,entitlementId)=>`${Endpoints3.APPLICATION_ENTITLEMENTS(appId)}/${entitlementId}`,APPLICATION_ENTITLEMENT_CONSUME:(appId,entitlementId)=>`${Endpoints3.APPLICATION_ENTITLEMENT(appId,entitlementId)}/consume`,APPLICATION_ENTITLEMENTS:appId=>`/applications/${appId}/entitlements`,APPLICATION_GUILD_COMMANDS_PERMISSIONS:(appId,guildId)=>`${Endpoints3.APPLICATION_GUILD_COMMANDS(appId,guildId)}/permissions`,APPLICATION_GUILD_COMMAND_PERMISSIONS:(appId,guildId,cmdId)=>`${Endpoints3.APPLICATION_GUILD_COMMAND(appId,guildId,cmdId)}/permissions`,APPLICATION_GUILD_COMMAND:(appId,guildId,cmdId)=>`${Endpoints3.APPLICATION_GUILD_COMMANDS(appId,guildId)}/${cmdId}`,APPLICATION_GUILD_COMMANDS:(appId,guildId)=>`/applications/${appId}/guilds/${guildId}/commands`,APPLICATION_SKUS:appId=>`/applications/${appId}/skus`,ATTACHMENTS_REFRESH_URLS:"/attachments/refresh-urls",CHANNEL:chanId=>`${Endpoints3.CHANNELS}/${chanId}`,CHANNEL_ATTACHMENTS:chanId=>`${Endpoints3.CHANNEL(chanId)}/attachments`,CHANNEL_BULK_DELETE:chanId=>`${Endpoints3.CHANNEL_MESSAGES(chanId)}/bulk-delete`,CHANNEL_FOLLOWERS:chanId=>`${Endpoints3.CHANNEL(chanId)}/followers`,CHANNEL_INVITES:chanId=>`${Endpoints3.CHANNEL(chanId)}/invites`,CHANNEL_MESSAGE:(chanId,msgId)=>`${Endpoints3.CHANNEL_MESSAGES(chanId)}/${msgId}`,CHANNEL_MESSAGE_CROSSPOST:(chanId,msgId)=>`${Endpoints3.CHANNEL_MESSAGE(chanId,msgId)}/crosspost`,CHANNEL_MESSAGE_REACTION:(chanId,msgId,reaction)=>`${Endpoints3.CHANNEL_MESSAGE_REACTIONS(chanId,msgId)}/${reaction}`,CHANNEL_MESSAGE_REACTION_USER:(chanId,msgId,reaction,userId)=>`${Endpoints3.CHANNEL_MESSAGE_REACTION(chanId,msgId,reaction)}/${userId}`,CHANNEL_MESSAGE_REACTIONS:(chanId,msgId)=>`${Endpoints3.CHANNEL_MESSAGE(chanId,msgId)}/reactions`,CHANNEL_MESSAGE_THREADS:(chanId,msgId)=>`${Endpoints3.CHANNEL_MESSAGE(chanId,msgId)}/threads`,CHANNEL_MESSAGES:chanId=>`${Endpoints3.CHANNEL(chanId)}/messages`,CHANNEL_PERMISSION:(chanId,permId)=>`${Endpoints3.CHANNEL_PERMISSIONS(chanId)}/${permId}`,CHANNEL_PERMISSIONS:chanId=>`${Endpoints3.CHANNEL(chanId)}/permissions`,CHANNEL_PIN:(chanId,msgId)=>`${Endpoints3.CHANNEL_PINS(chanId)}/${msgId}`,CHANNEL_PINS:chanId=>`${Endpoints3.CHANNEL(chanId)}/messages/pins`,CHANNEL_RECIPIENT:(chanId,userId)=>`${Endpoints3.CHANNEL(chanId)}/recipients/${userId}`,CHANNEL_THREADS:chanId=>`${Endpoints3.CHANNEL(chanId)}/threads`,CHANNEL_THREAD_MEMBER:(chanId,memberId)=>`${Endpoints3.CHANNEL_THREAD_MEMBERS(chanId)}/${memberId}`,CHANNEL_THREAD_MEMBERS:chanId=>`${Endpoints3.CHANNEL(chanId)}/thread-members`,CHANNEL_THREADS_ARCHIVED_PRIVATE:chanId=>`${Endpoints3.CHANNEL_THREADS(chanId)}/archived/private`,CHANNEL_THREADS_ARCHIVED_PRIVATE_USER:chanId=>`${Endpoints3.CHANNEL(chanId)}/users/@me/threads/archived/private`,CHANNEL_THREADS_ARCHIVED_PUBLIC:chanId=>`${Endpoints3.CHANNEL_THREADS(chanId)}/archived/public`,CHANNEL_TYPING:chanId=>`${Endpoints3.CHANNEL(chanId)}/typing`,CHANNEL_VOICE_STATUS:chanId=>`${Endpoints3.CHANNEL(chanId)}/voice-status`,CHANNEL_WEBHOOKS:chanId=>`${Endpoints3.CHANNEL(chanId)}/webhooks`,CHANNELS:"/channels",GATEWAY:"/gateway",GATEWAY_BOT:"/gateway/bot",GUILD:guildId=>`${Endpoints3.GUILDS}/${guildId}`,GUILD_AUDIT_LOGS:guildId=>`${Endpoints3.GUILD(guildId)}/audit-logs`,GUILD_AUTO_MOD_RULE:(guildId,ruleId)=>`${Endpoints3.GUILD_AUTO_MOD_RULES(guildId)}/${ruleId}`,GUILD_AUTO_MOD_RULES:guildId=>`${Endpoints3.GUILD(guildId)}/auto-moderation/rules`,GUILD_BAN:(guildId,memberId)=>`${Endpoints3.GUILD_BANS(guildId)}/${memberId}`,GUILD_BANS:guildId=>`${Endpoints3.GUILD(guildId)}/bans`,GUILD_CHANNELS:guildId=>`${Endpoints3.GUILD(guildId)}/channels`,GUILD_EMOJI:(guildId,emojiId)=>`${Endpoints3.GUILD_EMOJIS(guildId)}/${emojiId}`,GUILD_EMOJIS:guildId=>`${Endpoints3.GUILD(guildId)}/emojis`,GUILD_INVITES:guildId=>`${Endpoints3.GUILD(guildId)}/invites`,GUILD_INTEGRATION:(guildId,integrationId)=>`${Endpoints3.GUILD_INTEGRATIONS(guildId)}/${integrationId}`,GUILD_INTEGRATIONS:guildId=>`${Endpoints3.GUILD(guildId)}/integrations`,GUILD_MEMBER:(guildId,memberId)=>`${Endpoints3.GUILD_MEMBERS(guildId)}/${memberId}`,GUILD_MEMBER_ROLE:(guildId,memberId,roleId)=>`${Endpoints3.GUILD_MEMBER(guildId,memberId)}/roles/${roleId}`,GUILD_MEMBERS:guildId=>`${Endpoints3.GUILD(guildId)}/members`,GUILD_MEMBERS_SEARCH:guildId=>`${Endpoints3.GUILD_MEMBERS(guildId)}/search`,GUILD_PREVIEW:guildId=>`${Endpoints3.GUILD(guildId)}/preview`,GUILD_PRUNE:guildId=>`${Endpoints3.GUILD(guildId)}/prune`,GUILD_ROLE:(guildId,roleId)=>`${Endpoints3.GUILD_ROLES(guildId)}/${roleId}`,GUILD_ROLES:guildId=>`${Endpoints3.GUILD(guildId)}/roles`,GUILD_SCHEDULED_EVENTS:guildId=>`${Endpoints3.GUILD(guildId)}/scheduled-events`,GUILD_SCHEDULED_EVENT:(guildId,eventId)=>`${Endpoints3.GUILD_SCHEDULED_EVENTS(guildId)}/${eventId}`,GUILD_SCHEDULED_EVENT_USERS:(guildId,eventId)=>`${Endpoints3.GUILD_SCHEDULED_EVENT(guildId,eventId)}/users`,GUILD_STICKER:(guildId,stickerId)=>`${Endpoints3.GUILD_STICKERS(guildId)}/${stickerId}`,GUILD_STICKERS:guildId=>`${Endpoints3.GUILD(guildId)}/stickers`,GUILD_TEMPLATE:(guildId,code)=>`${Endpoints3.GUILD_TEMPLATES(guildId)}/${code}`,GUILD_THREADS_ACTIVE:guildId=>`${Endpoints3.GUILD(guildId)}/threads/active`,GUILD_TEMPLATES:guildId=>`${Endpoints3.GUILD(guildId)}/templates`,GUILD_VANITY:guildId=>`${Endpoints3.GUILD(guildId)}/vanity-url`,GUILD_VOICE_REGIONS:guildId=>`${Endpoints3.GUILD(guildId)}/regions`,GUILD_VOICE_STATE_USER:(guildId,memberId)=>`${Endpoints3.GUILD(guildId)}/voice-states/${memberId}`,GUILD_WEBHOOKS:guildId=>`${Endpoints3.GUILD(guildId)}/webhooks`,GUILD_WELCOME_SCREEN:guildId=>`${Endpoints3.GUILD(guildId)}/welcome-screen`,GUILD_WIDGET:guildId=>`${Endpoints3.GUILD(guildId)}/widget.json`,GUILD_WIDGET_SETTINGS:guildId=>`${Endpoints3.GUILD(guildId)}/widget`,GUILDS:"/guilds",INTERACTION_CALLBACK:(interactionId,token)=>`/interactions/${interactionId}/${token}/callback`,INVITES:inviteId=>`/invites/${inviteId}`,INVITE_TARGET_USERS:inviteId=>`${Endpoints3.INVITES(inviteId)}/target-users`,INVITE_TARGET_USERS_JOB_STATUS:inviteId=>`${Endpoints3.INVITE_TARGET_USERS(inviteId)}/job-status`,OAUTH2_APPLICATION:appId=>`/oauth2/applications/${appId}`,OAUTH2_TOKEN:"/api/oauth2/token",POLL_ANSWER:(chanId,msgId,answerId)=>`${Endpoints3.CHANNEL(chanId)}/polls/${msgId}/answers/${answerId}`,POLL_EXPIRE:(chanId,msgId)=>`${Endpoints3.CHANNEL(chanId)}/polls/${msgId}/expire`,SKU_SUBSCRIPTIONS:skuId=>`/skus/${skuId}/subscriptions`,SKU_SUBSCRIPTION:(skuId,subscriptionId)=>`${Endpoints3.SKU_SUBSCRIPTIONS(skuId)}/${subscriptionId}`,STAGE_INSTANCE_CHANNEL:chanId=>`${Endpoints3.STAGE_INSTANCES}/${chanId}`,STAGE_INSTANCES:"/stage-instances",STICKER:stickerId=>`/stickers/${stickerId}`,TEMPLATE:code=>`/guilds/templates/${code}`,USER:userId=>`${Endpoints3.USERS}/${userId}`,USER_APPLICATION_ROLE_CONNECTION:(userId,appId)=>`${Endpoints3.USER(userId)}/applications/${appId}/role-connection`,USER_CHANNELS:userId=>`${Endpoints3.USER(userId)}/channels`,USER_CONNECTIONS:userId=>`${Endpoints3.USER(userId)}/connections`,USER_GUILD:(userId,guildId)=>`${Endpoints3.USER_GUILDS(userId)}/${guildId}`,USER_GUILDS:userId=>`${Endpoints3.USER(userId)}/guilds`,USER_GUILD_VOICE_STATE:(guildId,userId)=>`${Endpoints3.GUILD(guildId)}/voice-states/${userId}`,USERS:"/users",VOICE_REGIONS:"/voice/regions",WEBHOOK:hookId=>`/webhooks/${hookId}`,WEBHOOK_TOKEN:(hookId,token)=>`${Endpoints3.WEBHOOK(hookId)}/${token}`,WEBHOOK_TOKEN_GITHUB:(hookId,token)=>`${Endpoints3.WEBHOOK_TOKEN(hookId,token)}/github`,WEBHOOK_TOKEN_MESSAGE:(hookId,token,msgId)=>`/webhooks/${hookId}/${token}/messages/${msgId}`,WEBHOOK_TOKEN_SLACK:(hookId,token)=>`${Endpoints3.WEBHOOK_TOKEN(hookId,token)}/slack`};module.exports=Endpoints3;}});function appendQuery(query){let count=0;for(let[key,value]of Object.entries(query))value==null?delete query[key]:count++;return count>0?`?${new URLSearchParams(query).toString()}`:""}var fs,path,crypto,util,Endpoints,version,Constants,SM2,routeRegex,reactionsRegex,reactionsUserRegex,webhooksRegex,isMessageEndpointRegex,isGuildChannelsRegex,messagesRegex,disallowedBodyMethods;exports.DiscordAPIError = void 0;exports.IntervalCounter = void 0;exports.LeakyCounter = void 0;exports.Bucket = void 0;exports.Ratelimiter = void 0;exports.RequestHandler = void 0;var init_RequestHandler=__esm({"src/RequestHandler.ts"(){fs=__require("fs"),path=__require("path"),crypto=__require("crypto"),util=__require("util"),Endpoints=require_Endpoints(),{version}=JSON.parse(fs.readFileSync(path.join(__dirname,"../package.json"),{encoding:"utf8"})),Constants=require_Constants(),SM2=require_StateMachine(),routeRegex=/\/([a-z-]+)\/(?:\d+)/g,reactionsRegex=/\/reactions\/[^/]+/g,reactionsUserRegex=/\/reactions\/:id\/[^/]+/g,webhooksRegex=/^\/webhooks\/(\d+)\/[A-Za-z0-9-_]{64,}/,isMessageEndpointRegex=/\/messages\/:id$/,isGuildChannelsRegex=/\/guilds\/\d+\/channels$/,messagesRegex=/\/messages\/\d+$/,disallowedBodyMethods=new Set(["head","get","delete"]),exports.DiscordAPIError=class extends Error{method;path;code;httpStatus;request;response;constructor(error,request,response){super(),this.name="DiscordAPIError",this.message=error.message??util.inspect(error),this.method=request.method,this.path=request.endpoint,this.code=error.code??4e3,this.httpStatus=response.status,Object.defineProperties(this,{request:{enumerable:false,value:request},response:{enumerable:false,value:response}});}},exports.IntervalCounter=class{constructor(limit,reset){this.limit=limit;this.reset=reset;this.remaining=limit;}remaining;firstRequestTime=0;resetAt=null;id=new Array(3).fill(0).map(()=>String.fromCodePoint(Math.floor(Math.random()*26+65))).join("");checkReset(){let now=Date.now();this.resetAt!==null?now>this.resetAt&&(this.firstRequestTime=0,this.remaining=this.limit,this.resetAt=null,globalThis.snowtransferDebugLogging&&console.log(`${new Date().toISOString()} [itrv] [${this.id}] informed reset: ${this.remaining}/${this.limit}`)):now>this.firstRequestTime+this.reset&&(this.firstRequestTime=0,this.remaining=this.limit,globalThis.snowtransferDebugLogging&&console.log(`${new Date().toISOString()} [itrv] [${this.id}] predicted reset: ${this.remaining}/${this.limit}`));}hasReset(){return this.checkReset(),this.remaining===this.limit}canTake(){return this.checkReset(),this.remaining>0}take(){this.checkReset(),this.remaining===this.limit&&(this.firstRequestTime=Date.now());let ok=this.remaining>0;return this.remaining--,ok}timeUntilReset(){let now=Date.now();return this.resetAt?Math.max(this.resetAt-now+1,0):Math.max(this.firstRequestTime+this.reset-Date.now()+1,0)}responseReceived(){this.remaining===this.limit-1&&this.firstRequestTime&&(this.firstRequestTime=Date.now());}applyCount(limit,remaining,resetAfter){limit!=null&&(this.limit=limit),this.remaining=remaining,this.resetAt=Date.now()+resetAfter;}},exports.LeakyCounter=class{constructor(limit){this.limit=limit;this.remaining=limit;}remaining;resetAt=null;id=new Array(3).fill(0).map(()=>String.fromCodePoint(Math.floor(Math.random()*26+65))).join("");checkReset(){let now=Date.now();this.resetAt&&now>this.resetAt&&(this.remaining=Math.min(this.limit,this.remaining+1),this.resetAt=null,globalThis.snowtransferDebugLogging&&console.log(`${new Date().toISOString()} [leak] [${this.id}] restore one: ${this.remaining}/${this.limit}`));}hasReset(){return this.checkReset(),this.remaining===this.limit}canTake(){return this.checkReset(),this.remaining>0}take(){return this.checkReset(),globalThis.snowtransferDebugLogging&&console.log(`${new Date().toISOString()} [leak] [${this.id}] took: ${this.remaining-1} left`),this.remaining-- >0}timeUntilReset(){let now=Date.now();return this.resetAt?Math.max(this.resetAt-now+1,0):0}responseReceived(){}applyCount(limit,remaining,resetAfter){limit!=null&&(this.limit=limit),this.remaining=remaining,this.resetAt=Date.now()+resetAfter,globalThis.snowtransferDebugLogging&&console.log(`${new Date().toISOString()} [leak] [${this.id}] applied: ${remaining}/${limit} - wait another ${resetAfter}`);}},exports.Bucket=class{sm=new SM2("ready");calls=[];counters=[];pauseRequested=false;constructor(counters){this.counters=counters,this.sm.defineState("ready",{onEnter:[],onLeave:[],transitions:new Map([["enqueue",{destination:"check"}],["pause",{destination:"paused"}]])}),this.sm.defineState("check",{onEnter:[()=>this.pauseRequested?this.sm.doTransition("pause"):this.counters.every(c=>c.canTake())?this.calls.length?this.sm.doTransition("run"):this.sm.doTransition("empty"):this.sm.doTransition("cooldown")],onLeave:[],transitions:new Map([["pause",{destination:"paused"}],["cooldown",{destination:"cooldown"}],["run",{destination:"running"}],["empty",{destination:"ready"}]])}),this.sm.defineState("running",{onEnter:[()=>{this.counters.forEach(c=>c.take()),this.calls.shift()().then(()=>{this.sm.doTransition("complete");});}],onLeave:[],transitions:new Map([["complete",{destination:"check"}]])}),this.sm.defineState("cooldown",{onEnter:[()=>{this.sm.doTransitionLater("reset",Math.max(...this.counters.map(c=>c.timeUntilReset())));}],onLeave:[],transitions:new Map([["reset",{destination:"check"}]])}),this.sm.defineState("paused",{onEnter:[],onLeave:[()=>{this.pauseRequested=false;}],transitions:new Map([["resume",{destination:"check"}]])}),this.sm.freeze();}enqueue(fn){return new Promise((resolve,reject)=>{this.calls.push(()=>fn(this).then(resolve).catch(reject)),this.sm.currentStateName==="ready"&&this.sm.doTransition("enqueue");})}pause(){this.pauseRequested=true,this.sm.currentStateName==="ready"&&this.sm.doTransition("pause");}resume(){this.pauseRequested=false,this.sm.currentStateName==="paused"&&this.sm.doTransition("resume");}dropQueue(){this.calls.length=0;}},exports.Ratelimiter=class{buckets=new Map;globalBucket=new exports.Bucket([new exports.IntervalCounter(Constants.GLOBAL_REQUESTS_PER_SECOND,1e3)]);get global(){return !this.globalBucket.counters[0].canTake()}constructor(){setInterval(()=>{for(let[key,value]of this.buckets.entries())value.counters[0].hasReset()&&this.buckets.delete(key);},3600*1e3).unref();}routify(url,method){let route=url.replaceAll(routeRegex,function(match,p){return p==="channels"||p==="guilds"||p==="webhooks"?match:`/${p}/:id`}).replaceAll(reactionsRegex,"/reactions/:id").replaceAll(reactionsUserRegex,"/reactions/:id/:userId").replace(webhooksRegex,"/webhooks/$1/:token");if(method==="DELETE"&&isMessageEndpointRegex.test(route)?route=method+route:method==="GET"&&isGuildChannelsRegex.test(route)&&(route="/guilds/:id/channels"),method==="PUT"||method==="DELETE"){let index=route.indexOf("/reactions");index!==-1&&(route="MODIFY"+route.slice(0,index+10));}return route}queue(fn,url,method){let routeKey=this.routify(url,method),bucket=this.buckets.get(routeKey);return bucket||(method==="DELETE"&&messagesRegex.test(url)?bucket=new exports.Bucket([new exports.LeakyCounter(1),new exports.IntervalCounter(5,5e3),this.globalBucket.counters[0]]):bucket=new exports.Bucket([new exports.LeakyCounter(1),this.globalBucket.counters[0]]),this.buckets.set(routeKey,bucket)),bucket.enqueue(fn)}setGlobal(ms){this.globalBucket.counters[0].applyCount(Constants.GLOBAL_REQUESTS_PER_SECOND,0,ms);}},exports.RequestHandler=class extends events.EventEmitter{constructor(ratelimiter,options){super();this.ratelimiter=ratelimiter;this.options={baseHost:options?.baseHost??Endpoints.BASE_HOST,baseURL:options?.baseURL??Endpoints.BASE_URL,bypassBuckets:options?.bypassBuckets??false,retryFailed:options?.retryFailed??false,retryLimit:options?.retryLimit??Constants.DEFAULT_RETRY_LIMIT,headers:{"User-Agent":`Discordbot (https://github.com/DasWolke/SnowTransfer, ${version}) Node.js/${process.version}`},fetch:options?.fetch??fetch},options?.token&&(this.options.headers.Authorization=options.token),this.apiURL=this.options.baseHost+Endpoints.BASE_URL,this.latency=500;}options;latency;apiURL;request(endpoint,params={},method,dataType,data,extraHeaders,retries=this.options.retryLimit,rawResponse=false){let stack=new Error().stack;return new Promise(async(resolve,reject)=>{let fn=async bkt=>{let reqId=crypto.randomBytes(20).toString("hex");try{let request={endpoint,method:method.toUpperCase(),dataType,data:data??{}};this.emit("request",reqId,request);let before=Date.now(),response;switch(dataType){case "json":response=await this._request(endpoint,params,method,data,extraHeaders);break;case "multipart":if(!data)throw new Error("No multipart data");response=await this._multiPartRequest(endpoint,params,method,data,extraHeaders);break;default:throw new Error("Forbidden dataType. Use json or multipart or ensure multipart has FormData")}if(this.latency=Date.now()-before,bkt?.counters.forEach(c=>c.responseReceived()),bkt&&this._applyRatelimitHeaders(bkt,response.headers),response.status&&!Constants.OK_STATUS_CODES.has(response.status)){if(this.options.retryFailed&&!Constants.DO_NOT_RETRY_STATUS_CODES.has(response.status)&&retries!==0)return this.request(endpoint,params,method,dataType,data,extraHeaders,response.status===429?0:retries--).then(resolve).catch(reject);if(response.status!==429)throw new exports.DiscordAPIError({message:await response.text()},request,response)}if(response.status===429){let b=await response.json();throw b.global&&this.ratelimiter.setGlobal(b.retry_after*1e3),globalThis.snowtransferDebugLogging&&console.log(`${new Date().toISOString()} [rate] [${bkt?.counters[0].id}] !! 429 - guess there was 0 remaining, wait another ${b.retry_after*1e3} (route: ${this.ratelimiter.routify(endpoint,method.toUpperCase())})`),this.emit("rateLimit",{method:method.toUpperCase(),path:endpoint,route:this.ratelimiter.routify(endpoint,method.toUpperCase())}),new exports.DiscordAPIError({message:b.message,code:b.code??429},request,response)}if(this.emit("done",reqId,response,request),rawResponse)return resolve(response);if(response.body){let b;try{b=await response.json();}catch{return resolve(void 0)}return resolve(b)}else return resolve(void 0)}catch(error){return error?.stack&&(error.stack=error.stack+`
9
+ var __getOwnPropNames=Object.getOwnPropertyNames;var __require=(x=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(x,{get:(a,b)=>(typeof require<"u"?require:a)[b]}):x)(function(x){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+x+'" is not supported')});var __esm=(fn,res)=>function(){return fn&&(res=(0, fn[__getOwnPropNames(fn)[0]])(fn=0)),res};var __commonJS=(cb,mod)=>function(){return mod||(0, cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports};var require_StateMachine=__commonJS({"src/StateMachine.ts"(exports,module){var EventEmitter2=__require("events"),StateMachine=class extends EventEmitter2{constructor(currentStateName){super();this.currentStateName=currentStateName;this.deferredTransitionCreators.push(()=>{this.states.has(currentStateName)||this.defineState(currentStateName);});}states=new Map;editable=true;deferredTransitionCreators=[];history=[];guardEditable(){if(!this.editable)throw new Error("tried to edit state machine after machine has been frozen")}guardNotEditable(){if(this.editable)throw new Error("tried to do transition before machine has been frozen")}defineState(name,cbs={onEnter:[],onLeave:[],transitions:new Map}){if(this.guardEditable(),this.states.has(name))throw new Error(`attempt to redefine state ${name}, please edit it instead`);return this.states.set(name,{onEnter:cbs.onEnter,onLeave:cbs.onLeave,transitions:cbs.transitions}),this}defineTransition(from,event,to,cb){this.guardEditable();let state=this.states.get(from);if(state.transitions.has(event))throw new Error(`attempt to redefine transition ${from} --${event}--> *, please only create transitions once`);let onTransition=[];return cb&&onTransition.push(cb),state.transitions.set(event,{destination:to,onTransition}),this}defineUniversalTransition(event,to){return this.guardEditable(),this.deferredTransitionCreators.push(()=>{for(let[stateName,state]of this.states.entries())state.transitions.has(event)||this.defineTransition(stateName,event,to);}),this}freeze(){this.guardEditable();for(let cb of this.deferredTransitionCreators)cb();let problems=[];for(let[stateName,state]of this.states.entries())for(let[transitionName,transition]of state.transitions.entries())this.states.has(transition.destination)||problems.push(`transition ${stateName} --${transitionName}--> ${transition.destination} has an invalid destination`);if(problems.length)throw new Error(`Consistency problems in state machine: ${problems.join(";")}`);this.editable=false;}doTransition(event,...args){this.guardNotEditable();let from=this.currentStateName,transition=this.states.get(this.currentStateName).transitions.get(event);if(!transition)throw new Error(`undefined transition: ${this.currentStateName} -> ${event} -> ?`);this.history.push({from,event,to:transition.destination,time:Date.now()}),this.history.length>20&&this.history.shift();for(let cb of this.states.get(this.currentStateName).onLeave)try{cb(event);}catch(e){throw this.debug(),new Error(`onLeave callback for state ${from} (during transition ${from} --${event}--> ${transition.destination})`,{cause:e})}this.currentStateName=transition.destination;for(let cb of transition.onTransition??[])try{cb(...args);}catch(e){throw this.debug(),new Error(`onTransition callback during ${from} --${event}--> ${transition.destination}`,{cause:e})}this.emit("enter",this.currentStateName);for(let cb of this.states.get(this.currentStateName).onEnter)try{cb(event);}catch(e){throw this.debug(),new Error(`onEnter callback for state ${from} (during transition ${this.currentStateName} --${event}--> ${transition.destination})`,{cause:e})}}doTransitionLater(event,delayMs,...args){this.guardNotEditable();let timer=setTimeout(()=>{this.doTransition(event,...args);},delayMs);this.once("enter",()=>{clearTimeout(timer);});}debug(){console.table(this.history.map(h=>({At:new Date(h.time),"From -->":h.from,"-- Event -->":h.event,"--> To":h.to})).concat({At:new Date,"From -->":this.currentStateName,"-- Event -->":"(debug)","--> To":""}));}};module.exports=StateMachine;}});var require_Constants=__commonJS({"src/Constants.ts"(exports,module){var Constants3={REST_API_VERSION:10,GET_CHANNEL_MESSAGES_MIN_RESULTS:1,GET_CHANNEL_MESSAGES_MAX_RESULTS:100,GET_GUILD_SCHEDULED_EVENT_USERS_MIN_RESULTS:1,GET_GUILD_SCHEDULED_EVENT_USERS_MAX_RESULTS:100,SEARCH_MEMBERS_MIN_RESULTS:1,SEARCH_MEMBERS_MAX_RESULTS:1e3,BULK_DELETE_MESSAGES_MIN:2,BULK_DELETE_MESSAGES_MAX:100,OK_STATUS_CODES:new Set([200,201,204,304]),DO_NOT_RETRY_STATUS_CODES:new Set([401,403,404,405,411,413]),DEFAULT_RETRY_LIMIT:3,GLOBAL_REQUESTS_PER_SECOND:50,async standardMultipartHandler(data){let form=new FormData;if(data.files&&Array.isArray(data.files)&&data.files.every(f=>!!f.name&&!!f.file)){let index=0;for(let file of data.files)await Constants3.standardAddToFormHandler(form,`files[${index}]`,file.file,file.name),delete file.file,index++;}return data.data&&delete data.files,form.append("payload_json",JSON.stringify(data)),form},async standardAddToFormHandler(form,name,value,filename){if(value instanceof Buffer||typeof value=="string")form.append(name,new buffer.Blob([value]),filename);else if(value instanceof buffer.Blob||value instanceof buffer.File)form.append(name,value,filename);else if(value instanceof stream.Readable||value instanceof web.ReadableStream){let blob=await new Response(value instanceof web.ReadableStream?value:stream.Readable.toWeb(value)).blob();form.set(name,blob,filename);}else throw new Error(`Don't know how to add ${value?.constructor?.name??typeof value} to form`)},reasonHeader(reason){return reason?{"X-Audit-Log-Reason":reason}:{}}};module.exports=Constants3;}});var require_Endpoints=__commonJS({"src/Endpoints.ts"(exports,module){var Constants3=require_Constants(),Endpoints3={BASE_URL:"/api/v"+Constants3.REST_API_VERSION,BASE_HOST:"https://discord.com",CDN_URL:"https://cdn.discordapp.com",APPLICATION_COMMAND:(appId,cmdId)=>`${Endpoints3.APPLICATION_COMMANDS(appId)}/${cmdId}`,APPLICATION_COMMANDS:appId=>`/applications/${appId}/commands`,APPLICATION_EMOJI:(appId,emojiId)=>`${Endpoints3.APPLICATION_EMOJIS(appId)}/${emojiId}`,APPLICATION_EMOJIS:appId=>`/applications/${appId}/emojis`,APPLICATION_ENTITLEMENT:(appId,entitlementId)=>`${Endpoints3.APPLICATION_ENTITLEMENTS(appId)}/${entitlementId}`,APPLICATION_ENTITLEMENT_CONSUME:(appId,entitlementId)=>`${Endpoints3.APPLICATION_ENTITLEMENT(appId,entitlementId)}/consume`,APPLICATION_ENTITLEMENTS:appId=>`/applications/${appId}/entitlements`,APPLICATION_GUILD_COMMANDS_PERMISSIONS:(appId,guildId)=>`${Endpoints3.APPLICATION_GUILD_COMMANDS(appId,guildId)}/permissions`,APPLICATION_GUILD_COMMAND_PERMISSIONS:(appId,guildId,cmdId)=>`${Endpoints3.APPLICATION_GUILD_COMMAND(appId,guildId,cmdId)}/permissions`,APPLICATION_GUILD_COMMAND:(appId,guildId,cmdId)=>`${Endpoints3.APPLICATION_GUILD_COMMANDS(appId,guildId)}/${cmdId}`,APPLICATION_GUILD_COMMANDS:(appId,guildId)=>`/applications/${appId}/guilds/${guildId}/commands`,APPLICATION_SKUS:appId=>`/applications/${appId}/skus`,ATTACHMENTS_REFRESH_URLS:"/attachments/refresh-urls",CHANNEL:chanId=>`${Endpoints3.CHANNELS}/${chanId}`,CHANNEL_ATTACHMENTS:chanId=>`${Endpoints3.CHANNEL(chanId)}/attachments`,CHANNEL_BULK_DELETE:chanId=>`${Endpoints3.CHANNEL_MESSAGES(chanId)}/bulk-delete`,CHANNEL_FOLLOWERS:chanId=>`${Endpoints3.CHANNEL(chanId)}/followers`,CHANNEL_INVITES:chanId=>`${Endpoints3.CHANNEL(chanId)}/invites`,CHANNEL_MESSAGE:(chanId,msgId)=>`${Endpoints3.CHANNEL_MESSAGES(chanId)}/${msgId}`,CHANNEL_MESSAGE_CROSSPOST:(chanId,msgId)=>`${Endpoints3.CHANNEL_MESSAGE(chanId,msgId)}/crosspost`,CHANNEL_MESSAGE_REACTION:(chanId,msgId,reaction)=>`${Endpoints3.CHANNEL_MESSAGE_REACTIONS(chanId,msgId)}/${reaction}`,CHANNEL_MESSAGE_REACTION_USER:(chanId,msgId,reaction,userId)=>`${Endpoints3.CHANNEL_MESSAGE_REACTION(chanId,msgId,reaction)}/${userId}`,CHANNEL_MESSAGE_REACTIONS:(chanId,msgId)=>`${Endpoints3.CHANNEL_MESSAGE(chanId,msgId)}/reactions`,CHANNEL_MESSAGE_THREADS:(chanId,msgId)=>`${Endpoints3.CHANNEL_MESSAGE(chanId,msgId)}/threads`,CHANNEL_MESSAGES:chanId=>`${Endpoints3.CHANNEL(chanId)}/messages`,CHANNEL_PERMISSION:(chanId,permId)=>`${Endpoints3.CHANNEL_PERMISSIONS(chanId)}/${permId}`,CHANNEL_PERMISSIONS:chanId=>`${Endpoints3.CHANNEL(chanId)}/permissions`,CHANNEL_PIN:(chanId,msgId)=>`${Endpoints3.CHANNEL_PINS(chanId)}/${msgId}`,CHANNEL_PINS:chanId=>`${Endpoints3.CHANNEL(chanId)}/messages/pins`,CHANNEL_RECIPIENT:(chanId,userId)=>`${Endpoints3.CHANNEL(chanId)}/recipients/${userId}`,CHANNEL_THREADS:chanId=>`${Endpoints3.CHANNEL(chanId)}/threads`,CHANNEL_THREAD_MEMBER:(chanId,memberId)=>`${Endpoints3.CHANNEL_THREAD_MEMBERS(chanId)}/${memberId}`,CHANNEL_THREAD_MEMBERS:chanId=>`${Endpoints3.CHANNEL(chanId)}/thread-members`,CHANNEL_THREADS_ARCHIVED_PRIVATE:chanId=>`${Endpoints3.CHANNEL_THREADS(chanId)}/archived/private`,CHANNEL_THREADS_ARCHIVED_PRIVATE_USER:chanId=>`${Endpoints3.CHANNEL(chanId)}/users/@me/threads/archived/private`,CHANNEL_THREADS_ARCHIVED_PUBLIC:chanId=>`${Endpoints3.CHANNEL_THREADS(chanId)}/archived/public`,CHANNEL_TYPING:chanId=>`${Endpoints3.CHANNEL(chanId)}/typing`,CHANNEL_VOICE_STATUS:chanId=>`${Endpoints3.CHANNEL(chanId)}/voice-status`,CHANNEL_WEBHOOKS:chanId=>`${Endpoints3.CHANNEL(chanId)}/webhooks`,CHANNELS:"/channels",GATEWAY:"/gateway",GATEWAY_BOT:"/gateway/bot",GUILD:guildId=>`${Endpoints3.GUILDS}/${guildId}`,GUILD_AUDIT_LOGS:guildId=>`${Endpoints3.GUILD(guildId)}/audit-logs`,GUILD_AUTO_MOD_RULE:(guildId,ruleId)=>`${Endpoints3.GUILD_AUTO_MOD_RULES(guildId)}/${ruleId}`,GUILD_AUTO_MOD_RULES:guildId=>`${Endpoints3.GUILD(guildId)}/auto-moderation/rules`,GUILD_BAN:(guildId,memberId)=>`${Endpoints3.GUILD_BANS(guildId)}/${memberId}`,GUILD_BANS:guildId=>`${Endpoints3.GUILD(guildId)}/bans`,GUILD_CHANNELS:guildId=>`${Endpoints3.GUILD(guildId)}/channels`,GUILD_EMOJI:(guildId,emojiId)=>`${Endpoints3.GUILD_EMOJIS(guildId)}/${emojiId}`,GUILD_EMOJIS:guildId=>`${Endpoints3.GUILD(guildId)}/emojis`,GUILD_INVITES:guildId=>`${Endpoints3.GUILD(guildId)}/invites`,GUILD_INTEGRATION:(guildId,integrationId)=>`${Endpoints3.GUILD_INTEGRATIONS(guildId)}/${integrationId}`,GUILD_INTEGRATIONS:guildId=>`${Endpoints3.GUILD(guildId)}/integrations`,GUILD_MEMBER:(guildId,memberId)=>`${Endpoints3.GUILD_MEMBERS(guildId)}/${memberId}`,GUILD_MEMBER_ROLE:(guildId,memberId,roleId)=>`${Endpoints3.GUILD_MEMBER(guildId,memberId)}/roles/${roleId}`,GUILD_MEMBERS:guildId=>`${Endpoints3.GUILD(guildId)}/members`,GUILD_MEMBERS_SEARCH:guildId=>`${Endpoints3.GUILD_MEMBERS(guildId)}/search`,GUILD_PREVIEW:guildId=>`${Endpoints3.GUILD(guildId)}/preview`,GUILD_PRUNE:guildId=>`${Endpoints3.GUILD(guildId)}/prune`,GUILD_ROLE:(guildId,roleId)=>`${Endpoints3.GUILD_ROLES(guildId)}/${roleId}`,GUILD_ROLES:guildId=>`${Endpoints3.GUILD(guildId)}/roles`,GUILD_SCHEDULED_EVENTS:guildId=>`${Endpoints3.GUILD(guildId)}/scheduled-events`,GUILD_SCHEDULED_EVENT:(guildId,eventId)=>`${Endpoints3.GUILD_SCHEDULED_EVENTS(guildId)}/${eventId}`,GUILD_SCHEDULED_EVENT_USERS:(guildId,eventId)=>`${Endpoints3.GUILD_SCHEDULED_EVENT(guildId,eventId)}/users`,GUILD_STICKER:(guildId,stickerId)=>`${Endpoints3.GUILD_STICKERS(guildId)}/${stickerId}`,GUILD_STICKERS:guildId=>`${Endpoints3.GUILD(guildId)}/stickers`,GUILD_TEMPLATE:(guildId,code)=>`${Endpoints3.GUILD_TEMPLATES(guildId)}/${code}`,GUILD_THREADS_ACTIVE:guildId=>`${Endpoints3.GUILD(guildId)}/threads/active`,GUILD_TEMPLATES:guildId=>`${Endpoints3.GUILD(guildId)}/templates`,GUILD_VANITY:guildId=>`${Endpoints3.GUILD(guildId)}/vanity-url`,GUILD_VOICE_REGIONS:guildId=>`${Endpoints3.GUILD(guildId)}/regions`,GUILD_VOICE_STATE_USER:(guildId,memberId)=>`${Endpoints3.GUILD(guildId)}/voice-states/${memberId}`,GUILD_WEBHOOKS:guildId=>`${Endpoints3.GUILD(guildId)}/webhooks`,GUILD_WELCOME_SCREEN:guildId=>`${Endpoints3.GUILD(guildId)}/welcome-screen`,GUILD_WIDGET:guildId=>`${Endpoints3.GUILD(guildId)}/widget.json`,GUILD_WIDGET_SETTINGS:guildId=>`${Endpoints3.GUILD(guildId)}/widget`,GUILDS:"/guilds",INTERACTION_CALLBACK:(interactionId,token)=>`/interactions/${interactionId}/${token}/callback`,INVITES:inviteId=>`/invites/${inviteId}`,INVITE_TARGET_USERS:inviteId=>`${Endpoints3.INVITES(inviteId)}/target-users`,INVITE_TARGET_USERS_JOB_STATUS:inviteId=>`${Endpoints3.INVITE_TARGET_USERS(inviteId)}/job-status`,OAUTH2_APPLICATION:appId=>`/oauth2/applications/${appId}`,OAUTH2_TOKEN:"/api/oauth2/token",POLL_ANSWER:(chanId,msgId,answerId)=>`${Endpoints3.CHANNEL(chanId)}/polls/${msgId}/answers/${answerId}`,POLL_EXPIRE:(chanId,msgId)=>`${Endpoints3.CHANNEL(chanId)}/polls/${msgId}/expire`,SKU_SUBSCRIPTIONS:skuId=>`/skus/${skuId}/subscriptions`,SKU_SUBSCRIPTION:(skuId,subscriptionId)=>`${Endpoints3.SKU_SUBSCRIPTIONS(skuId)}/${subscriptionId}`,STAGE_INSTANCE_CHANNEL:chanId=>`${Endpoints3.STAGE_INSTANCES}/${chanId}`,STAGE_INSTANCES:"/stage-instances",STICKER:stickerId=>`/stickers/${stickerId}`,TEMPLATE:code=>`/guilds/templates/${code}`,USER:userId=>`${Endpoints3.USERS}/${userId}`,USER_APPLICATION_ROLE_CONNECTION:(userId,appId)=>`${Endpoints3.USER(userId)}/applications/${appId}/role-connection`,USER_CHANNELS:userId=>`${Endpoints3.USER(userId)}/channels`,USER_CONNECTIONS:userId=>`${Endpoints3.USER(userId)}/connections`,USER_GUILD:(userId,guildId)=>`${Endpoints3.USER_GUILDS(userId)}/${guildId}`,USER_GUILDS:userId=>`${Endpoints3.USER(userId)}/guilds`,USER_GUILD_VOICE_STATE:(guildId,userId)=>`${Endpoints3.GUILD(guildId)}/voice-states/${userId}`,USERS:"/users",VOICE_REGIONS:"/voice/regions",WEBHOOK:hookId=>`/webhooks/${hookId}`,WEBHOOK_TOKEN:(hookId,token)=>`${Endpoints3.WEBHOOK(hookId)}/${token}`,WEBHOOK_TOKEN_GITHUB:(hookId,token)=>`${Endpoints3.WEBHOOK_TOKEN(hookId,token)}/github`,WEBHOOK_TOKEN_MESSAGE:(hookId,token,msgId)=>`/webhooks/${hookId}/${token}/messages/${msgId}`,WEBHOOK_TOKEN_SLACK:(hookId,token)=>`${Endpoints3.WEBHOOK_TOKEN(hookId,token)}/slack`};module.exports=Endpoints3;}});function appendQuery(query){let count=0;for(let[key,value]of Object.entries(query))value==null?delete query[key]:count++;return count>0?`?${new URLSearchParams(query).toString()}`:""}var fs,path,crypto,util,Endpoints,version,Constants,SM2,routeRegex,reactionsRegex,reactionsUserRegex,webhooksRegex,isMessageEndpointRegex,isGuildChannelsRegex,messagesRegex,disallowedBodyMethods;exports.DiscordAPIError = void 0;exports.IntervalCounter = void 0;exports.LeakyCounter = void 0;exports.Bucket = void 0;exports.Ratelimiter = void 0;exports.RequestHandler = void 0;var init_RequestHandler=__esm({"src/RequestHandler.ts"(){fs=__require("fs"),path=__require("path"),crypto=__require("crypto"),util=__require("util"),Endpoints=require_Endpoints(),{version}=JSON.parse(fs.readFileSync(path.join(__dirname,"../package.json"),{encoding:"utf8"})),Constants=require_Constants(),SM2=require_StateMachine(),routeRegex=/\/([a-z-]+)\/(?:\d+)/g,reactionsRegex=/\/reactions\/[^/]+/g,reactionsUserRegex=/\/reactions\/:id\/[^/]+/g,webhooksRegex=/^\/webhooks\/(\d+)\/[A-Za-z0-9-_]{64,}/,isMessageEndpointRegex=/\/messages\/:id$/,isGuildChannelsRegex=/\/guilds\/\d+\/channels$/,messagesRegex=/\/messages\/\d+$/,disallowedBodyMethods=new Set(["head","get","delete"]),exports.DiscordAPIError=class extends Error{method;path;code;httpStatus;request;response;constructor(error,request,response){super(),this.name="DiscordAPIError",this.message=error.message??util.inspect(error),this.method=request.method,this.path=request.endpoint,this.code=error.code??4e3,this.httpStatus=response.status,Object.defineProperties(this,{request:{enumerable:false,value:request},response:{enumerable:false,value:response}});}},exports.IntervalCounter=class{constructor(limit,reset){this.limit=limit;this.reset=reset;this.remaining=limit;}remaining;firstRequestTime=0;resetAt=null;id=new Array(3).fill(0).map(()=>String.fromCodePoint(Math.floor(Math.random()*26+65))).join("");checkReset(){let now=Date.now();this.resetAt!==null?now>this.resetAt&&(this.firstRequestTime=0,this.remaining=this.limit,this.resetAt=null,globalThis.snowtransferDebugLogging&&console.log(`${new Date().toISOString()} [itrv] [${this.id}] informed reset: ${this.remaining}/${this.limit}`)):now>this.firstRequestTime+this.reset&&(this.firstRequestTime=0,this.remaining=this.limit,globalThis.snowtransferDebugLogging&&console.log(`${new Date().toISOString()} [itrv] [${this.id}] predicted reset: ${this.remaining}/${this.limit}`));}hasReset(){return this.checkReset(),this.remaining===this.limit}canTake(){return this.checkReset(),this.remaining>0}take(){this.checkReset(),this.remaining===this.limit&&(this.firstRequestTime=Date.now());let ok=this.remaining>0;return this.remaining--,ok}timeUntilReset(){let now=Date.now();return this.resetAt?Math.max(this.resetAt-now+1,0):Math.max(this.firstRequestTime+this.reset-Date.now()+1,0)}responseReceived(){this.remaining===this.limit-1&&this.firstRequestTime&&(this.firstRequestTime=Date.now());}applyCount(limit,remaining,resetAfter){limit!=null&&(this.limit=limit),this.remaining=remaining,this.resetAt=Date.now()+resetAfter;}},exports.LeakyCounter=class{constructor(limit){this.limit=limit;this.remaining=limit;}remaining;resetAt=null;id=new Array(3).fill(0).map(()=>String.fromCodePoint(Math.floor(Math.random()*26+65))).join("");checkReset(){let now=Date.now();this.resetAt&&now>this.resetAt&&(this.remaining=Math.min(this.limit,this.remaining+1),this.resetAt=null,globalThis.snowtransferDebugLogging&&console.log(`${new Date().toISOString()} [leak] [${this.id}] restore one: ${this.remaining}/${this.limit}`));}hasReset(){return this.checkReset(),this.remaining===this.limit}canTake(){return this.checkReset(),this.remaining>0}take(){return this.checkReset(),globalThis.snowtransferDebugLogging&&console.log(`${new Date().toISOString()} [leak] [${this.id}] took: ${this.remaining-1} left`),this.remaining-- >0}timeUntilReset(){let now=Date.now();return this.resetAt?Math.max(this.resetAt-now+1,0):0}responseReceived(){}applyCount(limit,remaining,resetAfter){limit!=null&&(this.limit=limit),this.remaining=remaining,this.resetAt=Date.now()+resetAfter,globalThis.snowtransferDebugLogging&&console.log(`${new Date().toISOString()} [leak] [${this.id}] applied: ${remaining}/${limit} - wait another ${resetAfter}`);}},exports.Bucket=class{sm=new SM2("ready");calls=[];counters=[];pauseRequested=false;constructor(counters){this.counters=counters,this.sm.defineState("ready",{onEnter:[],onLeave:[],transitions:new Map([["enqueue",{destination:"check"}],["pause",{destination:"paused"}]])}),this.sm.defineState("check",{onEnter:[()=>this.pauseRequested?this.sm.doTransition("pause"):this.counters.every(c=>c.canTake())?this.calls.length?this.sm.doTransition("run"):this.sm.doTransition("empty"):this.sm.doTransition("cooldown")],onLeave:[],transitions:new Map([["pause",{destination:"paused"}],["cooldown",{destination:"cooldown"}],["run",{destination:"running"}],["empty",{destination:"ready"}]])}),this.sm.defineState("running",{onEnter:[()=>{this.counters.forEach(c=>c.take()),this.calls.shift()().then(()=>{this.sm.doTransition("complete");});}],onLeave:[],transitions:new Map([["complete",{destination:"check"}]])}),this.sm.defineState("cooldown",{onEnter:[()=>{this.sm.doTransitionLater("reset",Math.max(...this.counters.map(c=>c.timeUntilReset())));}],onLeave:[],transitions:new Map([["reset",{destination:"check"}]])}),this.sm.defineState("paused",{onEnter:[],onLeave:[()=>{this.pauseRequested=false;}],transitions:new Map([["resume",{destination:"check"}]])}),this.sm.freeze();}enqueue(fn){return new Promise((resolve,reject)=>{this.calls.push(()=>fn(this).then(resolve).catch(reject)),this.sm.currentStateName==="ready"&&this.sm.doTransition("enqueue");})}pause(){this.pauseRequested=true,this.sm.currentStateName==="ready"&&this.sm.doTransition("pause");}resume(){this.pauseRequested=false,this.sm.currentStateName==="paused"&&this.sm.doTransition("resume");}dropQueue(){this.calls.length=0;}},exports.Ratelimiter=class{buckets=new Map;globalBucket=new exports.Bucket([new exports.IntervalCounter(Constants.GLOBAL_REQUESTS_PER_SECOND,1e3)]);get global(){return !this.globalBucket.counters[0].canTake()}constructor(){setInterval(()=>{for(let[key,value]of this.buckets.entries())value.counters[0].hasReset()&&this.buckets.delete(key);},3600*1e3).unref();}routify(url,method){let route=url.replaceAll(routeRegex,function(match,p){return p==="channels"||p==="guilds"||p==="webhooks"?match:`/${p}/:id`}).replaceAll(reactionsRegex,"/reactions/:id").replaceAll(reactionsUserRegex,"/reactions/:id/:userId").replace(webhooksRegex,"/webhooks/$1/:token");if(method==="DELETE"&&isMessageEndpointRegex.test(route)?route=method+route:method==="GET"&&isGuildChannelsRegex.test(route)&&(route="/guilds/:id/channels"),method==="PUT"||method==="DELETE"){let index=route.indexOf("/reactions");index!==-1&&(route="MODIFY"+route.slice(0,index+10));}return route}queue(fn,url,method){let routeKey=this.routify(url,method),bucket=this.buckets.get(routeKey);return bucket||(method==="DELETE"&&messagesRegex.test(url)?bucket=new exports.Bucket([new exports.LeakyCounter(1),new exports.IntervalCounter(5,5e3),this.globalBucket.counters[0]]):bucket=new exports.Bucket([new exports.LeakyCounter(1),this.globalBucket.counters[0]]),this.buckets.set(routeKey,bucket)),bucket.enqueue(fn)}setGlobal(ms){this.globalBucket.counters[0].applyCount(Constants.GLOBAL_REQUESTS_PER_SECOND,0,ms);}},exports.RequestHandler=class extends events.EventEmitter{constructor(ratelimiter,options){super();this.ratelimiter=ratelimiter;this.options={baseHost:options?.baseHost??Endpoints.BASE_HOST,baseURL:options?.baseURL??Endpoints.BASE_URL,bypassBuckets:options?.bypassBuckets??false,retryFailed:options?.retryFailed??false,retryLimit:options?.retryLimit??Constants.DEFAULT_RETRY_LIMIT,headers:{"User-Agent":`Discordbot (https://github.com/DasWolke/SnowTransfer, ${version}) Node.js/${process.version}`},fetch:options?.fetch??fetch},options?.token&&(this.options.headers.Authorization=options.token),this.apiURL=this.options.baseHost+Endpoints.BASE_URL,this.latency=500;}options;latency;apiURL;request(endpoint,params={},method,dataType,data,extraHeaders,retries=this.options.retryLimit,rawResponse=false){let stack=new Error().stack;return new Promise(async(resolve,reject)=>{let fn=async bkt=>{let reqId=crypto.randomBytes(20).toString("hex");try{let request={endpoint,method:method.toUpperCase(),dataType,data:data??{}};this.emit("request",reqId,request);let before=Date.now(),response;switch(dataType){case "json":response=await this._request(endpoint,params,method,data,extraHeaders);break;case "multipart":if(!data)throw new Error("No multipart data");response=await this._multiPartRequest(endpoint,params,method,data,extraHeaders);break;default:throw new Error("Forbidden dataType. Use json or multipart or ensure multipart has FormData")}if(this.latency=Date.now()-before,bkt?.counters.forEach(c=>c.responseReceived()),bkt&&this._applyRatelimitHeaders(bkt,response.headers),response.status&&!Constants.OK_STATUS_CODES.has(response.status)&&response.status!==429){if(this.options.retryFailed&&!Constants.DO_NOT_RETRY_STATUS_CODES.has(response.status)&&retries!==0)return this.request(endpoint,params,method,dataType,data,extraHeaders,retries--).then(resolve).catch(reject);throw new exports.DiscordAPIError({message:await response.text()},request,response)}if(response.status===429){let b=await response.json();if(b.global&&this.ratelimiter.setGlobal(b.retry_after*1e3),globalThis.snowtransferDebugLogging&&console.log(`${new Date().toISOString()} [rate] [${bkt?.counters[0].id}] !! 429 - guess there was 0 remaining, wait another ${b.retry_after*1e3} (route: ${this.ratelimiter.routify(endpoint,method.toUpperCase())})`),this.emit("rateLimit",{method:method.toUpperCase(),path:endpoint,route:this.ratelimiter.routify(endpoint,method.toUpperCase())}),this.options.retryFailed&&retries!==0)return this.request(endpoint,params,method,dataType,data,extraHeaders,0).then(resolve).catch(reject);throw new exports.DiscordAPIError({message:b.message,code:b.code??429},request,response)}if(this.emit("done",reqId,response,request),rawResponse)return resolve(response);if(response.body){let b;try{b=await response.json();}catch{return resolve(void 0)}return resolve(b)}else return resolve(void 0)}catch(error){return error?.stack&&(error.stack=error.stack+`
10
10
  ${stack.split(`
11
11
  `).slice(1).join(`
12
12
  `)}`),this.emit("requestError",reqId,error),reject(error)}};this.options.bypassBuckets?fn():this.ratelimiter.queue(fn,endpoint,method.toUpperCase());})}_applyRatelimitHeaders(bkt,headers){let remaining=headers.get("x-ratelimit-remaining"),limit=headers.get("x-ratelimit-limit"),resetAfter=headers.get("x-ratelimit-reset-after"),isGlobal=headers.get("x-ratelimit-global");remaining===null&&!bkt.counters[0].canTake()&&!isGlobal&&bkt.counters[0].applyCount(null,1,0),remaining&&limit&&resetAfter&&!isGlobal&&bkt.counters[0].applyCount(Number.parseInt(limit),Number.parseInt(remaining),Number.parseFloat(resetAfter)*1e3);}async _request(endpoint,params={},method,data,extraHeaders){let headers={...this.options.headers,...extraHeaders},body;return disallowedBodyMethods.has(method)||(typeof data=="object"?body=JSON.stringify(data):body=String(data),headers["Content-Type"]="application/json"),this.options.fetch(`${this.apiURL}${endpoint}${appendQuery(params)}`,{method:method.toUpperCase(),headers,body})}async _multiPartRequest(endpoint,params={},method,data,extraHeaders){let headers={...this.options.headers,...extraHeaders};return this.options.fetch(`${this.apiURL}${endpoint}${appendQuery(params)}`,{method:method.toUpperCase(),headers,body:data})}};}});var require_AuditLog=__commonJS({"src/methods/AuditLog.ts"(exports,module){var Endpoints3=require_Endpoints(),AuditLogMethods=class{constructor(requestHandler){this.requestHandler=requestHandler;}async getAuditLog(guildId,options){return this.requestHandler.request(Endpoints3.GUILD_AUDIT_LOGS(guildId),options,"get","json")}};module.exports=AuditLogMethods;}});var require_AutoModeration=__commonJS({"src/methods/AutoModeration.ts"(exports,module){var Endpoints3=require_Endpoints(),Constants3=require_Constants(),AutoModerationMethods=class{constructor(requestHandler){this.requestHandler=requestHandler;}async getAutoModerationRules(guildId){return this.requestHandler.request(Endpoints3.GUILD_AUTO_MOD_RULES(guildId),{},"get","json")}async getAutoModerationRule(guildId,ruleId){return this.requestHandler.request(Endpoints3.GUILD_AUTO_MOD_RULE(guildId,ruleId),{},"get","json")}async createAutoModerationRule(guildId,data,reason){return this.requestHandler.request(Endpoints3.GUILD_AUTO_MOD_RULES(guildId),{},"post","json",data,Constants3.reasonHeader(reason))}async editAutoModerationRule(guildId,ruleId,data,reason){return this.requestHandler.request(Endpoints3.GUILD_AUTO_MOD_RULE(guildId,ruleId),{},"patch","json",data,Constants3.reasonHeader(reason))}async deleteAutoModerationRule(guildId,ruleId,reason){return this.requestHandler.request(Endpoints3.GUILD_AUTO_MOD_RULE(guildId,ruleId),{},"delete","json",{},Constants3.reasonHeader(reason))}};module.exports=AutoModerationMethods;}});var require_Bot=__commonJS({"src/methods/Bot.ts"(exports,module){var Endpoints3=require_Endpoints(),BotMethods=class{constructor(requestHandler){this.requestHandler=requestHandler;}async getGateway(){return this.requestHandler.request(Endpoints3.GATEWAY,{},"get","json")}async getGatewayBot(){return this.requestHandler.request(Endpoints3.GATEWAY_BOT,{},"get","json")}async getApplicationInfo(){return this.requestHandler.request(Endpoints3.OAUTH2_APPLICATION("@me"),{},"get","json")}async updateApplicationInfo(data){return this.requestHandler.request(Endpoints3.OAUTH2_APPLICATION("@me"),{},"patch","json",data)}};module.exports=BotMethods;}});var require_Channel=__commonJS({"src/methods/Channel.ts"(exports,module){var Endpoints3=require_Endpoints(),Constants3=require_Constants(),ChannelMethods=class{constructor(requestHandler,options){this.requestHandler=requestHandler;this.options=options;}async getChannel(channelId){return this.requestHandler.request(Endpoints3.CHANNEL(channelId),{},"get","json")}async updateChannel(channelId,data,reason){return this.requestHandler.request(Endpoints3.CHANNEL(channelId),{},"patch","json",data,Constants3.reasonHeader(reason))}async deleteChannel(channelId,reason){return this.requestHandler.request(Endpoints3.CHANNEL(channelId),{},"delete","json",{},Constants3.reasonHeader(reason))}async getChannelMessages(channelId,options={limit:50}){if(options.around?(delete options.before,delete options.after):options.before?(delete options.around,delete options.after):options.after&&(delete options.before,delete options.around),options.limit!==void 0&&(options.limit<Constants3.GET_CHANNEL_MESSAGES_MIN_RESULTS||options.limit>Constants3.GET_CHANNEL_MESSAGES_MAX_RESULTS))throw new RangeError(`Amount of messages that may be requested has to be between ${Constants3.GET_CHANNEL_MESSAGES_MIN_RESULTS} and ${Constants3.GET_CHANNEL_MESSAGES_MAX_RESULTS}`);return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGES(channelId),options,"get","json")}async getChannelMessage(channelId,messageId){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE(channelId,messageId),{},"get","json")}async createMessage(channelId,data){if(typeof data!="string"&&!data.content&&(!data.message_reference||data.message_reference&&data.message_reference.type===v10.MessageReferenceType.Default)&&!data.embeds&&!data.sticker_ids&&!data.components&&!data.files&&!data.poll)throw new Error("Missing content, message_reference type 1, embeds, sticker_ids, components, files, or poll");if(typeof data=="string"&&(data={content:data}),(data.content||data.embeds)&&data.flags&&(data.flags&v10.MessageFlags.IsComponentsV2)===v10.MessageFlags.IsComponentsV2)throw new Error("The message flags was set to include IsComponentsV2, but content and/or embeds were also present. You can either have content/embeds or components v2, not both.");return data.allowed_mentions??=this.options.allowed_mentions,data.files?this.requestHandler.request(Endpoints3.CHANNEL_MESSAGES(channelId),{},"post","multipart",await Constants3.standardMultipartHandler(data)):this.requestHandler.request(Endpoints3.CHANNEL_MESSAGES(channelId),{},"post","json",data)}async createVoiceMessage(channelId,data,audioDurationSeconds,waveform=""){let{upload_url,upload_filename}=await this.requestHandler.request(Endpoints3.CHANNEL_ATTACHMENTS(channelId),{},"post","json",{files:[{id:"69420",filename:"voice-message.ogg",file_size:data.byteLength}]}).then(d=>d.attachments[0]);return await fetch(upload_url,{method:"PUT",body:data}),this.requestHandler.request(Endpoints3.CHANNEL_MESSAGES(channelId),{},"post","json",{attachments:[{id:"42069",uploaded_filename:upload_filename,filename:"voice-message.ogg",duration_secs:audioDurationSeconds,waveform}],flags:8192})}async crosspostMessage(channelId,messageId){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_CROSSPOST(channelId,messageId),{},"post","json")}async createReaction(channelId,messageId,emoji){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_REACTION_USER(channelId,messageId,emoji,"@me"),{},"put","json")}async deleteReactionSelf(channelId,messageId,emoji){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_REACTION_USER(channelId,messageId,emoji,"@me"),{},"delete","json")}async deleteReaction(channelId,messageId,emoji,userId){return this.requestHandler.request(userId?Endpoints3.CHANNEL_MESSAGE_REACTION_USER(channelId,messageId,emoji,userId):Endpoints3.CHANNEL_MESSAGE_REACTION(channelId,messageId,emoji),{},"delete","json")}async getReactions(channelId,messageId,emoji,options){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_REACTION(channelId,messageId,emoji),options,"get","json")}async deleteAllReactions(channelId,messageId){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE_REACTIONS(channelId,messageId),{},"delete","json")}async editMessage(channelId,messageId,data){return typeof data=="string"&&(data={content:data}),(data.content||data.components)&&(data.allowed_mentions??=this.options.allowed_mentions),data.files?this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE(channelId,messageId),{},"patch","multipart",await Constants3.standardMultipartHandler(data)):this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE(channelId,messageId),{},"patch","json",data)}async deleteMessage(channelId,messageId,reason){return this.requestHandler.request(Endpoints3.CHANNEL_MESSAGE(channelId,messageId),{},"delete","json",{},Constants3.reasonHeader(reason))}async bulkDeleteMessages(channelId,messages,reason){if(messages.length<Constants3.BULK_DELETE_MESSAGES_MIN||messages.length>Constants3.BULK_DELETE_MESSAGES_MAX)throw new RangeError(`Amount of messages to be deleted has to be between ${Constants3.BULK_DELETE_MESSAGES_MIN} and ${Constants3.BULK_DELETE_MESSAGES_MAX}`);let oldestSnowflake=BigInt(Date.now()-142128e7)*BigInt(2)**BigInt(22),forbiddenMessage=messages.find(m=>BigInt(m)<oldestSnowflake);if(forbiddenMessage)throw new Error(`The message ${forbiddenMessage} is older than 2 weeks and may not be deleted using the bulk delete endpoint`);let data={messages};return this.requestHandler.request(Endpoints3.CHANNEL_BULK_DELETE(channelId),{},"post","json",data,Constants3.reasonHeader(reason))}async editChannelPermission(channelId,permissionId,data,reason){return this.requestHandler.request(Endpoints3.CHANNEL_PERMISSION(channelId,permissionId),{},"put","json",data,Constants3.reasonHeader(reason))}async getChannelInvites(channelId){return this.requestHandler.request(Endpoints3.CHANNEL_INVITES(channelId),{},"get","json")}async createChannelInvite(channelId,data={max_age:86400,max_uses:0,temporary:false,unique:false},reason){let targetUsers=data?.target_users;if(targetUsers?.length){delete data.target_users;let form=new FormData;return await Constants3.standardAddToFormHandler(form,"target_users_file",`Users