@velliajs/discord 1.0.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/LICENSE +191 -0
- package/README.md +133 -0
- package/package.json +82 -0
- package/src/client/BaseClient.js +83 -0
- package/src/client/Client.js +591 -0
- package/src/client/WebhookClient.js +103 -0
- package/src/client/actions/Action.js +119 -0
- package/src/client/actions/ActionsManager.js +79 -0
- 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 +23 -0
- package/src/client/actions/ChannelDelete.js +23 -0
- package/src/client/actions/ChannelUpdate.js +33 -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 +21 -0
- package/src/client/actions/GuildDelete.js +44 -0
- package/src/client/actions/GuildEmojiCreate.js +20 -0
- package/src/client/actions/GuildEmojiDelete.js +19 -0
- package/src/client/actions/GuildEmojiUpdate.js +20 -0
- package/src/client/actions/GuildEmojisUpdate.js +34 -0
- package/src/client/actions/GuildIntegrationsUpdate.js +19 -0
- package/src/client/actions/GuildMemberRemove.js +31 -0
- package/src/client/actions/GuildMemberUpdate.js +44 -0
- package/src/client/actions/GuildRoleCreate.js +25 -0
- package/src/client/actions/GuildRoleDelete.js +29 -0
- package/src/client/actions/GuildRoleUpdate.js +39 -0
- package/src/client/actions/GuildRolesPositionUpdate.js +21 -0
- package/src/client/actions/GuildScheduledEventCreate.js +27 -0
- package/src/client/actions/GuildScheduledEventDelete.js +31 -0
- package/src/client/actions/GuildScheduledEventUpdate.js +30 -0
- package/src/client/actions/GuildScheduledEventUserAdd.js +32 -0
- package/src/client/actions/GuildScheduledEventUserRemove.js +32 -0
- package/src/client/actions/GuildStickerCreate.js +20 -0
- package/src/client/actions/GuildStickerDelete.js +19 -0
- package/src/client/actions/GuildStickerUpdate.js +20 -0
- package/src/client/actions/GuildStickersUpdate.js +34 -0
- package/src/client/actions/GuildUpdate.js +33 -0
- package/src/client/actions/InteractionCreate.js +101 -0
- package/src/client/actions/InviteCreate.js +28 -0
- package/src/client/actions/InviteDelete.js +30 -0
- package/src/client/actions/MessageCreate.js +37 -0
- package/src/client/actions/MessageDelete.js +32 -0
- package/src/client/actions/MessageDeleteBulk.js +47 -0
- package/src/client/actions/MessageReactionAdd.js +55 -0
- package/src/client/actions/MessageReactionRemove.js +45 -0
- package/src/client/actions/MessageReactionRemoveAll.js +33 -0
- package/src/client/actions/MessageReactionRemoveEmoji.js +28 -0
- package/src/client/actions/MessageUpdate.js +26 -0
- package/src/client/actions/PresenceUpdate.js +42 -0
- package/src/client/actions/StageInstanceCreate.js +28 -0
- package/src/client/actions/StageInstanceDelete.js +31 -0
- package/src/client/actions/StageInstanceUpdate.js +30 -0
- package/src/client/actions/ThreadCreate.js +24 -0
- 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 +47 -0
- package/src/client/actions/TypingStart.js +29 -0
- package/src/client/actions/UserUpdate.js +36 -0
- package/src/client/actions/VoiceStateUpdate.js +43 -0
- package/src/client/actions/WebhooksUpdate.js +20 -0
- package/src/client/voice/ClientVoiceManager.js +44 -0
- package/src/client/websocket/WebSocketManager.js +393 -0
- package/src/client/websocket/WebSocketShard.js +231 -0
- package/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.js +5 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_ACTION_EXECUTION.js +5 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_CREATE.js +5 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_DELETE.js +5 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_UPDATE.js +5 -0
- package/src/client/websocket/handlers/CHANNEL_CREATE.js +5 -0
- package/src/client/websocket/handlers/CHANNEL_DELETE.js +5 -0
- package/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.js +22 -0
- package/src/client/websocket/handlers/CHANNEL_UPDATE.js +16 -0
- package/src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.js +5 -0
- package/src/client/websocket/handlers/GUILD_BAN_ADD.js +5 -0
- package/src/client/websocket/handlers/GUILD_BAN_REMOVE.js +5 -0
- package/src/client/websocket/handlers/GUILD_CREATE.js +26 -0
- package/src/client/websocket/handlers/GUILD_DELETE.js +5 -0
- package/src/client/websocket/handlers/GUILD_EMOJIS_UPDATE.js +5 -0
- package/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.js +5 -0
- package/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.js +39 -0
- package/src/client/websocket/handlers/GUILD_MEMBER_ADD.js +20 -0
- package/src/client/websocket/handlers/GUILD_MEMBER_REMOVE.js +5 -0
- package/src/client/websocket/handlers/GUILD_MEMBER_UPDATE.js +5 -0
- package/src/client/websocket/handlers/GUILD_ROLE_CREATE.js +5 -0
- package/src/client/websocket/handlers/GUILD_ROLE_DELETE.js +5 -0
- package/src/client/websocket/handlers/GUILD_ROLE_UPDATE.js +5 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_CREATE.js +5 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_DELETE.js +5 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_UPDATE.js +5 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_ADD.js +5 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_REMOVE.js +5 -0
- package/src/client/websocket/handlers/GUILD_STICKERS_UPDATE.js +5 -0
- package/src/client/websocket/handlers/GUILD_UPDATE.js +5 -0
- package/src/client/websocket/handlers/INTERACTION_CREATE.js +5 -0
- package/src/client/websocket/handlers/INVITE_CREATE.js +5 -0
- package/src/client/websocket/handlers/INVITE_DELETE.js +5 -0
- package/src/client/websocket/handlers/MESSAGE_CREATE.js +5 -0
- package/src/client/websocket/handlers/MESSAGE_DELETE.js +5 -0
- package/src/client/websocket/handlers/MESSAGE_DELETE_BULK.js +5 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_ADD.js +5 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE.js +5 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_ALL.js +5 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_EMOJI.js +5 -0
- package/src/client/websocket/handlers/MESSAGE_UPDATE.js +16 -0
- package/src/client/websocket/handlers/PRESENCE_UPDATE.js +5 -0
- package/src/client/websocket/handlers/READY.js +27 -0
- package/src/client/websocket/handlers/RESUMED.js +14 -0
- package/src/client/websocket/handlers/STAGE_INSTANCE_CREATE.js +5 -0
- package/src/client/websocket/handlers/STAGE_INSTANCE_DELETE.js +5 -0
- package/src/client/websocket/handlers/STAGE_INSTANCE_UPDATE.js +5 -0
- package/src/client/websocket/handlers/THREAD_CREATE.js +5 -0
- package/src/client/websocket/handlers/THREAD_DELETE.js +5 -0
- package/src/client/websocket/handlers/THREAD_LIST_SYNC.js +5 -0
- package/src/client/websocket/handlers/THREAD_MEMBERS_UPDATE.js +5 -0
- package/src/client/websocket/handlers/THREAD_MEMBER_UPDATE.js +5 -0
- package/src/client/websocket/handlers/THREAD_UPDATE.js +16 -0
- package/src/client/websocket/handlers/TYPING_START.js +5 -0
- package/src/client/websocket/handlers/USER_UPDATE.js +5 -0
- package/src/client/websocket/handlers/VOICE_SERVER_UPDATE.js +6 -0
- package/src/client/websocket/handlers/VOICE_STATE_UPDATE.js +5 -0
- package/src/client/websocket/handlers/WEBHOOKS_UPDATE.js +5 -0
- package/src/client/websocket/handlers/index.js +64 -0
- package/src/errors/DJSError.js +48 -0
- package/src/errors/ErrorCodes.js +319 -0
- package/src/errors/Messages.js +170 -0
- package/src/errors/index.js +5 -0
- package/src/index.js +213 -0
- package/src/managers/ApplicationCommandManager.js +263 -0
- package/src/managers/ApplicationCommandPermissionsManager.js +434 -0
- package/src/managers/AutoModerationRuleManager.js +288 -0
- package/src/managers/BaseGuildEmojiManager.js +80 -0
- package/src/managers/BaseManager.js +19 -0
- package/src/managers/CachedManager.js +57 -0
- package/src/managers/CategoryChannelChildManager.js +77 -0
- package/src/managers/ChannelManager.js +128 -0
- package/src/managers/DataManager.js +61 -0
- package/src/managers/GuildApplicationCommandManager.js +28 -0
- package/src/managers/GuildBanManager.js +204 -0
- package/src/managers/GuildChannelManager.js +494 -0
- package/src/managers/GuildEmojiManager.js +174 -0
- package/src/managers/GuildEmojiRoleManager.js +118 -0
- package/src/managers/GuildForumThreadManager.js +83 -0
- package/src/managers/GuildInviteManager.js +213 -0
- package/src/managers/GuildManager.js +283 -0
- package/src/managers/GuildMemberManager.js +540 -0
- package/src/managers/GuildMemberRoleManager.js +204 -0
- package/src/managers/GuildScheduledEventManager.js +297 -0
- package/src/managers/GuildStickerManager.js +182 -0
- package/src/managers/GuildTextThreadManager.js +91 -0
- package/src/managers/MessageManager.js +259 -0
- package/src/managers/PermissionOverwriteManager.js +168 -0
- package/src/managers/PresenceManager.js +58 -0
- package/src/managers/ReactionManager.js +68 -0
- package/src/managers/ReactionUserManager.js +77 -0
- package/src/managers/RoleManager.js +360 -0
- package/src/managers/StageInstanceManager.js +154 -0
- package/src/managers/ThreadManager.js +204 -0
- package/src/managers/ThreadMemberManager.js +182 -0
- package/src/managers/UserManager.js +139 -0
- package/src/managers/VoiceStateManager.js +37 -0
- package/src/sharding/Shard.js +457 -0
- package/src/sharding/ShardClientUtil.js +285 -0
- package/src/sharding/ShardingManager.js +326 -0
- package/src/structures/ActionRow.js +46 -0
- package/src/structures/ActionRowBuilder.js +35 -0
- package/src/structures/AnonymousGuild.js +97 -0
- package/src/structures/ApplicationCommand.js +606 -0
- package/src/structures/ApplicationRoleConnectionMetadata.js +46 -0
- package/src/structures/Attachment.js +140 -0
- package/src/structures/AttachmentBuilder.js +116 -0
- package/src/structures/AutoModerationActionExecution.js +116 -0
- package/src/structures/AutoModerationRule.js +284 -0
- package/src/structures/AutocompleteInteraction.js +97 -0
- package/src/structures/Base.js +43 -0
- package/src/structures/BaseChannel.js +160 -0
- package/src/structures/BaseGuild.js +119 -0
- package/src/structures/BaseGuildEmoji.js +56 -0
- package/src/structures/BaseGuildTextChannel.js +186 -0
- package/src/structures/BaseGuildVoiceChannel.js +234 -0
- package/src/structures/BaseInteraction.js +344 -0
- package/src/structures/BaseSelectMenuComponent.js +56 -0
- package/src/structures/ButtonBuilder.js +44 -0
- package/src/structures/ButtonComponent.js +65 -0
- package/src/structures/ButtonInteraction.js +11 -0
- package/src/structures/CategoryChannel.js +45 -0
- package/src/structures/ChannelSelectMenuBuilder.js +31 -0
- package/src/structures/ChannelSelectMenuComponent.js +20 -0
- package/src/structures/ChannelSelectMenuInteraction.js +33 -0
- package/src/structures/ChatInputCommandInteraction.js +41 -0
- package/src/structures/ClientApplication.js +193 -0
- package/src/structures/ClientPresence.js +82 -0
- package/src/structures/ClientUser.js +185 -0
- package/src/structures/CommandInteraction.js +224 -0
- package/src/structures/CommandInteractionOptionResolver.js +308 -0
- package/src/structures/Component.js +47 -0
- package/src/structures/ContextMenuCommandInteraction.js +64 -0
- package/src/structures/DMChannel.js +129 -0
- package/src/structures/DirectoryChannel.js +36 -0
- package/src/structures/Embed.js +220 -0
- package/src/structures/EmbedBuilder.js +41 -0
- package/src/structures/Emoji.js +108 -0
- package/src/structures/ForumChannel.js +264 -0
- package/src/structures/Guild.js +1361 -0
- package/src/structures/GuildAuditLogs.js +91 -0
- package/src/structures/GuildAuditLogsEntry.js +527 -0
- package/src/structures/GuildBan.js +59 -0
- package/src/structures/GuildChannel.js +457 -0
- package/src/structures/GuildEmoji.js +148 -0
- package/src/structures/GuildMember.js +518 -0
- package/src/structures/GuildPreview.js +193 -0
- package/src/structures/GuildPreviewEmoji.js +27 -0
- package/src/structures/GuildScheduledEvent.js +439 -0
- package/src/structures/GuildTemplate.js +241 -0
- package/src/structures/Integration.js +220 -0
- package/src/structures/IntegrationApplication.js +85 -0
- package/src/structures/InteractionCollector.js +263 -0
- package/src/structures/InteractionResponse.js +102 -0
- package/src/structures/InteractionWebhook.js +59 -0
- package/src/structures/Invite.js +322 -0
- package/src/structures/InviteGuild.js +22 -0
- package/src/structures/InviteStageInstance.js +87 -0
- package/src/structures/MentionableSelectMenuBuilder.js +32 -0
- package/src/structures/MentionableSelectMenuComponent.js +11 -0
- package/src/structures/MentionableSelectMenuInteraction.js +71 -0
- package/src/structures/Message.js +997 -0
- package/src/structures/MessageCollector.js +146 -0
- package/src/structures/MessageComponentInteraction.js +107 -0
- package/src/structures/MessageContextMenuCommandInteraction.js +20 -0
- package/src/structures/MessageMentions.js +297 -0
- package/src/structures/MessagePayload.js +299 -0
- package/src/structures/MessageReaction.js +142 -0
- package/src/structures/ModalBuilder.js +34 -0
- package/src/structures/ModalSubmitFields.js +55 -0
- package/src/structures/ModalSubmitInteraction.js +121 -0
- package/src/structures/NewsChannel.js +32 -0
- package/src/structures/OAuth2Guild.js +28 -0
- package/src/structures/PartialGroupDMChannel.js +60 -0
- package/src/structures/PermissionOverwrites.js +196 -0
- package/src/structures/Presence.js +372 -0
- package/src/structures/ReactionCollector.js +229 -0
- package/src/structures/ReactionEmoji.js +31 -0
- package/src/structures/Role.js +458 -0
- package/src/structures/RoleSelectMenuBuilder.js +31 -0
- package/src/structures/RoleSelectMenuComponent.js +11 -0
- package/src/structures/RoleSelectMenuInteraction.js +33 -0
- 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/StageChannel.js +112 -0
- package/src/structures/StageInstance.js +167 -0
- package/src/structures/Sticker.js +272 -0
- package/src/structures/StickerPack.js +95 -0
- package/src/structures/StringSelectMenuBuilder.js +79 -0
- package/src/structures/StringSelectMenuComponent.js +20 -0
- package/src/structures/StringSelectMenuInteraction.js +21 -0
- package/src/structures/StringSelectMenuOptionBuilder.js +49 -0
- package/src/structures/Team.js +117 -0
- package/src/structures/TeamMember.js +70 -0
- package/src/structures/TextChannel.js +33 -0
- package/src/structures/TextInputBuilder.js +31 -0
- package/src/structures/TextInputComponent.js +29 -0
- package/src/structures/ThreadChannel.js +606 -0
- package/src/structures/ThreadMember.js +113 -0
- package/src/structures/Typing.js +74 -0
- package/src/structures/User.js +331 -0
- package/src/structures/UserContextMenuCommandInteraction.js +29 -0
- package/src/structures/UserSelectMenuBuilder.js +31 -0
- package/src/structures/UserSelectMenuComponent.js +11 -0
- package/src/structures/UserSelectMenuInteraction.js +51 -0
- package/src/structures/VoiceChannel.js +96 -0
- package/src/structures/VoiceRegion.js +46 -0
- package/src/structures/VoiceState.js +303 -0
- package/src/structures/Webhook.js +481 -0
- package/src/structures/WelcomeChannel.js +60 -0
- package/src/structures/WelcomeScreen.js +49 -0
- package/src/structures/Widget.js +88 -0
- package/src/structures/WidgetMember.js +99 -0
- package/src/structures/interfaces/Application.js +108 -0
- package/src/structures/interfaces/Collector.js +335 -0
- package/src/structures/interfaces/InteractionResponses.js +320 -0
- package/src/structures/interfaces/TextBasedChannel.js +413 -0
- package/src/util/APITypes.js +456 -0
- package/src/util/ActivityFlagsBitField.js +26 -0
- package/src/util/ApplicationFlagsBitField.js +26 -0
- package/src/util/BitField.js +176 -0
- package/src/util/ChannelFlagsBitField.js +41 -0
- package/src/util/Channels.js +150 -0
- package/src/util/Colors.js +73 -0
- package/src/util/Components.js +152 -0
- package/src/util/Constants.js +230 -0
- package/src/util/DataResolver.js +140 -0
- package/src/util/Enums.js +13 -0
- package/src/util/Events.js +160 -0
- package/src/util/Formatters.js +413 -0
- package/src/util/GuildMemberFlagsBitField.js +41 -0
- package/src/util/IntentsBitField.js +34 -0
- package/src/util/LimitedCollection.js +68 -0
- package/src/util/MessageFlagsBitField.js +32 -0
- package/src/util/Options.js +216 -0
- package/src/util/Partials.js +44 -0
- package/src/util/PermissionsBitField.js +104 -0
- package/src/util/ShardEvents.js +27 -0
- package/src/util/Status.js +33 -0
- package/src/util/Sweepers.js +467 -0
- package/src/util/SystemChannelFlagsBitField.js +43 -0
- package/src/util/ThreadMemberFlagsBitField.js +31 -0
- package/src/util/Transformers.js +36 -0
- package/src/util/UserFlagsBitField.js +32 -0
- package/src/util/Util.js +394 -0
- package/src/util/WebSocketShardEvents.js +25 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const Collector = require('./interfaces/Collector');
|
|
4
|
+
const Events = require('../util/Events');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {CollectorOptions} MessageCollectorOptions
|
|
8
|
+
* @property {number} max The maximum amount of messages to collect
|
|
9
|
+
* @property {number} maxProcessed The maximum amount of messages to process
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Collects messages on a channel.
|
|
14
|
+
* Will automatically stop if the channel ({@link Client#event:channelDelete channelDelete}),
|
|
15
|
+
* thread ({@link Client#event:threadDelete threadDelete}), or
|
|
16
|
+
* guild ({@link Client#event:guildDelete guildDelete}) is deleted.
|
|
17
|
+
* @extends {Collector}
|
|
18
|
+
*/
|
|
19
|
+
class MessageCollector extends Collector {
|
|
20
|
+
/**
|
|
21
|
+
* @param {TextBasedChannels} channel The channel
|
|
22
|
+
* @param {MessageCollectorOptions} options The options to be applied to this collector
|
|
23
|
+
* @emits MessageCollector#message
|
|
24
|
+
*/
|
|
25
|
+
constructor(channel, options = {}) {
|
|
26
|
+
super(channel.client, options);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The channel
|
|
30
|
+
* @type {TextBasedChannels}
|
|
31
|
+
*/
|
|
32
|
+
this.channel = channel;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Total number of messages that were received in the channel during message collection
|
|
36
|
+
* @type {number}
|
|
37
|
+
*/
|
|
38
|
+
this.received = 0;
|
|
39
|
+
|
|
40
|
+
const bulkDeleteListener = messages => {
|
|
41
|
+
for (const message of messages.values()) this.handleDispose(message);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
this._handleChannelDeletion = this._handleChannelDeletion.bind(this);
|
|
45
|
+
this._handleThreadDeletion = this._handleThreadDeletion.bind(this);
|
|
46
|
+
this._handleGuildDeletion = this._handleGuildDeletion.bind(this);
|
|
47
|
+
|
|
48
|
+
this.client.incrementMaxListeners();
|
|
49
|
+
this.client.on(Events.MessageCreate, this.handleCollect);
|
|
50
|
+
this.client.on(Events.MessageDelete, this.handleDispose);
|
|
51
|
+
this.client.on(Events.MessageBulkDelete, bulkDeleteListener);
|
|
52
|
+
this.client.on(Events.ChannelDelete, this._handleChannelDeletion);
|
|
53
|
+
this.client.on(Events.ThreadDelete, this._handleThreadDeletion);
|
|
54
|
+
this.client.on(Events.GuildDelete, this._handleGuildDeletion);
|
|
55
|
+
|
|
56
|
+
this.once('end', () => {
|
|
57
|
+
this.client.removeListener(Events.MessageCreate, this.handleCollect);
|
|
58
|
+
this.client.removeListener(Events.MessageDelete, this.handleDispose);
|
|
59
|
+
this.client.removeListener(Events.MessageBulkDelete, bulkDeleteListener);
|
|
60
|
+
this.client.removeListener(Events.ChannelDelete, this._handleChannelDeletion);
|
|
61
|
+
this.client.removeListener(Events.ThreadDelete, this._handleThreadDeletion);
|
|
62
|
+
this.client.removeListener(Events.GuildDelete, this._handleGuildDeletion);
|
|
63
|
+
this.client.decrementMaxListeners();
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Handles a message for possible collection.
|
|
69
|
+
* @param {Message} message The message that could be collected
|
|
70
|
+
* @returns {?Snowflake}
|
|
71
|
+
* @private
|
|
72
|
+
*/
|
|
73
|
+
collect(message) {
|
|
74
|
+
/**
|
|
75
|
+
* Emitted whenever a message is collected.
|
|
76
|
+
* @event MessageCollector#collect
|
|
77
|
+
* @param {Message} message The message that was collected
|
|
78
|
+
*/
|
|
79
|
+
if (message.channelId !== this.channel.id) return null;
|
|
80
|
+
this.received++;
|
|
81
|
+
return message.id;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Handles a message for possible disposal.
|
|
86
|
+
* @param {Message} message The message that could be disposed of
|
|
87
|
+
* @returns {?Snowflake}
|
|
88
|
+
*/
|
|
89
|
+
dispose(message) {
|
|
90
|
+
/**
|
|
91
|
+
* Emitted whenever a message is disposed of.
|
|
92
|
+
* @event MessageCollector#dispose
|
|
93
|
+
* @param {Message} message The message that was disposed of
|
|
94
|
+
*/
|
|
95
|
+
return message.channelId === this.channel.id ? message.id : null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The reason this collector has ended with, or null if it hasn't ended yet
|
|
100
|
+
* @type {?string}
|
|
101
|
+
* @readonly
|
|
102
|
+
*/
|
|
103
|
+
get endReason() {
|
|
104
|
+
if (this.options.max && this.collected.size >= this.options.max) return 'limit';
|
|
105
|
+
if (this.options.maxProcessed && this.received === this.options.maxProcessed) return 'processedLimit';
|
|
106
|
+
return super.endReason;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Handles checking if the channel has been deleted, and if so, stops the collector with the reason 'channelDelete'.
|
|
111
|
+
* @private
|
|
112
|
+
* @param {GuildChannel} channel The channel that was deleted
|
|
113
|
+
* @returns {void}
|
|
114
|
+
*/
|
|
115
|
+
_handleChannelDeletion(channel) {
|
|
116
|
+
if (channel.id === this.channel.id || channel.id === this.channel.parentId) {
|
|
117
|
+
this.stop('channelDelete');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Handles checking if the thread has been deleted, and if so, stops the collector with the reason 'threadDelete'.
|
|
123
|
+
* @private
|
|
124
|
+
* @param {ThreadChannel} thread The thread that was deleted
|
|
125
|
+
* @returns {void}
|
|
126
|
+
*/
|
|
127
|
+
_handleThreadDeletion(thread) {
|
|
128
|
+
if (thread.id === this.channel.id) {
|
|
129
|
+
this.stop('threadDelete');
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Handles checking if the guild has been deleted, and if so, stops the collector with the reason 'guildDelete'.
|
|
135
|
+
* @private
|
|
136
|
+
* @param {Guild} guild The guild that was deleted
|
|
137
|
+
* @returns {void}
|
|
138
|
+
*/
|
|
139
|
+
_handleGuildDeletion(guild) {
|
|
140
|
+
if (guild.id === this.channel.guild?.id) {
|
|
141
|
+
this.stop('guildDelete');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
module.exports = MessageCollector;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { lazy } = require('@discordjs/util');
|
|
4
|
+
const BaseInteraction = require('./BaseInteraction');
|
|
5
|
+
const InteractionWebhook = require('./InteractionWebhook');
|
|
6
|
+
const InteractionResponses = require('./interfaces/InteractionResponses');
|
|
7
|
+
|
|
8
|
+
const getMessage = lazy(() => require('./Message').Message);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents a message component interaction.
|
|
12
|
+
* @extends {BaseInteraction}
|
|
13
|
+
* @implements {InteractionResponses}
|
|
14
|
+
*/
|
|
15
|
+
class MessageComponentInteraction extends BaseInteraction {
|
|
16
|
+
constructor(client, data) {
|
|
17
|
+
super(client, data);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The id of the channel this interaction was sent in
|
|
21
|
+
* @type {Snowflake}
|
|
22
|
+
* @name MessageComponentInteraction#channelId
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The message to which the component was attached
|
|
27
|
+
* @type {Message}
|
|
28
|
+
*/
|
|
29
|
+
this.message = this.channel?.messages._add(data.message) ?? new (getMessage())(client, data.message);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The custom id of the component which was interacted with
|
|
33
|
+
* @type {string}
|
|
34
|
+
*/
|
|
35
|
+
this.customId = data.data.custom_id;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The type of component which was interacted with
|
|
39
|
+
* @type {ComponentType}
|
|
40
|
+
*/
|
|
41
|
+
this.componentType = data.data.component_type;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Whether the reply to this interaction has been deferred
|
|
45
|
+
* @type {boolean}
|
|
46
|
+
*/
|
|
47
|
+
this.deferred = false;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Whether the reply to this interaction is ephemeral
|
|
51
|
+
* @type {?boolean}
|
|
52
|
+
*/
|
|
53
|
+
this.ephemeral = null;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Whether this interaction has already been replied to
|
|
57
|
+
* @type {boolean}
|
|
58
|
+
*/
|
|
59
|
+
this.replied = false;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* An associated interaction webhook, can be used to further interact with this interaction
|
|
63
|
+
* @type {InteractionWebhook}
|
|
64
|
+
*/
|
|
65
|
+
this.webhook = new InteractionWebhook(this.client, this.applicationId, this.token);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Components that can be placed in an action row for messages.
|
|
70
|
+
* * ButtonComponent
|
|
71
|
+
* * StringSelectMenuComponent
|
|
72
|
+
* * UserSelectMenuComponent
|
|
73
|
+
* * RoleSelectMenuComponent
|
|
74
|
+
* * MentionableSelectMenuComponent
|
|
75
|
+
* * ChannelSelectMenuComponent
|
|
76
|
+
* @typedef {ButtonComponent|StringSelectMenuComponent|UserSelectMenuComponent|
|
|
77
|
+
* RoleSelectMenuComponent|MentionableSelectMenuComponent|ChannelSelectMenuComponent} MessageActionRowComponent
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The component which was interacted with
|
|
82
|
+
* @type {MessageActionRowComponent|APIMessageActionRowComponent}
|
|
83
|
+
* @readonly
|
|
84
|
+
*/
|
|
85
|
+
get component() {
|
|
86
|
+
return this.message.components
|
|
87
|
+
.flatMap(row => row.components)
|
|
88
|
+
.find(component => (component.customId ?? component.custom_id) === this.customId);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// These are here only for documentation purposes - they are implemented by InteractionResponses
|
|
92
|
+
/* eslint-disable no-empty-function */
|
|
93
|
+
deferReply() {}
|
|
94
|
+
reply() {}
|
|
95
|
+
fetchReply() {}
|
|
96
|
+
editReply() {}
|
|
97
|
+
deleteReply() {}
|
|
98
|
+
followUp() {}
|
|
99
|
+
deferUpdate() {}
|
|
100
|
+
update() {}
|
|
101
|
+
showModal() {}
|
|
102
|
+
awaitModalSubmit() {}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
InteractionResponses.applyToClass(MessageComponentInteraction);
|
|
106
|
+
|
|
107
|
+
module.exports = MessageComponentInteraction;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const ContextMenuCommandInteraction = require('./ContextMenuCommandInteraction');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents a message context menu interaction.
|
|
7
|
+
* @extends {ContextMenuCommandInteraction}
|
|
8
|
+
*/
|
|
9
|
+
class MessageContextMenuCommandInteraction extends ContextMenuCommandInteraction {
|
|
10
|
+
/**
|
|
11
|
+
* The message this interaction was sent from
|
|
12
|
+
* @type {Message|APIMessage}
|
|
13
|
+
* @readonly
|
|
14
|
+
*/
|
|
15
|
+
get targetMessage() {
|
|
16
|
+
return this.options.getMessage('message');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = MessageContextMenuCommandInteraction;
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { Collection } = require('@discordjs/collection');
|
|
4
|
+
const { FormattingPatterns } = require('discord-api-types/v10');
|
|
5
|
+
const { flatten } = require('../util/Util');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Keeps track of mentions in a {@link Message}.
|
|
9
|
+
*/
|
|
10
|
+
class MessageMentions {
|
|
11
|
+
/**
|
|
12
|
+
* A regular expression that matches `@everyone` and `@here`.
|
|
13
|
+
* The `mention` group property is present on the `exec` result of this expression.
|
|
14
|
+
* @type {RegExp}
|
|
15
|
+
* @memberof MessageMentions
|
|
16
|
+
*/
|
|
17
|
+
static EveryonePattern = /@(?<mention>everyone|here)/;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A regular expression that matches user mentions like `<@81440962496172032>`.
|
|
21
|
+
* The `id` group property is present on the `exec` result of this expression.
|
|
22
|
+
* @type {RegExp}
|
|
23
|
+
* @memberof MessageMentions
|
|
24
|
+
*/
|
|
25
|
+
static UsersPattern = FormattingPatterns.UserWithOptionalNickname;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A regular expression that matches role mentions like `<@&297577916114403338>`.
|
|
29
|
+
* The `id` group property is present on the `exec` result of this expression.
|
|
30
|
+
* @type {RegExp}
|
|
31
|
+
* @memberof MessageMentions
|
|
32
|
+
*/
|
|
33
|
+
static RolesPattern = FormattingPatterns.Role;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A regular expression that matches channel mentions like `<#222079895583457280>`.
|
|
37
|
+
* The `id` group property is present on the `exec` result of this expression.
|
|
38
|
+
* @type {RegExp}
|
|
39
|
+
* @memberof MessageMentions
|
|
40
|
+
*/
|
|
41
|
+
static ChannelsPattern = FormattingPatterns.Channel;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A global regular expression variant of {@link MessageMentions.ChannelsPattern}.
|
|
45
|
+
* @type {RegExp}
|
|
46
|
+
* @memberof MessageMentions
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
static GlobalChannelsPattern = new RegExp(this.ChannelsPattern.source, 'g');
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* A global regular expression variant of {@link MessageMentions.UsersPattern}.
|
|
53
|
+
* @type {RegExp}
|
|
54
|
+
* @memberof MessageMentions
|
|
55
|
+
* @private
|
|
56
|
+
*/
|
|
57
|
+
static GlobalUsersPattern = new RegExp(this.UsersPattern.source, 'g');
|
|
58
|
+
|
|
59
|
+
constructor(message, users, roles, everyone, crosspostedChannels, repliedUser) {
|
|
60
|
+
/**
|
|
61
|
+
* The client the message is from
|
|
62
|
+
* @type {Client}
|
|
63
|
+
* @readonly
|
|
64
|
+
*/
|
|
65
|
+
Object.defineProperty(this, 'client', { value: message.client });
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The guild the message is in
|
|
69
|
+
* @type {?Guild}
|
|
70
|
+
* @readonly
|
|
71
|
+
*/
|
|
72
|
+
Object.defineProperty(this, 'guild', { value: message.guild });
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The initial message content
|
|
76
|
+
* @type {string}
|
|
77
|
+
* @readonly
|
|
78
|
+
* @private
|
|
79
|
+
*/
|
|
80
|
+
Object.defineProperty(this, '_content', { value: message.content });
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Whether `@everyone` or `@here` were mentioned
|
|
84
|
+
* @type {boolean}
|
|
85
|
+
*/
|
|
86
|
+
this.everyone = Boolean(everyone);
|
|
87
|
+
|
|
88
|
+
if (users) {
|
|
89
|
+
if (users instanceof Collection) {
|
|
90
|
+
/**
|
|
91
|
+
* Any users that were mentioned
|
|
92
|
+
* <info>Order as received from the API, not as they appear in the message content</info>
|
|
93
|
+
* @type {Collection<Snowflake, User>}
|
|
94
|
+
*/
|
|
95
|
+
this.users = new Collection(users);
|
|
96
|
+
} else {
|
|
97
|
+
this.users = new Collection();
|
|
98
|
+
for (const mention of users) {
|
|
99
|
+
if (mention.member && message.guild) {
|
|
100
|
+
message.guild.members._add(Object.assign(mention.member, { user: mention }));
|
|
101
|
+
}
|
|
102
|
+
const user = message.client.users._add(mention);
|
|
103
|
+
this.users.set(user.id, user);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
this.users = new Collection();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (roles instanceof Collection) {
|
|
111
|
+
/**
|
|
112
|
+
* Any roles that were mentioned
|
|
113
|
+
* <info>Order as received from the API, not as they appear in the message content</info>
|
|
114
|
+
* @type {Collection<Snowflake, Role>}
|
|
115
|
+
*/
|
|
116
|
+
this.roles = new Collection(roles);
|
|
117
|
+
} else if (roles) {
|
|
118
|
+
this.roles = new Collection();
|
|
119
|
+
const guild = message.guild;
|
|
120
|
+
if (guild) {
|
|
121
|
+
for (const mention of roles) {
|
|
122
|
+
const role = guild.roles.cache.get(mention);
|
|
123
|
+
if (role) this.roles.set(role.id, role);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
this.roles = new Collection();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Cached members for {@link MessageMentions#members}
|
|
132
|
+
* @type {?Collection<Snowflake, GuildMember>}
|
|
133
|
+
* @private
|
|
134
|
+
*/
|
|
135
|
+
this._members = null;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Cached channels for {@link MessageMentions#channels}
|
|
139
|
+
* @type {?Collection<Snowflake, BaseChannel>}
|
|
140
|
+
* @private
|
|
141
|
+
*/
|
|
142
|
+
this._channels = null;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Cached users for {@link MessageMentions#parsedUsers}
|
|
146
|
+
* @type {?Collection<Snowflake, User>}
|
|
147
|
+
* @private
|
|
148
|
+
*/
|
|
149
|
+
this._parsedUsers = null;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Crossposted channel data.
|
|
153
|
+
* @typedef {Object} CrosspostedChannel
|
|
154
|
+
* @property {Snowflake} channelId The mentioned channel's id
|
|
155
|
+
* @property {Snowflake} guildId The id of the guild that has the channel
|
|
156
|
+
* @property {ChannelType} type The channel's type
|
|
157
|
+
* @property {string} name The channel's name
|
|
158
|
+
*/
|
|
159
|
+
|
|
160
|
+
if (crosspostedChannels) {
|
|
161
|
+
if (crosspostedChannels instanceof Collection) {
|
|
162
|
+
/**
|
|
163
|
+
* A collection of crossposted channels
|
|
164
|
+
* <info>Order as received from the API, not as they appear in the message content</info>
|
|
165
|
+
* @type {Collection<Snowflake, CrosspostedChannel>}
|
|
166
|
+
*/
|
|
167
|
+
this.crosspostedChannels = new Collection(crosspostedChannels);
|
|
168
|
+
} else {
|
|
169
|
+
this.crosspostedChannels = new Collection();
|
|
170
|
+
for (const d of crosspostedChannels) {
|
|
171
|
+
this.crosspostedChannels.set(d.id, {
|
|
172
|
+
channelId: d.id,
|
|
173
|
+
guildId: d.guild_id,
|
|
174
|
+
type: d.type,
|
|
175
|
+
name: d.name,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
} else {
|
|
180
|
+
this.crosspostedChannels = new Collection();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The author of the message that this message is a reply to
|
|
185
|
+
* @type {?User}
|
|
186
|
+
*/
|
|
187
|
+
this.repliedUser = repliedUser ? this.client.users._add(repliedUser) : null;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Any members that were mentioned (only in {@link Guild}s)
|
|
192
|
+
* <info>Order as received from the API, not as they appear in the message content</info>
|
|
193
|
+
* @type {?Collection<Snowflake, GuildMember>}
|
|
194
|
+
* @readonly
|
|
195
|
+
*/
|
|
196
|
+
get members() {
|
|
197
|
+
if (this._members) return this._members;
|
|
198
|
+
if (!this.guild) return null;
|
|
199
|
+
this._members = new Collection();
|
|
200
|
+
this.users.forEach(user => {
|
|
201
|
+
const member = this.guild.members.resolve(user);
|
|
202
|
+
if (member) this._members.set(member.user.id, member);
|
|
203
|
+
});
|
|
204
|
+
return this._members;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Any channels that were mentioned
|
|
209
|
+
* <info>Order as they appear first in the message content</info>
|
|
210
|
+
* @type {Collection<Snowflake, BaseChannel>}
|
|
211
|
+
* @readonly
|
|
212
|
+
*/
|
|
213
|
+
get channels() {
|
|
214
|
+
if (this._channels) return this._channels;
|
|
215
|
+
this._channels = new Collection();
|
|
216
|
+
let matches;
|
|
217
|
+
|
|
218
|
+
while ((matches = this.constructor.GlobalChannelsPattern.exec(this._content)) !== null) {
|
|
219
|
+
const channel = this.client.channels.cache.get(matches.groups.id);
|
|
220
|
+
if (channel) this._channels.set(channel.id, channel);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return this._channels;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Any user mentions that were included in the message content
|
|
228
|
+
* <info>Order as they appear first in the message content</info>
|
|
229
|
+
* @type {Collection<Snowflake, User>}
|
|
230
|
+
* @readonly
|
|
231
|
+
*/
|
|
232
|
+
get parsedUsers() {
|
|
233
|
+
if (this._parsedUsers) return this._parsedUsers;
|
|
234
|
+
this._parsedUsers = new Collection();
|
|
235
|
+
let matches;
|
|
236
|
+
while ((matches = this.constructor.GlobalUsersPattern.exec(this._content)) !== null) {
|
|
237
|
+
const user = this.client.users.cache.get(matches[1]);
|
|
238
|
+
if (user) this._parsedUsers.set(user.id, user);
|
|
239
|
+
}
|
|
240
|
+
return this._parsedUsers;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Options used to check for a mention.
|
|
245
|
+
* @typedef {Object} MessageMentionsHasOptions
|
|
246
|
+
* @property {boolean} [ignoreDirect=false] Whether to ignore direct mentions to the item
|
|
247
|
+
* @property {boolean} [ignoreRoles=false] Whether to ignore role mentions to a guild member
|
|
248
|
+
* @property {boolean} [ignoreRepliedUser=false] Whether to ignore replied user mention to an user
|
|
249
|
+
* @property {boolean} [ignoreEveryone=false] Whether to ignore `@everyone`/`@here` mentions
|
|
250
|
+
*/
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Checks if a user, guild member, thread member, role, or channel is mentioned.
|
|
254
|
+
* Takes into account user mentions, role mentions, channel mentions,
|
|
255
|
+
* replied user mention, and `@everyone`/`@here` mentions.
|
|
256
|
+
* @param {UserResolvable|RoleResolvable|ChannelResolvable} data The User/Role/Channel to check for
|
|
257
|
+
* @param {MessageMentionsHasOptions} [options] The options for the check
|
|
258
|
+
* @returns {boolean}
|
|
259
|
+
*/
|
|
260
|
+
has(data, { ignoreDirect = false, ignoreRoles = false, ignoreRepliedUser = false, ignoreEveryone = false } = {}) {
|
|
261
|
+
const user = this.client.users.resolve(data);
|
|
262
|
+
|
|
263
|
+
if (!ignoreEveryone && user && this.everyone) return true;
|
|
264
|
+
|
|
265
|
+
const userWasRepliedTo = user && this.repliedUser?.id === user.id;
|
|
266
|
+
|
|
267
|
+
if (!ignoreRepliedUser && userWasRepliedTo && this.users.has(user.id)) return true;
|
|
268
|
+
|
|
269
|
+
if (!ignoreDirect) {
|
|
270
|
+
if (user && (!ignoreRepliedUser || this.parsedUsers.has(user.id)) && this.users.has(user.id)) return true;
|
|
271
|
+
|
|
272
|
+
const role = this.guild?.roles.resolve(data);
|
|
273
|
+
if (role && this.roles.has(role.id)) return true;
|
|
274
|
+
|
|
275
|
+
const channel = this.client.channels.resolve(data);
|
|
276
|
+
if (channel && this.channels.has(channel.id)) return true;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (!ignoreRoles) {
|
|
280
|
+
const member = this.guild?.members.resolve(data);
|
|
281
|
+
if (member) {
|
|
282
|
+
for (const mentionedRole of this.roles.values()) if (member.roles.cache.has(mentionedRole.id)) return true;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
toJSON() {
|
|
290
|
+
return flatten(this, {
|
|
291
|
+
members: true,
|
|
292
|
+
channels: true,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
module.exports = MessageMentions;
|