lolka.js 0.1.3 → 0.2.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 +21 -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/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 +227 -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 +2392 -1768
- package/typings/index.d.ts +2392 -1768
- 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
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
const { Collection } = require('@discordjs/collection');
|
|
4
4
|
const { PermissionFlagsBits } = require('discord-api-types/v10');
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const GuildChannel = require('./GuildChannel');
|
|
6
|
+
const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
|
7
|
+
const GuildMessageManager = require('../managers/GuildMessageManager');
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Represents a voice-based guild channel on Discord.
|
|
11
|
-
*
|
|
12
11
|
* @extends {GuildChannel}
|
|
13
12
|
* @implements {TextBasedChannel}
|
|
14
13
|
*/
|
|
@@ -17,14 +16,12 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
17
16
|
super(guild, data, client, false);
|
|
18
17
|
/**
|
|
19
18
|
* A manager of the messages sent to this channel
|
|
20
|
-
*
|
|
21
19
|
* @type {GuildMessageManager}
|
|
22
20
|
*/
|
|
23
21
|
this.messages = new GuildMessageManager(this);
|
|
24
22
|
|
|
25
23
|
/**
|
|
26
24
|
* If the guild considers this channel NSFW
|
|
27
|
-
*
|
|
28
25
|
* @type {boolean}
|
|
29
26
|
*/
|
|
30
27
|
this.nsfw = Boolean(data.nsfw);
|
|
@@ -38,7 +35,6 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
38
35
|
if ('rtc_region' in data) {
|
|
39
36
|
/**
|
|
40
37
|
* The RTC region for this voice-based channel. This region is automatically selected if `null`.
|
|
41
|
-
*
|
|
42
38
|
* @type {?string}
|
|
43
39
|
*/
|
|
44
40
|
this.rtcRegion = data.rtc_region;
|
|
@@ -47,7 +43,6 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
47
43
|
if ('bitrate' in data) {
|
|
48
44
|
/**
|
|
49
45
|
* The bitrate of this voice-based channel
|
|
50
|
-
*
|
|
51
46
|
* @type {number}
|
|
52
47
|
*/
|
|
53
48
|
this.bitrate = data.bitrate;
|
|
@@ -56,7 +51,6 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
56
51
|
if ('user_limit' in data) {
|
|
57
52
|
/**
|
|
58
53
|
* The maximum amount of users allowed in this channel.
|
|
59
|
-
*
|
|
60
54
|
* @type {number}
|
|
61
55
|
*/
|
|
62
56
|
this.userLimit = data.user_limit;
|
|
@@ -65,7 +59,6 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
65
59
|
if ('video_quality_mode' in data) {
|
|
66
60
|
/**
|
|
67
61
|
* The camera video quality mode of the channel.
|
|
68
|
-
*
|
|
69
62
|
* @type {?VideoQualityMode}
|
|
70
63
|
*/
|
|
71
64
|
this.videoQualityMode = data.video_quality_mode;
|
|
@@ -76,7 +69,6 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
76
69
|
if ('last_message_id' in data) {
|
|
77
70
|
/**
|
|
78
71
|
* The last message id sent in the channel, if one was sent
|
|
79
|
-
*
|
|
80
72
|
* @type {?Snowflake}
|
|
81
73
|
*/
|
|
82
74
|
this.lastMessageId = data.last_message_id;
|
|
@@ -89,7 +81,6 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
89
81
|
if ('rate_limit_per_user' in data) {
|
|
90
82
|
/**
|
|
91
83
|
* The rate limit per user (slowmode) for this channel in seconds
|
|
92
|
-
*
|
|
93
84
|
* @type {number}
|
|
94
85
|
*/
|
|
95
86
|
this.rateLimitPerUser = data.rate_limit_per_user;
|
|
@@ -102,7 +93,6 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
102
93
|
|
|
103
94
|
/**
|
|
104
95
|
* The members in this voice-based channel
|
|
105
|
-
*
|
|
106
96
|
* @type {Collection<Snowflake, GuildMember>}
|
|
107
97
|
* @readonly
|
|
108
98
|
*/
|
|
@@ -113,13 +103,11 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
113
103
|
coll.set(state.id, state.member);
|
|
114
104
|
}
|
|
115
105
|
}
|
|
116
|
-
|
|
117
106
|
return coll;
|
|
118
107
|
}
|
|
119
108
|
|
|
120
109
|
/**
|
|
121
110
|
* Checks if the voice-based channel is full
|
|
122
|
-
*
|
|
123
111
|
* @type {boolean}
|
|
124
112
|
* @readonly
|
|
125
113
|
*/
|
|
@@ -129,7 +117,6 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
129
117
|
|
|
130
118
|
/**
|
|
131
119
|
* Whether the channel is joinable by the client user
|
|
132
|
-
*
|
|
133
120
|
* @type {boolean}
|
|
134
121
|
* @readonly
|
|
135
122
|
*/
|
|
@@ -149,7 +136,6 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
149
136
|
|
|
150
137
|
/**
|
|
151
138
|
* Creates an invite to this guild channel.
|
|
152
|
-
*
|
|
153
139
|
* @param {InviteCreateOptions} [options={}] The options for creating the invite
|
|
154
140
|
* @returns {Promise<Invite>}
|
|
155
141
|
* @example
|
|
@@ -158,23 +144,21 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
158
144
|
* .then(invite => console.log(`Created an invite with a code of ${invite.code}`))
|
|
159
145
|
* .catch(console.error);
|
|
160
146
|
*/
|
|
161
|
-
|
|
147
|
+
createInvite(options) {
|
|
162
148
|
return this.guild.invites.create(this.id, options);
|
|
163
149
|
}
|
|
164
150
|
|
|
165
151
|
/**
|
|
166
152
|
* Fetches a collection of invites to this guild channel.
|
|
167
|
-
*
|
|
168
153
|
* @param {boolean} [cache=true] Whether to cache the fetched invites
|
|
169
154
|
* @returns {Promise<Collection<string, Invite>>}
|
|
170
155
|
*/
|
|
171
|
-
|
|
156
|
+
fetchInvites(cache = true) {
|
|
172
157
|
return this.guild.invites.fetch({ channelId: this.id, cache });
|
|
173
158
|
}
|
|
174
159
|
|
|
175
160
|
/**
|
|
176
161
|
* Sets the bitrate of the channel.
|
|
177
|
-
*
|
|
178
162
|
* @param {number} bitrate The new bitrate
|
|
179
163
|
* @param {string} [reason] Reason for changing the channel's bitrate
|
|
180
164
|
* @returns {Promise<BaseGuildVoiceChannel>}
|
|
@@ -184,13 +168,12 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
184
168
|
* .then(channel => console.log(`Set bitrate to ${channel.bitrate}bps for ${channel.name}`))
|
|
185
169
|
* .catch(console.error);
|
|
186
170
|
*/
|
|
187
|
-
|
|
171
|
+
setBitrate(bitrate, reason) {
|
|
188
172
|
return this.edit({ bitrate, reason });
|
|
189
173
|
}
|
|
190
174
|
|
|
191
175
|
/**
|
|
192
176
|
* Sets the RTC region of the channel.
|
|
193
|
-
*
|
|
194
177
|
* @param {?string} rtcRegion The new region of the channel. Set to `null` to remove a specific region for the channel
|
|
195
178
|
* @param {string} [reason] The reason for modifying this region.
|
|
196
179
|
* @returns {Promise<BaseGuildVoiceChannel>}
|
|
@@ -201,13 +184,12 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
201
184
|
* // Remove a fixed region for this channel - let Discord decide automatically
|
|
202
185
|
* channel.setRTCRegion(null, 'We want to let Discord decide.');
|
|
203
186
|
*/
|
|
204
|
-
|
|
187
|
+
setRTCRegion(rtcRegion, reason) {
|
|
205
188
|
return this.edit({ rtcRegion, reason });
|
|
206
189
|
}
|
|
207
190
|
|
|
208
191
|
/**
|
|
209
192
|
* Sets the user limit of the channel.
|
|
210
|
-
*
|
|
211
193
|
* @param {number} userLimit The new user limit
|
|
212
194
|
* @param {string} [reason] Reason for changing the user limit
|
|
213
195
|
* @returns {Promise<BaseGuildVoiceChannel>}
|
|
@@ -217,49 +199,36 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
|
|
217
199
|
* .then(channel => console.log(`Set user limit to ${channel.userLimit} for ${channel.name}`))
|
|
218
200
|
* .catch(console.error);
|
|
219
201
|
*/
|
|
220
|
-
|
|
202
|
+
setUserLimit(userLimit, reason) {
|
|
221
203
|
return this.edit({ userLimit, reason });
|
|
222
204
|
}
|
|
223
205
|
|
|
224
206
|
/**
|
|
225
207
|
* Sets the camera video quality mode of the channel.
|
|
226
|
-
*
|
|
227
208
|
* @param {VideoQualityMode} videoQualityMode The new camera video quality mode.
|
|
228
209
|
* @param {string} [reason] Reason for changing the camera video quality mode.
|
|
229
210
|
* @returns {Promise<BaseGuildVoiceChannel>}
|
|
230
211
|
*/
|
|
231
|
-
|
|
212
|
+
setVideoQualityMode(videoQualityMode, reason) {
|
|
232
213
|
return this.edit({ videoQualityMode, reason });
|
|
233
214
|
}
|
|
234
215
|
|
|
235
216
|
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
|
236
|
-
|
|
237
|
-
// eslint-disable-next-line getter-return
|
|
217
|
+
/* eslint-disable no-empty-function */
|
|
238
218
|
get lastMessage() {}
|
|
239
|
-
|
|
240
219
|
send() {}
|
|
241
|
-
|
|
242
220
|
sendTyping() {}
|
|
243
|
-
|
|
244
221
|
createMessageCollector() {}
|
|
245
|
-
|
|
246
222
|
awaitMessages() {}
|
|
247
|
-
|
|
248
223
|
createMessageComponentCollector() {}
|
|
249
|
-
|
|
250
224
|
awaitMessageComponent() {}
|
|
251
|
-
|
|
252
225
|
bulkDelete() {}
|
|
253
|
-
|
|
254
226
|
fetchWebhooks() {}
|
|
255
|
-
|
|
256
227
|
createWebhook() {}
|
|
257
|
-
|
|
258
228
|
setRateLimitPerUser() {}
|
|
259
|
-
|
|
260
229
|
setNSFW() {}
|
|
261
230
|
}
|
|
262
231
|
|
|
263
|
-
TextBasedChannel.applyToClass(BaseGuildVoiceChannel, ['lastPinAt']);
|
|
232
|
+
TextBasedChannel.applyToClass(BaseGuildVoiceChannel, true, ['lastPinAt']);
|
|
264
233
|
|
|
265
|
-
exports
|
|
234
|
+
module.exports = BaseGuildVoiceChannel;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const { deprecate } = require('node:util');
|
|
3
4
|
const { Collection } = require('@discordjs/collection');
|
|
4
5
|
const { DiscordSnowflake } = require('../util/LolkaSnowflake');
|
|
5
6
|
const { InteractionType, ApplicationCommandType, ComponentType } = require('discord-api-types/v10');
|
|
6
|
-
const
|
|
7
|
-
const {
|
|
8
|
-
const
|
|
9
|
-
const { Base } = require('./Base.js');
|
|
7
|
+
const Base = require('./Base');
|
|
8
|
+
const { SelectMenuTypes } = require('../util/Constants');
|
|
9
|
+
const PermissionsBitField = require('../util/PermissionsBitField');
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Represents an interaction.
|
|
13
|
-
*
|
|
14
13
|
* @extends {Base}
|
|
15
14
|
* @abstract
|
|
16
15
|
*/
|
|
@@ -20,21 +19,18 @@ class BaseInteraction extends Base {
|
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* The interaction's type
|
|
23
|
-
*
|
|
24
22
|
* @type {InteractionType}
|
|
25
23
|
*/
|
|
26
24
|
this.type = data.type;
|
|
27
25
|
|
|
28
26
|
/**
|
|
29
27
|
* The interaction's id
|
|
30
|
-
*
|
|
31
28
|
* @type {Snowflake}
|
|
32
29
|
*/
|
|
33
30
|
this.id = data.id;
|
|
34
31
|
|
|
35
32
|
/**
|
|
36
33
|
* The interaction's token
|
|
37
|
-
*
|
|
38
34
|
* @type {string}
|
|
39
35
|
* @name BaseInteraction#token
|
|
40
36
|
* @readonly
|
|
@@ -43,56 +39,48 @@ class BaseInteraction extends Base {
|
|
|
43
39
|
|
|
44
40
|
/**
|
|
45
41
|
* The application's id
|
|
46
|
-
*
|
|
47
42
|
* @type {Snowflake}
|
|
48
43
|
*/
|
|
49
44
|
this.applicationId = data.application_id;
|
|
50
45
|
|
|
51
46
|
/**
|
|
52
47
|
* The id of the channel this interaction was sent in
|
|
53
|
-
*
|
|
54
48
|
* @type {?Snowflake}
|
|
55
49
|
*/
|
|
56
50
|
this.channelId = data.channel?.id ?? null;
|
|
57
51
|
|
|
58
52
|
/**
|
|
59
53
|
* The id of the guild this interaction was sent in
|
|
60
|
-
*
|
|
61
54
|
* @type {?Snowflake}
|
|
62
55
|
*/
|
|
63
56
|
this.guildId = data.guild_id ?? null;
|
|
64
57
|
|
|
65
58
|
/**
|
|
66
59
|
* The user who created this interaction
|
|
67
|
-
*
|
|
68
60
|
* @type {User}
|
|
69
61
|
*/
|
|
70
62
|
this.user = this.client.users._add(data.user ?? data.member.user);
|
|
71
63
|
|
|
72
64
|
/**
|
|
73
65
|
* If this interaction was sent in a guild, the member which sent it
|
|
74
|
-
*
|
|
75
66
|
* @type {?(GuildMember|APIInteractionGuildMember)}
|
|
76
67
|
*/
|
|
77
68
|
this.member = data.member ? (this.guild?.members._add(data.member) ?? data.member) : null;
|
|
78
69
|
|
|
79
70
|
/**
|
|
80
71
|
* The version
|
|
81
|
-
*
|
|
82
72
|
* @type {number}
|
|
83
73
|
*/
|
|
84
74
|
this.version = data.version;
|
|
85
75
|
|
|
86
76
|
/**
|
|
87
77
|
* Set of permissions the application or bot has within the channel the interaction was sent from
|
|
88
|
-
*
|
|
89
78
|
* @type {Readonly<PermissionsBitField>}
|
|
90
79
|
*/
|
|
91
80
|
this.appPermissions = new PermissionsBitField(data.app_permissions).freeze();
|
|
92
81
|
|
|
93
82
|
/**
|
|
94
83
|
* The permissions of the member, if one exists, in the channel this interaction was executed in
|
|
95
|
-
*
|
|
96
84
|
* @type {?Readonly<PermissionsBitField>}
|
|
97
85
|
*/
|
|
98
86
|
this.memberPermissions = data.member?.permissions
|
|
@@ -101,21 +89,18 @@ class BaseInteraction extends Base {
|
|
|
101
89
|
|
|
102
90
|
/**
|
|
103
91
|
* The locale of the user who invoked this interaction
|
|
104
|
-
*
|
|
105
92
|
* @type {Locale}
|
|
106
93
|
*/
|
|
107
94
|
this.locale = data.locale;
|
|
108
95
|
|
|
109
96
|
/**
|
|
110
97
|
* The preferred locale from the guild this interaction was sent in
|
|
111
|
-
*
|
|
112
98
|
* @type {?Locale}
|
|
113
99
|
*/
|
|
114
100
|
this.guildLocale = data.guild_locale ?? null;
|
|
115
101
|
|
|
116
102
|
/**
|
|
117
103
|
* The entitlements for the invoking user, representing access to premium SKUs
|
|
118
|
-
*
|
|
119
104
|
* @type {Collection<Snowflake, Entitlement>}
|
|
120
105
|
*/
|
|
121
106
|
this.entitlements = data.entitlements.reduce(
|
|
@@ -123,27 +108,23 @@ class BaseInteraction extends Base {
|
|
|
123
108
|
new Collection(),
|
|
124
109
|
);
|
|
125
110
|
|
|
111
|
+
/* eslint-disable max-len */
|
|
126
112
|
/**
|
|
127
|
-
* Mapping of
|
|
128
|
-
*
|
|
129
|
-
* @type {AuthorizingIntegrationOwners}
|
|
113
|
+
* Mapping of installation contexts that the interaction was authorized for the related user or guild ids
|
|
114
|
+
* @type {APIAuthorizingIntegrationOwnersMap}
|
|
130
115
|
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object}
|
|
131
116
|
*/
|
|
132
|
-
this.authorizingIntegrationOwners =
|
|
133
|
-
|
|
134
|
-
data.authorizing_integration_owners,
|
|
135
|
-
);
|
|
117
|
+
this.authorizingIntegrationOwners = data.authorizing_integration_owners;
|
|
118
|
+
/* eslint-enable max-len */
|
|
136
119
|
|
|
137
120
|
/**
|
|
138
121
|
* Context where the interaction was triggered from
|
|
139
|
-
*
|
|
140
122
|
* @type {?InteractionContextType}
|
|
141
123
|
*/
|
|
142
124
|
this.context = data.context ?? null;
|
|
143
125
|
|
|
144
126
|
/**
|
|
145
127
|
* Attachment size limit in bytes
|
|
146
|
-
*
|
|
147
128
|
* @type {number}
|
|
148
129
|
*/
|
|
149
130
|
this.attachmentSizeLimit = data.attachment_size_limit;
|
|
@@ -151,7 +132,6 @@ class BaseInteraction extends Base {
|
|
|
151
132
|
|
|
152
133
|
/**
|
|
153
134
|
* The timestamp the interaction was created at
|
|
154
|
-
*
|
|
155
135
|
* @type {number}
|
|
156
136
|
* @readonly
|
|
157
137
|
*/
|
|
@@ -161,7 +141,6 @@ class BaseInteraction extends Base {
|
|
|
161
141
|
|
|
162
142
|
/**
|
|
163
143
|
* The time the interaction was created at
|
|
164
|
-
*
|
|
165
144
|
* @type {Date}
|
|
166
145
|
* @readonly
|
|
167
146
|
*/
|
|
@@ -171,7 +150,6 @@ class BaseInteraction extends Base {
|
|
|
171
150
|
|
|
172
151
|
/**
|
|
173
152
|
* The channel this interaction was sent in
|
|
174
|
-
*
|
|
175
153
|
* @type {?TextBasedChannels}
|
|
176
154
|
* @readonly
|
|
177
155
|
*/
|
|
@@ -181,7 +159,6 @@ class BaseInteraction extends Base {
|
|
|
181
159
|
|
|
182
160
|
/**
|
|
183
161
|
* The guild this interaction was sent in
|
|
184
|
-
*
|
|
185
162
|
* @type {?Guild}
|
|
186
163
|
* @readonly
|
|
187
164
|
*/
|
|
@@ -191,7 +168,6 @@ class BaseInteraction extends Base {
|
|
|
191
168
|
|
|
192
169
|
/**
|
|
193
170
|
* Indicates whether this interaction is received from a guild.
|
|
194
|
-
*
|
|
195
171
|
* @returns {boolean}
|
|
196
172
|
*/
|
|
197
173
|
inGuild() {
|
|
@@ -200,7 +176,6 @@ class BaseInteraction extends Base {
|
|
|
200
176
|
|
|
201
177
|
/**
|
|
202
178
|
* Indicates whether this interaction is received from a cached guild.
|
|
203
|
-
*
|
|
204
179
|
* @returns {boolean}
|
|
205
180
|
*/
|
|
206
181
|
inCachedGuild() {
|
|
@@ -209,7 +184,6 @@ class BaseInteraction extends Base {
|
|
|
209
184
|
|
|
210
185
|
/**
|
|
211
186
|
* Indicates whether or not this interaction is received from an uncached guild.
|
|
212
|
-
*
|
|
213
187
|
* @returns {boolean}
|
|
214
188
|
*/
|
|
215
189
|
inRawGuild() {
|
|
@@ -218,7 +192,6 @@ class BaseInteraction extends Base {
|
|
|
218
192
|
|
|
219
193
|
/**
|
|
220
194
|
* Indicates whether this interaction is an {@link AutocompleteInteraction}
|
|
221
|
-
*
|
|
222
195
|
* @returns {boolean}
|
|
223
196
|
*/
|
|
224
197
|
isAutocomplete() {
|
|
@@ -227,7 +200,6 @@ class BaseInteraction extends Base {
|
|
|
227
200
|
|
|
228
201
|
/**
|
|
229
202
|
* Indicates whether this interaction is a {@link CommandInteraction}
|
|
230
|
-
*
|
|
231
203
|
* @returns {boolean}
|
|
232
204
|
*/
|
|
233
205
|
isCommand() {
|
|
@@ -236,7 +208,6 @@ class BaseInteraction extends Base {
|
|
|
236
208
|
|
|
237
209
|
/**
|
|
238
210
|
* Indicates whether this interaction is a {@link ChatInputCommandInteraction}.
|
|
239
|
-
*
|
|
240
211
|
* @returns {boolean}
|
|
241
212
|
*/
|
|
242
213
|
isChatInputCommand() {
|
|
@@ -245,7 +216,6 @@ class BaseInteraction extends Base {
|
|
|
245
216
|
|
|
246
217
|
/**
|
|
247
218
|
* Indicates whether this interaction is a {@link ContextMenuCommandInteraction}
|
|
248
|
-
*
|
|
249
219
|
* @returns {boolean}
|
|
250
220
|
*/
|
|
251
221
|
isContextMenuCommand() {
|
|
@@ -257,7 +227,6 @@ class BaseInteraction extends Base {
|
|
|
257
227
|
|
|
258
228
|
/**
|
|
259
229
|
* Indicates whether this interaction is a {@link PrimaryEntryPointCommandInteraction}
|
|
260
|
-
*
|
|
261
230
|
* @returns {boolean}
|
|
262
231
|
*/
|
|
263
232
|
isPrimaryEntryPointCommand() {
|
|
@@ -268,7 +237,6 @@ class BaseInteraction extends Base {
|
|
|
268
237
|
|
|
269
238
|
/**
|
|
270
239
|
* Indicates whether this interaction is a {@link MessageComponentInteraction}
|
|
271
|
-
*
|
|
272
240
|
* @returns {boolean}
|
|
273
241
|
*/
|
|
274
242
|
isMessageComponent() {
|
|
@@ -277,7 +245,6 @@ class BaseInteraction extends Base {
|
|
|
277
245
|
|
|
278
246
|
/**
|
|
279
247
|
* Indicates whether this interaction is a {@link ModalSubmitInteraction}
|
|
280
|
-
*
|
|
281
248
|
* @returns {boolean}
|
|
282
249
|
*/
|
|
283
250
|
isModalSubmit() {
|
|
@@ -286,7 +253,6 @@ class BaseInteraction extends Base {
|
|
|
286
253
|
|
|
287
254
|
/**
|
|
288
255
|
* Indicates whether this interaction is a {@link UserContextMenuCommandInteraction}
|
|
289
|
-
*
|
|
290
256
|
* @returns {boolean}
|
|
291
257
|
*/
|
|
292
258
|
isUserContextMenuCommand() {
|
|
@@ -295,7 +261,6 @@ class BaseInteraction extends Base {
|
|
|
295
261
|
|
|
296
262
|
/**
|
|
297
263
|
* Indicates whether this interaction is a {@link MessageContextMenuCommandInteraction}
|
|
298
|
-
*
|
|
299
264
|
* @returns {boolean}
|
|
300
265
|
*/
|
|
301
266
|
isMessageContextMenuCommand() {
|
|
@@ -304,7 +269,6 @@ class BaseInteraction extends Base {
|
|
|
304
269
|
|
|
305
270
|
/**
|
|
306
271
|
* Indicates whether this interaction is a {@link ButtonInteraction}.
|
|
307
|
-
*
|
|
308
272
|
* @returns {boolean}
|
|
309
273
|
*/
|
|
310
274
|
isButton() {
|
|
@@ -312,17 +276,24 @@ class BaseInteraction extends Base {
|
|
|
312
276
|
}
|
|
313
277
|
|
|
314
278
|
/**
|
|
315
|
-
* Indicates whether this interaction is a
|
|
316
|
-
*
|
|
279
|
+
* Indicates whether this interaction is a {@link StringSelectMenuInteraction}.
|
|
317
280
|
* @returns {boolean}
|
|
281
|
+
* @deprecated Use {@link BaseInteraction#isStringSelectMenu} instead.
|
|
318
282
|
*/
|
|
319
283
|
isSelectMenu() {
|
|
284
|
+
return this.isStringSelectMenu();
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Indicates whether this interaction is a select menu of any known type.
|
|
289
|
+
* @returns {boolean}
|
|
290
|
+
*/
|
|
291
|
+
isAnySelectMenu() {
|
|
320
292
|
return this.type === InteractionType.MessageComponent && SelectMenuTypes.includes(this.componentType);
|
|
321
293
|
}
|
|
322
294
|
|
|
323
295
|
/**
|
|
324
296
|
* Indicates whether this interaction is a {@link StringSelectMenuInteraction}.
|
|
325
|
-
*
|
|
326
297
|
* @returns {boolean}
|
|
327
298
|
*/
|
|
328
299
|
isStringSelectMenu() {
|
|
@@ -331,7 +302,6 @@ class BaseInteraction extends Base {
|
|
|
331
302
|
|
|
332
303
|
/**
|
|
333
304
|
* Indicates whether this interaction is a {@link UserSelectMenuInteraction}
|
|
334
|
-
*
|
|
335
305
|
* @returns {boolean}
|
|
336
306
|
*/
|
|
337
307
|
isUserSelectMenu() {
|
|
@@ -340,7 +310,6 @@ class BaseInteraction extends Base {
|
|
|
340
310
|
|
|
341
311
|
/**
|
|
342
312
|
* Indicates whether this interaction is a {@link RoleSelectMenuInteraction}
|
|
343
|
-
*
|
|
344
313
|
* @returns {boolean}
|
|
345
314
|
*/
|
|
346
315
|
isRoleSelectMenu() {
|
|
@@ -349,7 +318,6 @@ class BaseInteraction extends Base {
|
|
|
349
318
|
|
|
350
319
|
/**
|
|
351
320
|
* Indicates whether this interaction is a {@link ChannelSelectMenuInteraction}
|
|
352
|
-
*
|
|
353
321
|
* @returns {boolean}
|
|
354
322
|
*/
|
|
355
323
|
isChannelSelectMenu() {
|
|
@@ -358,7 +326,6 @@ class BaseInteraction extends Base {
|
|
|
358
326
|
|
|
359
327
|
/**
|
|
360
328
|
* Indicates whether this interaction is a {@link MentionableSelectMenuInteraction}
|
|
361
|
-
*
|
|
362
329
|
* @returns {boolean}
|
|
363
330
|
*/
|
|
364
331
|
isMentionableSelectMenu() {
|
|
@@ -367,7 +334,6 @@ class BaseInteraction extends Base {
|
|
|
367
334
|
|
|
368
335
|
/**
|
|
369
336
|
* Indicates whether this interaction can be replied to.
|
|
370
|
-
*
|
|
371
337
|
* @returns {boolean}
|
|
372
338
|
*/
|
|
373
339
|
isRepliable() {
|
|
@@ -375,4 +341,9 @@ class BaseInteraction extends Base {
|
|
|
375
341
|
}
|
|
376
342
|
}
|
|
377
343
|
|
|
378
|
-
|
|
344
|
+
BaseInteraction.prototype.isSelectMenu = deprecate(
|
|
345
|
+
BaseInteraction.prototype.isSelectMenu,
|
|
346
|
+
'BaseInteraction#isSelectMenu() is deprecated. Use BaseInteraction#isStringSelectMenu() instead.',
|
|
347
|
+
);
|
|
348
|
+
|
|
349
|
+
module.exports = BaseInteraction;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const Component = require('./Component');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Represents a select menu component
|
|
7
|
-
*
|
|
8
7
|
* @extends {Component}
|
|
9
8
|
*/
|
|
10
9
|
class BaseSelectMenuComponent extends Component {
|
|
11
10
|
/**
|
|
12
11
|
* The placeholder for this select menu
|
|
13
|
-
*
|
|
14
12
|
* @type {?string}
|
|
15
13
|
* @readonly
|
|
16
14
|
*/
|
|
@@ -20,7 +18,6 @@ class BaseSelectMenuComponent extends Component {
|
|
|
20
18
|
|
|
21
19
|
/**
|
|
22
20
|
* The maximum amount of options that can be selected
|
|
23
|
-
*
|
|
24
21
|
* @type {?number}
|
|
25
22
|
* @readonly
|
|
26
23
|
*/
|
|
@@ -30,7 +27,6 @@ class BaseSelectMenuComponent extends Component {
|
|
|
30
27
|
|
|
31
28
|
/**
|
|
32
29
|
* The minimum amount of options that must be selected
|
|
33
|
-
*
|
|
34
30
|
* @type {?number}
|
|
35
31
|
* @readonly
|
|
36
32
|
*/
|
|
@@ -40,7 +36,6 @@ class BaseSelectMenuComponent extends Component {
|
|
|
40
36
|
|
|
41
37
|
/**
|
|
42
38
|
* The custom id of this select menu
|
|
43
|
-
*
|
|
44
39
|
* @type {string}
|
|
45
40
|
* @readonly
|
|
46
41
|
*/
|
|
@@ -50,7 +45,6 @@ class BaseSelectMenuComponent extends Component {
|
|
|
50
45
|
|
|
51
46
|
/**
|
|
52
47
|
* Whether this select menu is disabled
|
|
53
|
-
*
|
|
54
48
|
* @type {boolean}
|
|
55
49
|
* @readonly
|
|
56
50
|
*/
|
|
@@ -59,4 +53,4 @@ class BaseSelectMenuComponent extends Component {
|
|
|
59
53
|
}
|
|
60
54
|
}
|
|
61
55
|
|
|
62
|
-
exports
|
|
56
|
+
module.exports = BaseSelectMenuComponent;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { ButtonBuilder: BuildersButton } = require('@discordjs/builders');
|
|
4
|
+
const { isJSONEncodable } = require('@discordjs/util');
|
|
5
|
+
const { toSnakeCase } = require('../util/Transformers');
|
|
6
|
+
const { resolvePartialEmoji } = require('../util/Util');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents a button builder.
|
|
10
|
+
* @extends {BuildersButton}
|
|
11
|
+
*/
|
|
12
|
+
class ButtonBuilder extends BuildersButton {
|
|
13
|
+
constructor({ emoji, ...data } = {}) {
|
|
14
|
+
super(toSnakeCase({ ...data, emoji: emoji && typeof emoji === 'string' ? resolvePartialEmoji(emoji) : emoji }));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Sets the emoji to display on this button
|
|
19
|
+
* @param {string|APIMessageComponentEmoji} emoji The emoji to display on this button
|
|
20
|
+
* @returns {ButtonBuilder}
|
|
21
|
+
*/
|
|
22
|
+
setEmoji(emoji) {
|
|
23
|
+
if (typeof emoji === 'string') {
|
|
24
|
+
return super.setEmoji(resolvePartialEmoji(emoji));
|
|
25
|
+
}
|
|
26
|
+
return super.setEmoji(emoji);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new button builder from JSON data
|
|
31
|
+
* @param {ButtonBuilder|ButtonComponent|APIButtonComponent} other The other data
|
|
32
|
+
* @returns {ButtonBuilder}
|
|
33
|
+
*/
|
|
34
|
+
static from(other) {
|
|
35
|
+
return new this(isJSONEncodable(other) ? other.toJSON() : other);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = ButtonBuilder;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @external BuildersButton
|
|
43
|
+
* @see {@link https://discord.js.org/docs/packages/builders/stable/ButtonBuilder:Class}
|
|
44
|
+
*/
|