lolka.js 0.1.4 → 0.3.0
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 +6 -6
- package/package.json +25 -52
- package/src/client/BaseClient.js +120 -0
- package/src/client/Client.js +147 -446
- package/src/client/WebhookClient.js +103 -0
- package/src/client/actions/Action.js +3 -4
- package/src/client/actions/ActionsManager.js +65 -55
- package/src/client/actions/ApplicationCommandPermissionsUpdate.js +34 -0
- package/src/client/actions/AutoModerationActionExecution.js +26 -0
- package/src/client/actions/AutoModerationRuleCreate.js +27 -0
- package/src/client/actions/AutoModerationRuleDelete.js +31 -0
- package/src/client/actions/AutoModerationRuleUpdate.js +29 -0
- package/src/client/actions/ChannelCreate.js +3 -5
- package/src/client/actions/ChannelDelete.js +3 -4
- package/src/client/actions/ChannelUpdate.js +3 -3
- package/src/client/actions/EntitlementCreate.js +23 -0
- package/src/client/actions/EntitlementDelete.js +27 -0
- package/src/client/actions/EntitlementUpdate.js +25 -0
- package/src/client/actions/GuildAuditLogEntryCreate.js +29 -0
- package/src/client/actions/GuildBanAdd.js +20 -0
- package/src/client/actions/GuildBanRemove.js +25 -0
- package/src/client/actions/GuildChannelsPositionUpdate.js +3 -3
- package/src/client/actions/GuildDelete.js +44 -0
- package/src/client/actions/GuildEmojiCreate.js +3 -4
- package/src/client/actions/GuildEmojiDelete.js +3 -4
- package/src/client/actions/GuildEmojiUpdate.js +3 -4
- package/src/client/actions/GuildEmojisUpdate.js +2 -2
- package/src/client/actions/GuildIntegrationsUpdate.js +19 -0
- package/src/client/actions/GuildMemberRemove.js +6 -8
- package/src/client/actions/GuildMemberUpdate.js +6 -7
- package/src/client/actions/GuildRoleCreate.js +4 -6
- package/src/client/actions/GuildRoleDelete.js +3 -4
- package/src/client/actions/GuildRoleUpdate.js +39 -0
- package/src/client/actions/GuildRolesPositionUpdate.js +3 -3
- package/src/client/actions/GuildScheduledEventCreate.js +27 -0
- package/src/client/actions/GuildScheduledEventDelete.js +3 -4
- package/src/client/actions/GuildScheduledEventUpdate.js +30 -0
- package/src/client/actions/GuildScheduledEventUserAdd.js +3 -4
- package/src/client/actions/GuildScheduledEventUserRemove.js +3 -4
- package/src/client/actions/GuildSoundboardSoundDelete.js +3 -4
- package/src/client/actions/GuildStickerCreate.js +3 -4
- package/src/client/actions/GuildStickerDelete.js +3 -4
- package/src/client/actions/GuildStickerUpdate.js +3 -4
- package/src/client/actions/GuildStickersUpdate.js +2 -2
- package/src/client/actions/GuildUpdate.js +3 -4
- package/src/client/actions/InteractionCreate.js +15 -18
- package/src/client/actions/InviteCreate.js +27 -0
- package/src/client/actions/InviteDelete.js +29 -0
- package/src/client/actions/MessageCreate.js +3 -4
- package/src/client/actions/MessageDelete.js +3 -4
- package/src/client/actions/MessageDeleteBulk.js +3 -5
- package/src/client/actions/MessagePollVoteAdd.js +3 -4
- package/src/client/actions/MessagePollVoteRemove.js +3 -4
- package/src/client/actions/MessageReactionAdd.js +5 -7
- package/src/client/actions/MessageReactionRemove.js +4 -5
- package/src/client/actions/MessageReactionRemoveAll.js +4 -5
- package/src/client/actions/MessageReactionRemoveEmoji.js +4 -5
- package/src/client/actions/MessageUpdate.js +2 -2
- package/src/client/actions/PresenceUpdate.js +45 -0
- package/src/client/actions/StageInstanceCreate.js +3 -4
- package/src/client/actions/StageInstanceDelete.js +3 -4
- package/src/client/actions/StageInstanceUpdate.js +3 -4
- package/src/client/actions/ThreadCreate.js +3 -5
- package/src/client/actions/ThreadDelete.js +26 -0
- package/src/client/actions/ThreadListSync.js +60 -0
- package/src/client/actions/ThreadMemberUpdate.js +30 -0
- package/src/client/actions/ThreadMembersUpdate.js +3 -5
- package/src/client/actions/TypingStart.js +5 -6
- package/src/client/actions/UserUpdate.js +3 -4
- package/src/client/actions/VoiceStateUpdate.js +43 -0
- package/src/client/actions/WebhooksUpdate.js +37 -0
- package/src/client/voice/ClientVoiceManager.js +6 -10
- package/src/client/voice/VoiceConnection.js +420 -0
- package/src/client/websocket/WebSocketManager.js +407 -0
- package/src/client/websocket/WebSocketShard.js +234 -0
- package/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.js +2 -27
- package/src/client/websocket/handlers/AUTO_MODERATION_ACTION_EXECUTION.js +2 -15
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_CREATE.js +2 -16
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_DELETE.js +2 -19
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_UPDATE.js +2 -18
- package/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.js +1 -2
- package/src/client/websocket/handlers/CHANNEL_UPDATE.js +1 -2
- package/src/client/websocket/handlers/ENTITLEMENT_CREATE.js +2 -12
- package/src/client/websocket/handlers/ENTITLEMENT_DELETE.js +2 -16
- package/src/client/websocket/handlers/ENTITLEMENT_UPDATE.js +2 -14
- package/src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.js +2 -17
- package/src/client/websocket/handlers/GUILD_BAN_ADD.js +2 -13
- package/src/client/websocket/handlers/GUILD_BAN_REMOVE.js +2 -18
- package/src/client/websocket/handlers/GUILD_CREATE.js +5 -7
- package/src/client/websocket/handlers/GUILD_DELETE.js +2 -34
- package/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.js +2 -13
- package/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.js +1 -3
- package/src/client/websocket/handlers/GUILD_MEMBER_ADD.js +11 -9
- package/src/client/websocket/handlers/GUILD_MEMBER_REMOVE.js +2 -2
- package/src/client/websocket/handlers/GUILD_MEMBER_UPDATE.js +2 -2
- package/src/client/websocket/handlers/GUILD_ROLE_UPDATE.js +2 -19
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_CREATE.js +2 -15
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_UPDATE.js +2 -17
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUNDS_UPDATE.js +1 -2
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_CREATE.js +1 -2
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_UPDATE.js +1 -2
- package/src/client/websocket/handlers/INVITE_CREATE.js +2 -18
- package/src/client/websocket/handlers/INVITE_DELETE.js +2 -21
- package/src/client/websocket/handlers/MESSAGE_UPDATE.js +1 -2
- package/src/client/websocket/handlers/PRESENCE_UPDATE.js +2 -40
- package/src/client/websocket/handlers/RATE_LIMITED.js +2 -1
- package/src/client/websocket/handlers/READY.js +5 -8
- package/src/client/websocket/handlers/RESUMED.js +14 -0
- package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.js +1 -2
- package/src/client/websocket/handlers/SUBSCRIPTION_CREATE.js +1 -2
- package/src/client/websocket/handlers/SUBSCRIPTION_DELETE.js +1 -2
- package/src/client/websocket/handlers/SUBSCRIPTION_UPDATE.js +1 -2
- package/src/client/websocket/handlers/THREAD_DELETE.js +2 -15
- package/src/client/websocket/handlers/THREAD_LIST_SYNC.js +2 -49
- package/src/client/websocket/handlers/THREAD_MEMBER_UPDATE.js +2 -23
- package/src/client/websocket/handlers/THREAD_UPDATE.js +1 -2
- package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.js +2 -3
- package/src/client/websocket/handlers/VOICE_SERVER_UPDATE.js +3 -30
- package/src/client/websocket/handlers/VOICE_STATE_UPDATE.js +2 -35
- package/src/client/websocket/handlers/WEBHOOKS_UPDATE.js +2 -14
- package/src/client/websocket/handlers/index.js +75 -74
- package/src/errors/DJSError.js +7 -7
- package/src/errors/ErrorCodes.js +134 -58
- package/src/errors/Messages.js +143 -115
- package/src/errors/index.js +3 -5
- package/src/index.js +230 -234
- package/src/managers/ApplicationCommandManager.js +24 -60
- package/src/managers/ApplicationCommandPermissionsManager.js +33 -57
- package/src/managers/ApplicationEmojiManager.js +8 -18
- package/src/managers/AutoModerationRuleManager.js +6 -24
- package/src/managers/BaseGuildEmojiManager.js +85 -0
- package/src/managers/BaseManager.js +1 -3
- package/src/managers/CachedManager.js +8 -12
- package/src/managers/CategoryChannelChildManager.js +4 -10
- package/src/managers/ChannelManager.js +8 -70
- package/src/managers/DMMessageManager.js +2 -4
- package/src/managers/DataManager.js +5 -10
- package/src/managers/EntitlementManager.js +8 -19
- package/src/managers/GuildApplicationCommandManager.js +3 -6
- package/src/managers/GuildBanManager.js +52 -27
- package/src/managers/GuildChannelManager.js +54 -91
- package/src/managers/GuildEmojiManager.js +18 -108
- package/src/managers/GuildEmojiRoleManager.js +14 -24
- package/src/managers/GuildForumThreadManager.js +5 -10
- package/src/managers/GuildInviteManager.js +27 -51
- package/src/managers/GuildManager.js +185 -45
- package/src/managers/GuildMemberManager.js +105 -89
- package/src/managers/GuildMemberRoleManager.js +14 -29
- package/src/managers/GuildMessageManager.js +2 -20
- package/src/managers/GuildScheduledEventManager.js +13 -31
- package/src/managers/GuildSoundboardSoundManager.js +5 -17
- package/src/managers/GuildStickerManager.js +21 -34
- package/src/managers/GuildTextThreadManager.js +5 -9
- package/src/managers/MessageManager.js +77 -64
- package/src/managers/PartialGroupDMMessageManager.js +2 -4
- package/src/managers/PermissionOverwriteManager.js +15 -26
- package/src/managers/PollAnswerVoterManager.js +2 -14
- package/src/managers/PresenceManager.js +6 -11
- package/src/managers/ReactionManager.js +6 -13
- package/src/managers/ReactionUserManager.js +4 -11
- package/src/managers/RoleManager.js +74 -76
- package/src/managers/StageInstanceManager.js +8 -18
- package/src/managers/SubscriptionManager.js +4 -9
- package/src/managers/ThreadManager.js +13 -33
- package/src/managers/ThreadMemberManager.js +34 -27
- package/src/managers/UserManager.js +34 -32
- package/src/managers/VoiceStateManager.js +4 -9
- package/src/sharding/Shard.js +40 -64
- package/src/sharding/ShardClientUtil.js +60 -60
- package/src/sharding/ShardingManager.js +30 -89
- package/src/structures/ActionRow.js +18 -6
- package/src/structures/ActionRowBuilder.js +35 -0
- package/src/structures/AnonymousGuild.js +10 -14
- package/src/structures/ApplicationCommand.js +49 -67
- package/src/structures/ApplicationEmoji.js +5 -22
- package/src/structures/ApplicationRoleConnectionMetadata.js +0 -6
- package/src/structures/Attachment.js +7 -25
- package/src/structures/AttachmentBuilder.js +111 -0
- package/src/structures/AutoModerationActionExecution.js +2 -17
- package/src/structures/AutoModerationRule.js +17 -46
- package/src/structures/AutocompleteInteraction.js +4 -14
- package/src/structures/Base.js +2 -4
- package/src/structures/BaseChannel.js +4 -21
- package/src/structures/BaseGuild.js +7 -19
- package/src/structures/BaseGuildEmoji.js +13 -13
- package/src/structures/BaseGuildTextChannel.js +16 -45
- package/src/structures/BaseGuildVoiceChannel.js +12 -43
- package/src/structures/BaseInteraction.js +25 -54
- package/src/structures/BaseSelectMenuComponent.js +2 -8
- package/src/structures/ButtonBuilder.js +44 -0
- package/src/structures/ButtonComponent.js +2 -9
- package/src/structures/ButtonInteraction.js +2 -3
- package/src/structures/CategoryChannel.js +3 -8
- package/src/structures/ChannelSelectMenuBuilder.js +31 -0
- package/src/structures/ChannelSelectMenuComponent.js +2 -4
- package/src/structures/ChannelSelectMenuInteraction.js +2 -5
- package/src/structures/ChatInputCommandInteraction.js +4 -7
- package/src/structures/ClientApplication.js +12 -60
- package/src/structures/ClientPresence.js +10 -15
- package/src/structures/ClientUser.js +19 -36
- package/src/structures/CommandInteraction.js +7 -27
- package/src/structures/CommandInteractionOptionResolver.js +8 -36
- package/src/structures/Component.js +1 -7
- package/src/structures/ContainerComponent.js +3 -9
- package/src/structures/ContextMenuCommandInteraction.js +5 -9
- package/src/structures/DMChannel.js +15 -34
- package/src/structures/DirectoryChannel.js +2 -6
- package/src/structures/Embed.js +2 -19
- package/src/structures/EmbedBuilder.js +50 -0
- package/src/structures/Emoji.js +19 -19
- package/src/structures/Entitlement.js +2 -22
- package/src/structures/FileComponent.js +3 -7
- package/src/structures/ForumChannel.js +3 -6
- package/src/structures/Guild.js +131 -187
- package/src/structures/GuildAuditLogs.js +6 -12
- package/src/structures/GuildAuditLogsEntry.js +63 -88
- package/src/structures/GuildBan.js +3 -9
- package/src/structures/GuildChannel.js +33 -68
- package/src/structures/GuildEmoji.js +7 -19
- package/src/structures/GuildMember.js +58 -107
- package/src/structures/GuildOnboarding.js +2 -9
- package/src/structures/GuildOnboardingPrompt.js +2 -12
- package/src/structures/GuildOnboardingPromptOption.js +2 -12
- package/src/structures/GuildPreview.js +21 -30
- package/src/structures/GuildPreviewEmoji.js +2 -5
- package/src/structures/GuildScheduledEvent.js +19 -59
- package/src/structures/GuildTemplate.js +45 -24
- package/src/structures/Integration.js +7 -30
- package/src/structures/IntegrationApplication.js +12 -9
- package/src/structures/InteractionCallback.js +1 -10
- package/src/structures/InteractionCallbackResource.js +2 -7
- package/src/structures/InteractionCallbackResponse.js +3 -6
- package/src/structures/InteractionCollector.js +36 -23
- package/src/structures/InteractionResponse.js +102 -0
- package/src/structures/InteractionWebhook.js +6 -14
- package/src/structures/Invite.js +341 -0
- package/src/structures/InviteGuild.js +4 -6
- package/src/structures/InviteStageInstance.js +87 -0
- package/src/structures/LabelComponent.js +3 -3
- package/src/structures/MediaChannel.js +2 -3
- package/src/structures/MediaGalleryComponent.js +3 -6
- package/src/structures/MediaGalleryItem.js +2 -7
- package/src/structures/MentionableSelectMenuBuilder.js +32 -0
- package/src/structures/MentionableSelectMenuComponent.js +2 -3
- package/src/structures/MentionableSelectMenuInteraction.js +3 -8
- package/src/structures/Message.js +100 -169
- package/src/structures/MessageCollector.js +5 -16
- package/src/structures/MessageComponentInteraction.js +14 -34
- package/src/structures/MessageContextMenuCommandInteraction.js +2 -4
- package/src/structures/MessageMentions.js +4 -30
- package/src/structures/MessagePayload.js +90 -92
- package/src/structures/MessageReaction.js +17 -31
- package/src/structures/ModalBuilder.js +36 -0
- package/src/structures/{ModalComponentResolver.js → ModalSubmitFields.js} +31 -37
- package/src/structures/ModalSubmitInteraction.js +55 -54
- package/src/structures/NewsChannel.js +32 -0
- package/src/structures/OAuth2Guild.js +3 -6
- package/src/structures/PartialGroupDMChannel.js +11 -23
- package/src/structures/PermissionOverwrites.js +25 -47
- package/src/structures/Poll.js +4 -19
- package/src/structures/PollAnswer.js +29 -13
- package/src/structures/Presence.js +13 -57
- package/src/structures/PrimaryEntryPointCommandInteraction.js +2 -3
- package/src/structures/ReactionCollector.js +4 -21
- package/src/structures/ReactionEmoji.js +3 -5
- package/src/structures/Role.js +48 -65
- package/src/structures/RoleSelectMenuBuilder.js +31 -0
- package/src/structures/RoleSelectMenuComponent.js +2 -3
- package/src/structures/RoleSelectMenuInteraction.js +2 -5
- package/src/structures/SKU.js +2 -9
- package/src/structures/SectionComponent.js +3 -7
- package/src/structures/SelectMenuBuilder.js +26 -0
- package/src/structures/SelectMenuComponent.js +26 -0
- package/src/structures/SelectMenuInteraction.js +26 -0
- package/src/structures/SelectMenuOptionBuilder.js +26 -0
- package/src/structures/SeparatorComponent.js +2 -5
- package/src/structures/SoundboardSound.js +2 -18
- package/src/structures/StageChannel.js +4 -13
- package/src/structures/StageInstance.js +16 -19
- package/src/structures/Sticker.js +4 -28
- package/src/structures/StickerPack.js +4 -16
- package/src/structures/StringSelectMenuBuilder.js +79 -0
- package/src/structures/StringSelectMenuComponent.js +2 -4
- package/src/structures/StringSelectMenuInteraction.js +2 -4
- package/src/structures/StringSelectMenuOptionBuilder.js +49 -0
- package/src/structures/Subscription.js +1 -15
- package/src/structures/Team.js +7 -16
- package/src/structures/TeamMember.js +15 -9
- package/src/structures/TextChannel.js +3 -6
- package/src/structures/TextDisplayComponent.js +2 -4
- package/src/structures/TextInputBuilder.js +31 -0
- package/src/structures/TextInputComponent.js +2 -5
- package/src/structures/ThreadChannel.js +35 -85
- package/src/structures/ThreadMember.js +12 -17
- package/src/structures/ThreadOnlyChannel.js +15 -36
- package/src/structures/ThumbnailComponent.js +3 -8
- package/src/structures/Typing.js +2 -10
- package/src/structures/UnfurledMediaItem.js +2 -5
- package/src/structures/User.js +68 -60
- package/src/structures/UserContextMenuCommandInteraction.js +2 -5
- package/src/structures/UserSelectMenuBuilder.js +31 -0
- package/src/structures/UserSelectMenuComponent.js +2 -3
- package/src/structures/UserSelectMenuInteraction.js +3 -7
- package/src/structures/VoiceChannel.js +4 -11
- package/src/structures/VoiceChannelEffect.js +2 -12
- package/src/structures/VoiceRegion.js +2 -7
- package/src/structures/VoiceState.js +10 -36
- package/src/structures/Webhook.js +37 -65
- package/src/structures/WelcomeChannel.js +5 -12
- package/src/structures/WelcomeScreen.js +3 -8
- package/src/structures/Widget.js +3 -13
- package/src/structures/WidgetMember.js +2 -17
- package/src/structures/interfaces/Application.js +10 -19
- package/src/structures/interfaces/Collector.js +12 -45
- package/src/structures/interfaces/InteractionResponses.js +152 -43
- package/src/structures/interfaces/TextBasedChannel.js +99 -83
- package/src/util/APITypes.js +16 -30
- package/src/util/ActivityFlagsBitField.js +2 -5
- package/src/util/ApplicationFlagsBitField.js +6 -11
- package/src/util/AttachmentFlagsBitField.js +2 -5
- package/src/util/BitField.js +8 -27
- package/src/util/ChannelFlagsBitField.js +6 -11
- package/src/util/Channels.js +61 -73
- package/src/util/Colors.js +43 -43
- package/src/util/Components.js +82 -61
- package/src/util/Constants.js +124 -94
- package/src/util/DataResolver.js +17 -36
- package/src/util/Enums.js +1 -2
- package/src/util/Events.js +14 -3
- package/src/util/Formatters.js +413 -0
- package/src/util/GuildMemberFlagsBitField.js +5 -9
- package/src/util/IntentsBitField.js +6 -10
- package/src/util/InviteFlagsBitField.js +1 -2
- package/src/util/LimitedCollection.js +6 -13
- package/src/util/LolkaSnowflake.js +14 -1
- package/src/util/MessageFlagsBitField.js +6 -11
- package/src/util/Options.js +57 -35
- package/src/util/Partials.js +4 -5
- package/src/util/PermissionsBitField.js +8 -21
- package/src/util/RoleFlagsBitField.js +2 -5
- package/src/util/SKUFlagsBitField.js +1 -4
- package/src/util/ShardEvents.js +3 -1
- package/src/util/Status.js +21 -5
- package/src/util/Sweepers.js +13 -59
- package/src/util/SystemChannelFlagsBitField.js +6 -11
- package/src/util/ThreadMemberFlagsBitField.js +2 -6
- package/src/util/Transformers.js +18 -17
- package/src/util/UserFlagsBitField.js +2 -6
- package/src/util/Util.js +97 -148
- package/src/util/WebSocketShardEvents.js +25 -0
- package/typings/index.d.mts +2432 -1773
- package/typings/index.d.ts +2432 -1773
- package/typings/rawDataTypes.d.ts +211 -0
- package/src/structures/ActivityInstance.js +0 -52
- package/src/structures/ActivityLocation.js +0 -65
- package/src/structures/AnnouncementChannel.js +0 -29
- package/src/structures/AuthorizingIntegrationOwners.js +0 -64
- package/src/structures/BaseInvite.js +0 -187
- package/src/structures/GroupDMInvite.js +0 -37
- package/src/structures/GuildInvite.js +0 -223
- package/src/util/Invites.js +0 -31
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { Routes } = require('discord-api-types/v10');
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const Base = require('./Base');
|
|
5
|
+
const IntegrationApplication = require('./IntegrationApplication');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The information account for an integration
|
|
9
|
-
*
|
|
10
9
|
* @typedef {Object} IntegrationAccount
|
|
11
10
|
* @property {Snowflake|string} id The id of the account
|
|
12
11
|
* @property {string} name The name of the account
|
|
@@ -14,17 +13,15 @@ const { IntegrationApplication } = require('./IntegrationApplication.js');
|
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* The type of an {@link Integration}. This can be:
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
16
|
+
* * `twitch`
|
|
17
|
+
* * `youtube`
|
|
18
|
+
* * `discord`
|
|
19
|
+
* * `guild_subscription`
|
|
22
20
|
* @typedef {string} IntegrationType
|
|
23
21
|
*/
|
|
24
22
|
|
|
25
23
|
/**
|
|
26
24
|
* Represents a guild integration.
|
|
27
|
-
*
|
|
28
25
|
* @extends {Base}
|
|
29
26
|
*/
|
|
30
27
|
class Integration extends Base {
|
|
@@ -33,35 +30,30 @@ class Integration extends Base {
|
|
|
33
30
|
|
|
34
31
|
/**
|
|
35
32
|
* The guild this integration belongs to
|
|
36
|
-
*
|
|
37
33
|
* @type {Guild}
|
|
38
34
|
*/
|
|
39
35
|
this.guild = guild;
|
|
40
36
|
|
|
41
37
|
/**
|
|
42
38
|
* The integration id
|
|
43
|
-
*
|
|
44
39
|
* @type {Snowflake|string}
|
|
45
40
|
*/
|
|
46
41
|
this.id = data.id;
|
|
47
42
|
|
|
48
43
|
/**
|
|
49
44
|
* The integration name
|
|
50
|
-
*
|
|
51
45
|
* @type {string}
|
|
52
46
|
*/
|
|
53
47
|
this.name = data.name;
|
|
54
48
|
|
|
55
49
|
/**
|
|
56
50
|
* The integration type
|
|
57
|
-
*
|
|
58
51
|
* @type {IntegrationType}
|
|
59
52
|
*/
|
|
60
53
|
this.type = data.type;
|
|
61
54
|
|
|
62
55
|
/**
|
|
63
56
|
* Whether this integration is enabled
|
|
64
|
-
*
|
|
65
57
|
* @type {?boolean}
|
|
66
58
|
*/
|
|
67
59
|
this.enabled = data.enabled ?? null;
|
|
@@ -69,7 +61,6 @@ class Integration extends Base {
|
|
|
69
61
|
if ('syncing' in data) {
|
|
70
62
|
/**
|
|
71
63
|
* Whether this integration is syncing
|
|
72
|
-
*
|
|
73
64
|
* @type {?boolean}
|
|
74
65
|
*/
|
|
75
66
|
this.syncing = data.syncing;
|
|
@@ -79,7 +70,6 @@ class Integration extends Base {
|
|
|
79
70
|
|
|
80
71
|
/**
|
|
81
72
|
* The role that this integration uses for subscribers
|
|
82
|
-
*
|
|
83
73
|
* @type {?Role}
|
|
84
74
|
*/
|
|
85
75
|
this.role = this.guild.roles.resolve(data.role_id);
|
|
@@ -87,7 +77,6 @@ class Integration extends Base {
|
|
|
87
77
|
if ('enable_emoticons' in data) {
|
|
88
78
|
/**
|
|
89
79
|
* Whether emoticons should be synced for this integration (twitch only currently)
|
|
90
|
-
*
|
|
91
80
|
* @type {?boolean}
|
|
92
81
|
*/
|
|
93
82
|
this.enableEmoticons = data.enable_emoticons;
|
|
@@ -98,7 +87,6 @@ class Integration extends Base {
|
|
|
98
87
|
if (data.user) {
|
|
99
88
|
/**
|
|
100
89
|
* The user for this integration
|
|
101
|
-
*
|
|
102
90
|
* @type {?User}
|
|
103
91
|
*/
|
|
104
92
|
this.user = this.client.users._add(data.user);
|
|
@@ -108,7 +96,6 @@ class Integration extends Base {
|
|
|
108
96
|
|
|
109
97
|
/**
|
|
110
98
|
* The account integration information
|
|
111
|
-
*
|
|
112
99
|
* @type {IntegrationAccount}
|
|
113
100
|
*/
|
|
114
101
|
this.account = data.account;
|
|
@@ -116,7 +103,6 @@ class Integration extends Base {
|
|
|
116
103
|
if ('synced_at' in data) {
|
|
117
104
|
/**
|
|
118
105
|
* The timestamp at which this integration was last synced at
|
|
119
|
-
*
|
|
120
106
|
* @type {?number}
|
|
121
107
|
*/
|
|
122
108
|
this.syncedTimestamp = Date.parse(data.synced_at);
|
|
@@ -127,7 +113,6 @@ class Integration extends Base {
|
|
|
127
113
|
if ('subscriber_count' in data) {
|
|
128
114
|
/**
|
|
129
115
|
* How many subscribers this integration has
|
|
130
|
-
*
|
|
131
116
|
* @type {?number}
|
|
132
117
|
*/
|
|
133
118
|
this.subscriberCount = data.subscriber_count;
|
|
@@ -138,7 +123,6 @@ class Integration extends Base {
|
|
|
138
123
|
if ('revoked' in data) {
|
|
139
124
|
/**
|
|
140
125
|
* Whether this integration has been revoked
|
|
141
|
-
*
|
|
142
126
|
* @type {?boolean}
|
|
143
127
|
*/
|
|
144
128
|
this.revoked = data.revoked;
|
|
@@ -151,7 +135,6 @@ class Integration extends Base {
|
|
|
151
135
|
|
|
152
136
|
/**
|
|
153
137
|
* The date at which this integration was last synced at
|
|
154
|
-
*
|
|
155
138
|
* @type {?Date}
|
|
156
139
|
* @readonly
|
|
157
140
|
*/
|
|
@@ -161,7 +144,6 @@ class Integration extends Base {
|
|
|
161
144
|
|
|
162
145
|
/**
|
|
163
146
|
* All roles that are managed by this integration
|
|
164
|
-
*
|
|
165
147
|
* @type {Collection<Snowflake, Role>}
|
|
166
148
|
* @readonly
|
|
167
149
|
*/
|
|
@@ -174,7 +156,6 @@ class Integration extends Base {
|
|
|
174
156
|
if ('expire_behavior' in data) {
|
|
175
157
|
/**
|
|
176
158
|
* The behavior of expiring subscribers
|
|
177
|
-
*
|
|
178
159
|
* @type {?IntegrationExpireBehavior}
|
|
179
160
|
*/
|
|
180
161
|
this.expireBehavior = data.expire_behavior;
|
|
@@ -185,7 +166,6 @@ class Integration extends Base {
|
|
|
185
166
|
if ('expire_grace_period' in data) {
|
|
186
167
|
/**
|
|
187
168
|
* The grace period (in days) before expiring subscribers
|
|
188
|
-
*
|
|
189
169
|
* @type {?number}
|
|
190
170
|
*/
|
|
191
171
|
this.expireGracePeriod = data.expire_grace_period;
|
|
@@ -199,7 +179,6 @@ class Integration extends Base {
|
|
|
199
179
|
} else {
|
|
200
180
|
/**
|
|
201
181
|
* The application for this integration
|
|
202
|
-
*
|
|
203
182
|
* @type {?IntegrationApplication}
|
|
204
183
|
*/
|
|
205
184
|
this.application = new IntegrationApplication(this.client, data.application);
|
|
@@ -211,7 +190,6 @@ class Integration extends Base {
|
|
|
211
190
|
if ('scopes' in data) {
|
|
212
191
|
/**
|
|
213
192
|
* The scopes this application has been authorized for
|
|
214
|
-
*
|
|
215
193
|
* @type {OAuth2Scopes[]}
|
|
216
194
|
*/
|
|
217
195
|
this.scopes = data.scopes;
|
|
@@ -222,7 +200,6 @@ class Integration extends Base {
|
|
|
222
200
|
|
|
223
201
|
/**
|
|
224
202
|
* Deletes this integration.
|
|
225
|
-
*
|
|
226
203
|
* @returns {Promise<Integration>}
|
|
227
204
|
* @param {string} [reason] Reason for deleting this integration
|
|
228
205
|
*/
|
|
@@ -240,4 +217,4 @@ class Integration extends Base {
|
|
|
240
217
|
}
|
|
241
218
|
}
|
|
242
219
|
|
|
243
|
-
exports
|
|
220
|
+
module.exports = Integration;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const Application = require('./interfaces/Application');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Represents an Integration's OAuth2 Application.
|
|
7
|
-
*
|
|
8
7
|
* @extends {Application}
|
|
9
8
|
*/
|
|
10
9
|
class IntegrationApplication extends Application {
|
|
@@ -14,7 +13,6 @@ class IntegrationApplication extends Application {
|
|
|
14
13
|
if ('bot' in data) {
|
|
15
14
|
/**
|
|
16
15
|
* The bot user for this application
|
|
17
|
-
*
|
|
18
16
|
* @type {?User}
|
|
19
17
|
*/
|
|
20
18
|
this.bot = this.client.users._add(data.bot);
|
|
@@ -25,7 +23,6 @@ class IntegrationApplication extends Application {
|
|
|
25
23
|
if ('terms_of_service_url' in data) {
|
|
26
24
|
/**
|
|
27
25
|
* The URL of the application's terms of service
|
|
28
|
-
*
|
|
29
26
|
* @type {?string}
|
|
30
27
|
*/
|
|
31
28
|
this.termsOfServiceURL = data.terms_of_service_url;
|
|
@@ -36,7 +33,6 @@ class IntegrationApplication extends Application {
|
|
|
36
33
|
if ('privacy_policy_url' in data) {
|
|
37
34
|
/**
|
|
38
35
|
* The URL of the application's privacy policy
|
|
39
|
-
*
|
|
40
36
|
* @type {?string}
|
|
41
37
|
*/
|
|
42
38
|
this.privacyPolicyURL = data.privacy_policy_url;
|
|
@@ -47,7 +43,6 @@ class IntegrationApplication extends Application {
|
|
|
47
43
|
if ('rpc_origins' in data) {
|
|
48
44
|
/**
|
|
49
45
|
* The Array of RPC origin URLs
|
|
50
|
-
*
|
|
51
46
|
* @type {string[]}
|
|
52
47
|
*/
|
|
53
48
|
this.rpcOrigins = data.rpc_origins;
|
|
@@ -55,10 +50,19 @@ class IntegrationApplication extends Application {
|
|
|
55
50
|
this.rpcOrigins ??= [];
|
|
56
51
|
}
|
|
57
52
|
|
|
53
|
+
if ('hook' in data) {
|
|
54
|
+
/**
|
|
55
|
+
* Whether the application can be default hooked by the client
|
|
56
|
+
* @type {?boolean}
|
|
57
|
+
*/
|
|
58
|
+
this.hook = data.hook;
|
|
59
|
+
} else {
|
|
60
|
+
this.hook ??= null;
|
|
61
|
+
}
|
|
62
|
+
|
|
58
63
|
if ('cover_image' in data) {
|
|
59
64
|
/**
|
|
60
65
|
* The hash of the application's cover image
|
|
61
|
-
*
|
|
62
66
|
* @type {?string}
|
|
63
67
|
*/
|
|
64
68
|
this.cover = data.cover_image;
|
|
@@ -69,7 +73,6 @@ class IntegrationApplication extends Application {
|
|
|
69
73
|
if ('verify_key' in data) {
|
|
70
74
|
/**
|
|
71
75
|
* The hex-encoded key for verification in interactions and the GameSDK's GetTicket
|
|
72
|
-
*
|
|
73
76
|
* @type {?string}
|
|
74
77
|
*/
|
|
75
78
|
this.verifyKey = data.verify_key;
|
|
@@ -79,4 +82,4 @@ class IntegrationApplication extends Application {
|
|
|
79
82
|
}
|
|
80
83
|
}
|
|
81
84
|
|
|
82
|
-
exports
|
|
85
|
+
module.exports = IntegrationApplication;
|
|
@@ -9,7 +9,6 @@ class InteractionCallback {
|
|
|
9
9
|
constructor(client, data) {
|
|
10
10
|
/**
|
|
11
11
|
* The client that instantiated this.
|
|
12
|
-
*
|
|
13
12
|
* @name InteractionCallback#client
|
|
14
13
|
* @type {Client}
|
|
15
14
|
* @readonly
|
|
@@ -18,42 +17,36 @@ class InteractionCallback {
|
|
|
18
17
|
|
|
19
18
|
/**
|
|
20
19
|
* The id of the original interaction response
|
|
21
|
-
*
|
|
22
20
|
* @type {Snowflake}
|
|
23
21
|
*/
|
|
24
22
|
this.id = data.id;
|
|
25
23
|
|
|
26
24
|
/**
|
|
27
25
|
* The type of the original interaction
|
|
28
|
-
*
|
|
29
26
|
* @type {InteractionType}
|
|
30
27
|
*/
|
|
31
28
|
this.type = data.type;
|
|
32
29
|
|
|
33
30
|
/**
|
|
34
31
|
* The instance id of the Activity if one was launched or joined
|
|
35
|
-
*
|
|
36
32
|
* @type {?string}
|
|
37
33
|
*/
|
|
38
34
|
this.activityInstanceId = data.activity_instance_id ?? null;
|
|
39
35
|
|
|
40
36
|
/**
|
|
41
37
|
* The id of the message that was created by the interaction
|
|
42
|
-
*
|
|
43
38
|
* @type {?Snowflake}
|
|
44
39
|
*/
|
|
45
40
|
this.responseMessageId = data.response_message_id ?? null;
|
|
46
41
|
|
|
47
42
|
/**
|
|
48
43
|
* Whether the message is in a loading state
|
|
49
|
-
*
|
|
50
44
|
* @type {?boolean}
|
|
51
45
|
*/
|
|
52
46
|
this.responseMessageLoading = data.response_message_loading ?? null;
|
|
53
47
|
|
|
54
48
|
/**
|
|
55
49
|
* Whether the response message was ephemeral
|
|
56
|
-
*
|
|
57
50
|
* @type {?boolean}
|
|
58
51
|
*/
|
|
59
52
|
this.responseMessageEphemeral = data.response_message_ephemeral ?? null;
|
|
@@ -61,7 +54,6 @@ class InteractionCallback {
|
|
|
61
54
|
|
|
62
55
|
/**
|
|
63
56
|
* The timestamp the original interaction was created at
|
|
64
|
-
*
|
|
65
57
|
* @type {number}
|
|
66
58
|
* @readonly
|
|
67
59
|
*/
|
|
@@ -71,7 +63,6 @@ class InteractionCallback {
|
|
|
71
63
|
|
|
72
64
|
/**
|
|
73
65
|
* The time the original interaction was created at
|
|
74
|
-
*
|
|
75
66
|
* @type {Date}
|
|
76
67
|
* @readonly
|
|
77
68
|
*/
|
|
@@ -80,4 +71,4 @@ class InteractionCallback {
|
|
|
80
71
|
}
|
|
81
72
|
}
|
|
82
73
|
|
|
83
|
-
exports
|
|
74
|
+
module.exports = InteractionCallback;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const { lazy } = require('@discordjs/util');
|
|
4
4
|
|
|
5
|
-
const getMessage = lazy(() => require('./Message
|
|
5
|
+
const getMessage = lazy(() => require('./Message').Message);
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Represents the resource that was created by the interaction response.
|
|
@@ -11,7 +11,6 @@ class InteractionCallbackResource {
|
|
|
11
11
|
constructor(client, data) {
|
|
12
12
|
/**
|
|
13
13
|
* The client that instantiated this
|
|
14
|
-
*
|
|
15
14
|
* @name InteractionCallbackResource#client
|
|
16
15
|
* @type {Client}
|
|
17
16
|
* @readonly
|
|
@@ -20,21 +19,18 @@ class InteractionCallbackResource {
|
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* The interaction callback type
|
|
23
|
-
*
|
|
24
22
|
* @type {InteractionResponseType}
|
|
25
23
|
*/
|
|
26
24
|
this.type = data.type;
|
|
27
25
|
|
|
28
26
|
/**
|
|
29
27
|
* The Activity launched by an interaction
|
|
30
|
-
*
|
|
31
28
|
* @typedef {Object} ActivityInstance
|
|
32
29
|
* @property {string} id The instance id of the Activity
|
|
33
30
|
*/
|
|
34
31
|
|
|
35
32
|
/**
|
|
36
33
|
* Represents the Activity launched by this interaction
|
|
37
|
-
*
|
|
38
34
|
* @type {?ActivityInstance}
|
|
39
35
|
*/
|
|
40
36
|
this.activityInstance = data.activity_instance ?? null;
|
|
@@ -42,7 +38,6 @@ class InteractionCallbackResource {
|
|
|
42
38
|
if ('message' in data) {
|
|
43
39
|
/**
|
|
44
40
|
* The message created by the interaction
|
|
45
|
-
*
|
|
46
41
|
* @type {?Message}
|
|
47
42
|
*/
|
|
48
43
|
this.message =
|
|
@@ -54,4 +49,4 @@ class InteractionCallbackResource {
|
|
|
54
49
|
}
|
|
55
50
|
}
|
|
56
51
|
|
|
57
|
-
exports
|
|
52
|
+
module.exports = InteractionCallbackResource;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const InteractionCallback = require('./InteractionCallback');
|
|
4
|
+
const InteractionCallbackResource = require('./InteractionCallbackResource');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Represents an interaction's response
|
|
@@ -10,7 +10,6 @@ class InteractionCallbackResponse {
|
|
|
10
10
|
constructor(client, data) {
|
|
11
11
|
/**
|
|
12
12
|
* The client that instantiated this
|
|
13
|
-
*
|
|
14
13
|
* @name InteractionCallbackResponse#client
|
|
15
14
|
* @type {Client}
|
|
16
15
|
* @readonly
|
|
@@ -19,18 +18,16 @@ class InteractionCallbackResponse {
|
|
|
19
18
|
|
|
20
19
|
/**
|
|
21
20
|
* The interaction object associated with the interaction callback response
|
|
22
|
-
*
|
|
23
21
|
* @type {InteractionCallback}
|
|
24
22
|
*/
|
|
25
23
|
this.interaction = new InteractionCallback(client, data.interaction);
|
|
26
24
|
|
|
27
25
|
/**
|
|
28
26
|
* The resource that was created by the interaction response
|
|
29
|
-
*
|
|
30
27
|
* @type {?InteractionCallbackResource}
|
|
31
28
|
*/
|
|
32
29
|
this.resource = data.resource ? new InteractionCallbackResource(client, data.resource) : null;
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
32
|
|
|
36
|
-
exports
|
|
33
|
+
module.exports = InteractionCallbackResponse;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { Collection } = require('@discordjs/collection');
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const Collector = require('./interfaces/Collector');
|
|
5
|
+
const Events = require('../util/Events');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @typedef {CollectorOptions} InteractionCollectorOptions
|
|
@@ -14,6 +14,8 @@ const { Collector } = require('./interfaces/Collector.js');
|
|
|
14
14
|
* @property {number} [maxComponents] The maximum number of components to collect
|
|
15
15
|
* @property {number} [maxUsers] The maximum number of users to interact
|
|
16
16
|
* @property {Message|APIMessage} [message] The message to listen to interactions from
|
|
17
|
+
* @property {InteractionResponse} [interactionResponse] The interaction response to listen
|
|
18
|
+
* to message component interactions from
|
|
17
19
|
*/
|
|
18
20
|
|
|
19
21
|
/**
|
|
@@ -24,7 +26,6 @@ const { Collector } = require('./interfaces/Collector.js');
|
|
|
24
26
|
* guild ({@link Client#event:guildDelete guildDelete}) is deleted.
|
|
25
27
|
* <info>Interaction collectors that do not specify `time` or `idle` may be prone to always running.
|
|
26
28
|
* Ensure your interaction collectors end via either of these options or manual cancellation.</info>
|
|
27
|
-
*
|
|
28
29
|
* @extends {Collector}
|
|
29
30
|
*/
|
|
30
31
|
class InteractionCollector extends Collector {
|
|
@@ -37,25 +38,32 @@ class InteractionCollector extends Collector {
|
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
40
|
* The message from which to collect interactions, if provided
|
|
40
|
-
*
|
|
41
41
|
* @type {?Snowflake}
|
|
42
42
|
*/
|
|
43
|
-
this.messageId = options.message?.id ?? null;
|
|
43
|
+
this.messageId = options.message?.id ?? options.interactionResponse?.interaction.message?.id ?? null;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The message interaction id from which to collect interactions, if provided
|
|
47
|
+
* @type {?Snowflake}
|
|
48
|
+
*/
|
|
49
|
+
this.messageInteractionId = options.interactionResponse?.id ?? null;
|
|
44
50
|
|
|
45
51
|
/**
|
|
46
52
|
* The channel from which to collect interactions, if provided
|
|
47
|
-
*
|
|
48
53
|
* @type {?Snowflake}
|
|
49
54
|
*/
|
|
50
55
|
this.channelId =
|
|
51
|
-
options.
|
|
56
|
+
options.interactionResponse?.interaction.channelId ??
|
|
57
|
+
options.message?.channelId ??
|
|
58
|
+
options.message?.channel_id ??
|
|
59
|
+
this.client.channels.resolveId(options.channel);
|
|
52
60
|
|
|
53
61
|
/**
|
|
54
62
|
* The guild from which to collect interactions, if provided
|
|
55
|
-
*
|
|
56
63
|
* @type {?Snowflake}
|
|
57
64
|
*/
|
|
58
65
|
this.guildId =
|
|
66
|
+
options.interactionResponse?.interaction.guildId ??
|
|
59
67
|
options.message?.guildId ??
|
|
60
68
|
options.message?.guild_id ??
|
|
61
69
|
this.client.guilds.resolveId(options.channel?.guild) ??
|
|
@@ -63,28 +71,24 @@ class InteractionCollector extends Collector {
|
|
|
63
71
|
|
|
64
72
|
/**
|
|
65
73
|
* The type of interaction to collect
|
|
66
|
-
*
|
|
67
74
|
* @type {?InteractionType}
|
|
68
75
|
*/
|
|
69
76
|
this.interactionType = options.interactionType ?? null;
|
|
70
77
|
|
|
71
78
|
/**
|
|
72
79
|
* The type of component to collect
|
|
73
|
-
*
|
|
74
80
|
* @type {?ComponentType}
|
|
75
81
|
*/
|
|
76
82
|
this.componentType = options.componentType ?? null;
|
|
77
83
|
|
|
78
84
|
/**
|
|
79
85
|
* The users that have interacted with this collector
|
|
80
|
-
*
|
|
81
86
|
* @type {Collection<Snowflake, User>}
|
|
82
87
|
*/
|
|
83
88
|
this.users = new Collection();
|
|
84
89
|
|
|
85
90
|
/**
|
|
86
91
|
* The total number of interactions collected
|
|
87
|
-
*
|
|
88
92
|
* @type {number}
|
|
89
93
|
*/
|
|
90
94
|
this.total = 0;
|
|
@@ -95,7 +99,7 @@ class InteractionCollector extends Collector {
|
|
|
95
99
|
if (messages.has(this.messageId)) this.stop('messageDelete');
|
|
96
100
|
};
|
|
97
101
|
|
|
98
|
-
if (this.messageId) {
|
|
102
|
+
if (this.messageId || this.messageInteractionId) {
|
|
99
103
|
this._handleMessageDeletion = this._handleMessageDeletion.bind(this);
|
|
100
104
|
this.client.on(Events.MessageDelete, this._handleMessageDeletion);
|
|
101
105
|
this.client.on(Events.MessageBulkDelete, bulkDeleteListener);
|
|
@@ -133,7 +137,6 @@ class InteractionCollector extends Collector {
|
|
|
133
137
|
|
|
134
138
|
/**
|
|
135
139
|
* Handles an incoming interaction for possible collection.
|
|
136
|
-
*
|
|
137
140
|
* @param {BaseInteraction} interaction The interaction to possibly collect
|
|
138
141
|
* @returns {?Snowflake}
|
|
139
142
|
* @private
|
|
@@ -141,7 +144,6 @@ class InteractionCollector extends Collector {
|
|
|
141
144
|
collect(interaction) {
|
|
142
145
|
/**
|
|
143
146
|
* Emitted whenever an interaction is collected.
|
|
144
|
-
*
|
|
145
147
|
* @event InteractionCollector#collect
|
|
146
148
|
* @param {BaseInteraction} interaction The interaction that was collected
|
|
147
149
|
*/
|
|
@@ -149,6 +151,13 @@ class InteractionCollector extends Collector {
|
|
|
149
151
|
if (this.interactionType && interaction.type !== this.interactionType) return null;
|
|
150
152
|
if (this.componentType && interaction.componentType !== this.componentType) return null;
|
|
151
153
|
if (this.messageId && interaction.message?.id !== this.messageId) return null;
|
|
154
|
+
if (
|
|
155
|
+
this.messageInteractionId &&
|
|
156
|
+
interaction.message?.interactionMetadata?.id &&
|
|
157
|
+
interaction.message.interactionMetadata.id !== this.messageInteractionId
|
|
158
|
+
) {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
152
161
|
if (this.channelId && interaction.channelId !== this.channelId) return null;
|
|
153
162
|
if (this.guildId && interaction.guildId !== this.guildId) return null;
|
|
154
163
|
|
|
@@ -157,20 +166,25 @@ class InteractionCollector extends Collector {
|
|
|
157
166
|
|
|
158
167
|
/**
|
|
159
168
|
* Handles an interaction for possible disposal.
|
|
160
|
-
*
|
|
161
169
|
* @param {BaseInteraction} interaction The interaction that could be disposed of
|
|
162
170
|
* @returns {?Snowflake}
|
|
163
171
|
*/
|
|
164
172
|
dispose(interaction) {
|
|
165
173
|
/**
|
|
166
174
|
* Emitted whenever an interaction is disposed of.
|
|
167
|
-
*
|
|
168
175
|
* @event InteractionCollector#dispose
|
|
169
176
|
* @param {BaseInteraction} interaction The interaction that was disposed of
|
|
170
177
|
*/
|
|
171
178
|
if (this.type && interaction.type !== this.type) return null;
|
|
172
179
|
if (this.componentType && interaction.componentType !== this.componentType) return null;
|
|
173
180
|
if (this.messageId && interaction.message?.id !== this.messageId) return null;
|
|
181
|
+
if (
|
|
182
|
+
this.messageInteractionId &&
|
|
183
|
+
interaction.message?.interactionMetadata?.id &&
|
|
184
|
+
interaction.message.interactionMetadata.id !== this.messageInteractionId
|
|
185
|
+
) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
174
188
|
if (this.channelId && interaction.channelId !== this.channelId) return null;
|
|
175
189
|
if (this.guildId && interaction.guildId !== this.guildId) return null;
|
|
176
190
|
|
|
@@ -189,7 +203,6 @@ class InteractionCollector extends Collector {
|
|
|
189
203
|
|
|
190
204
|
/**
|
|
191
205
|
* The reason this collector has ended with, or null if it hasn't ended yet
|
|
192
|
-
*
|
|
193
206
|
* @type {?string}
|
|
194
207
|
* @readonly
|
|
195
208
|
*/
|
|
@@ -202,7 +215,6 @@ class InteractionCollector extends Collector {
|
|
|
202
215
|
|
|
203
216
|
/**
|
|
204
217
|
* Handles checking if the message has been deleted, and if so, stops the collector with the reason 'messageDelete'.
|
|
205
|
-
*
|
|
206
218
|
* @private
|
|
207
219
|
* @param {Message} message The message that was deleted
|
|
208
220
|
* @returns {void}
|
|
@@ -211,11 +223,14 @@ class InteractionCollector extends Collector {
|
|
|
211
223
|
if (message.id === this.messageId) {
|
|
212
224
|
this.stop('messageDelete');
|
|
213
225
|
}
|
|
226
|
+
|
|
227
|
+
if (message.interactionMetadata?.id === this.messageInteractionId) {
|
|
228
|
+
this.stop('messageDelete');
|
|
229
|
+
}
|
|
214
230
|
}
|
|
215
231
|
|
|
216
232
|
/**
|
|
217
233
|
* Handles checking if the channel has been deleted, and if so, stops the collector with the reason 'channelDelete'.
|
|
218
|
-
*
|
|
219
234
|
* @private
|
|
220
235
|
* @param {GuildChannel} channel The channel that was deleted
|
|
221
236
|
* @returns {void}
|
|
@@ -228,7 +243,6 @@ class InteractionCollector extends Collector {
|
|
|
228
243
|
|
|
229
244
|
/**
|
|
230
245
|
* Handles checking if the thread has been deleted, and if so, stops the collector with the reason 'threadDelete'.
|
|
231
|
-
*
|
|
232
246
|
* @private
|
|
233
247
|
* @param {ThreadChannel} thread The thread that was deleted
|
|
234
248
|
* @returns {void}
|
|
@@ -241,7 +255,6 @@ class InteractionCollector extends Collector {
|
|
|
241
255
|
|
|
242
256
|
/**
|
|
243
257
|
* Handles checking if the guild has been deleted, and if so, stops the collector with the reason 'guildDelete'.
|
|
244
|
-
*
|
|
245
258
|
* @private
|
|
246
259
|
* @param {Guild} guild The guild that was deleted
|
|
247
260
|
* @returns {void}
|
|
@@ -253,4 +266,4 @@ class InteractionCollector extends Collector {
|
|
|
253
266
|
}
|
|
254
267
|
}
|
|
255
268
|
|
|
256
|
-
exports
|
|
269
|
+
module.exports = InteractionCollector;
|