@ovencord/discord.js 14.16.3
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 +148 -0
- package/package.json +73 -0
- package/src/client/Client.ts +967 -0
- package/src/client/actions/Action.ts +141 -0
- package/src/client/actions/ActionsManager.ts +138 -0
- package/src/client/actions/ChannelCreate.ts +21 -0
- package/src/client/actions/ChannelDelete.ts +20 -0
- package/src/client/actions/ChannelUpdate.ts +38 -0
- package/src/client/actions/GuildChannelsPositionUpdate.ts +17 -0
- package/src/client/actions/GuildEmojiCreate.ts +17 -0
- package/src/client/actions/GuildEmojiDelete.ts +16 -0
- package/src/client/actions/GuildEmojiUpdate.ts +17 -0
- package/src/client/actions/GuildEmojisUpdate.ts +30 -0
- package/src/client/actions/GuildMemberRemove.ts +29 -0
- package/src/client/actions/GuildMemberUpdate.ts +41 -0
- package/src/client/actions/GuildRoleCreate.ts +23 -0
- package/src/client/actions/GuildRoleDelete.ts +26 -0
- package/src/client/actions/GuildRolesPositionUpdate.ts +17 -0
- package/src/client/actions/GuildScheduledEventDelete.ts +28 -0
- package/src/client/actions/GuildScheduledEventUserAdd.ts +29 -0
- package/src/client/actions/GuildScheduledEventUserRemove.ts +29 -0
- package/src/client/actions/GuildSoundboardSoundDelete.ts +26 -0
- package/src/client/actions/GuildStickerCreate.ts +17 -0
- package/src/client/actions/GuildStickerDelete.ts +16 -0
- package/src/client/actions/GuildStickerUpdate.ts +17 -0
- package/src/client/actions/GuildStickersUpdate.ts +30 -0
- package/src/client/actions/GuildUpdate.ts +30 -0
- package/src/client/actions/InteractionCreate.ts +104 -0
- package/src/client/actions/MessageCreate.ts +38 -0
- package/src/client/actions/MessageDelete.ts +29 -0
- package/src/client/actions/MessageDeleteBulk.ts +45 -0
- package/src/client/actions/MessagePollVoteAdd.ts +37 -0
- package/src/client/actions/MessagePollVoteRemove.ts +35 -0
- package/src/client/actions/MessageReactionAdd.ts +68 -0
- package/src/client/actions/MessageReactionRemove.ts +47 -0
- package/src/client/actions/MessageReactionRemoveAll.ts +30 -0
- package/src/client/actions/MessageReactionRemoveEmoji.ts +25 -0
- package/src/client/actions/MessageUpdate.ts +22 -0
- package/src/client/actions/StageInstanceCreate.ts +25 -0
- package/src/client/actions/StageInstanceDelete.ts +28 -0
- package/src/client/actions/StageInstanceUpdate.ts +27 -0
- package/src/client/actions/ThreadCreate.ts +22 -0
- package/src/client/actions/ThreadMembersUpdate.ts +45 -0
- package/src/client/actions/TypingStart.ts +26 -0
- package/src/client/actions/UserUpdate.ts +33 -0
- package/src/client/voice/ClientVoiceManager.ts +46 -0
- package/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.ts +19 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_ACTION_EXECUTION.ts +17 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_CREATE.ts +18 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_DELETE.ts +21 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_UPDATE.ts +20 -0
- package/src/client/websocket/handlers/CHANNEL_CREATE.ts +4 -0
- package/src/client/websocket/handlers/CHANNEL_DELETE.ts +4 -0
- package/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.ts +22 -0
- package/src/client/websocket/handlers/CHANNEL_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/ENTITLEMENT_CREATE.ts +14 -0
- package/src/client/websocket/handlers/ENTITLEMENT_DELETE.ts +18 -0
- package/src/client/websocket/handlers/ENTITLEMENT_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.ts +19 -0
- package/src/client/websocket/handlers/GUILD_BAN_ADD.ts +15 -0
- package/src/client/websocket/handlers/GUILD_BAN_REMOVE.ts +20 -0
- package/src/client/websocket/handlers/GUILD_CREATE.ts +34 -0
- package/src/client/websocket/handlers/GUILD_DELETE.ts +36 -0
- package/src/client/websocket/handlers/GUILD_EMOJIS_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.ts +15 -0
- package/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.ts +40 -0
- package/src/client/websocket/handlers/GUILD_MEMBER_ADD.ts +17 -0
- package/src/client/websocket/handlers/GUILD_MEMBER_REMOVE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_MEMBER_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_ROLE_CREATE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_ROLE_DELETE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_ROLE_UPDATE.ts +21 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_CREATE.ts +17 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_DELETE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_UPDATE.ts +19 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_ADD.ts +4 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_REMOVE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUNDS_UPDATE.ts +24 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_CREATE.ts +18 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_DELETE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_UPDATE.ts +20 -0
- package/src/client/websocket/handlers/GUILD_STICKERS_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/INTERACTION_CREATE.ts +4 -0
- package/src/client/websocket/handlers/INVITE_CREATE.ts +20 -0
- package/src/client/websocket/handlers/INVITE_DELETE.ts +23 -0
- package/src/client/websocket/handlers/MESSAGE_CREATE.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_DELETE.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_DELETE_BULK.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_POLL_VOTE_ADD.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_POLL_VOTE_REMOVE.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_ADD.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_ALL.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_EMOJI.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/PRESENCE_UPDATE.ts +42 -0
- package/src/client/websocket/handlers/RATE_LIMITED.ts +23 -0
- package/src/client/websocket/handlers/READY.ts +29 -0
- package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.ts +24 -0
- package/src/client/websocket/handlers/STAGE_INSTANCE_CREATE.ts +4 -0
- package/src/client/websocket/handlers/STAGE_INSTANCE_DELETE.ts +4 -0
- package/src/client/websocket/handlers/STAGE_INSTANCE_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/SUBSCRIPTION_CREATE.ts +14 -0
- package/src/client/websocket/handlers/SUBSCRIPTION_DELETE.ts +16 -0
- package/src/client/websocket/handlers/SUBSCRIPTION_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/THREAD_CREATE.ts +4 -0
- package/src/client/websocket/handlers/THREAD_DELETE.ts +17 -0
- package/src/client/websocket/handlers/THREAD_LIST_SYNC.ts +50 -0
- package/src/client/websocket/handlers/THREAD_MEMBERS_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/THREAD_MEMBER_UPDATE.ts +25 -0
- package/src/client/websocket/handlers/THREAD_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/TYPING_START.ts +4 -0
- package/src/client/websocket/handlers/USER_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.ts +16 -0
- package/src/client/websocket/handlers/VOICE_SERVER_UPDATE.ts +5 -0
- package/src/client/websocket/handlers/VOICE_STATE_UPDATE.ts +37 -0
- package/src/client/websocket/handlers/WEBHOOKS_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/index.ts +74 -0
- package/src/errors/DJSError.ts +50 -0
- package/src/errors/ErrorCodes.ts +277 -0
- package/src/errors/Messages.ts +155 -0
- package/src/errors/index.ts +6 -0
- package/src/index.ts +241 -0
- package/src/managers/ApplicationCommandManager.ts +303 -0
- package/src/managers/ApplicationCommandPermissionsManager.ts +453 -0
- package/src/managers/ApplicationEmojiManager.ts +149 -0
- package/src/managers/AutoModerationRuleManager.ts +307 -0
- package/src/managers/BaseManager.ts +13 -0
- package/src/managers/CachedManager.ts +56 -0
- package/src/managers/CategoryChannelChildManager.ts +81 -0
- package/src/managers/ChannelManager.ts +194 -0
- package/src/managers/DMMessageManager.ts +15 -0
- package/src/managers/DataManager.ts +38 -0
- package/src/managers/EntitlementManager.ts +182 -0
- package/src/managers/GuildApplicationCommandManager.ts +29 -0
- package/src/managers/GuildBanManager.ts +221 -0
- package/src/managers/GuildChannelManager.ts +552 -0
- package/src/managers/GuildEmojiManager.ts +262 -0
- package/src/managers/GuildEmojiRoleManager.ts +134 -0
- package/src/managers/GuildForumThreadManager.ts +84 -0
- package/src/managers/GuildInviteManager.ts +236 -0
- package/src/managers/GuildManager.ts +265 -0
- package/src/managers/GuildMemberManager.ts +619 -0
- package/src/managers/GuildMemberRoleManager.ts +230 -0
- package/src/managers/GuildMessageManager.ts +31 -0
- package/src/managers/GuildScheduledEventManager.ts +330 -0
- package/src/managers/GuildSoundboardSoundManager.ts +157 -0
- package/src/managers/GuildStickerManager.ts +192 -0
- package/src/managers/GuildTextThreadManager.ts +91 -0
- package/src/managers/MessageManager.ts +352 -0
- package/src/managers/PartialGroupDMMessageManager.ts +15 -0
- package/src/managers/PermissionOverwriteManager.ts +174 -0
- package/src/managers/PollAnswerVoterManager.ts +59 -0
- package/src/managers/PresenceManager.ts +60 -0
- package/src/managers/ReactionManager.ts +72 -0
- package/src/managers/ReactionUserManager.ts +82 -0
- package/src/managers/RoleManager.ts +432 -0
- package/src/managers/StageInstanceManager.ts +166 -0
- package/src/managers/SubscriptionManager.ts +83 -0
- package/src/managers/ThreadManager.ts +210 -0
- package/src/managers/ThreadMemberManager.ts +194 -0
- package/src/managers/UserManager.ts +139 -0
- package/src/managers/VoiceStateManager.ts +61 -0
- package/src/sharding/Shard.ts +513 -0
- package/src/sharding/ShardClientUtil.ts +293 -0
- package/src/sharding/ShardingManager.ts +374 -0
- package/src/structures/ActionRow.ts +31 -0
- package/src/structures/AnnouncementChannel.ts +25 -0
- package/src/structures/AnonymousGuild.ts +110 -0
- package/src/structures/ApplicationCommand.ts +675 -0
- package/src/structures/ApplicationEmoji.ts +189 -0
- package/src/structures/ApplicationRoleConnectionMetadata.ts +54 -0
- package/src/structures/Attachment.ts +189 -0
- package/src/structures/AuthorizingIntegrationOwners.ts +63 -0
- package/src/structures/AutoModerationActionExecution.ts +138 -0
- package/src/structures/AutoModerationRule.ts +325 -0
- package/src/structures/AutocompleteInteraction.ts +115 -0
- package/src/structures/Base.ts +37 -0
- package/src/structures/BaseChannel.ts +188 -0
- package/src/structures/BaseGuild.ts +134 -0
- package/src/structures/BaseGuildEmoji.ts +113 -0
- package/src/structures/BaseGuildTextChannel.ts +230 -0
- package/src/structures/BaseGuildVoiceChannel.ts +270 -0
- package/src/structures/BaseInteraction.ts +393 -0
- package/src/structures/BaseInvite.ts +192 -0
- package/src/structures/BaseSelectMenuComponent.ts +58 -0
- package/src/structures/ButtonComponent.ts +68 -0
- package/src/structures/ButtonInteraction.ts +8 -0
- package/src/structures/CategoryChannel.ts +46 -0
- package/src/structures/ChannelSelectMenuComponent.ts +18 -0
- package/src/structures/ChannelSelectMenuInteraction.ts +34 -0
- package/src/structures/ChatInputCommandInteraction.ts +43 -0
- package/src/structures/ClientApplication.ts +470 -0
- package/src/structures/ClientPresence.ts +87 -0
- package/src/structures/ClientUser.ts +219 -0
- package/src/structures/CommandInteraction.ts +193 -0
- package/src/structures/CommandInteractionOptionResolver.ts +336 -0
- package/src/structures/Component.ts +59 -0
- package/src/structures/ContainerComponent.ts +63 -0
- package/src/structures/ContextMenuCommandInteraction.ts +68 -0
- package/src/structures/DMChannel.ts +148 -0
- package/src/structures/DirectoryChannel.ts +40 -0
- package/src/structures/Embed.ts +251 -0
- package/src/structures/Emoji.ts +61 -0
- package/src/structures/Entitlement.ts +206 -0
- package/src/structures/FileComponent.ts +41 -0
- package/src/structures/ForumChannel.ts +31 -0
- package/src/structures/GroupDMInvite.ts +34 -0
- package/src/structures/Guild.ts +1605 -0
- package/src/structures/GuildAuditLogs.ts +99 -0
- package/src/structures/GuildAuditLogsEntry.ts +557 -0
- package/src/structures/GuildBan.ts +65 -0
- package/src/structures/GuildChannel.ts +515 -0
- package/src/structures/GuildEmoji.ts +159 -0
- package/src/structures/GuildInvite.ts +233 -0
- package/src/structures/GuildMember.ts +643 -0
- package/src/structures/GuildOnboarding.ts +73 -0
- package/src/structures/GuildOnboardingPrompt.ts +93 -0
- package/src/structures/GuildOnboardingPromptOption.ts +100 -0
- package/src/structures/GuildPreview.ts +218 -0
- package/src/structures/GuildPreviewEmoji.ts +28 -0
- package/src/structures/GuildScheduledEvent.ts +593 -0
- package/src/structures/GuildTemplate.ts +229 -0
- package/src/structures/Integration.ts +257 -0
- package/src/structures/IntegrationApplication.ts +84 -0
- package/src/structures/InteractionCallback.ts +86 -0
- package/src/structures/InteractionCallbackResource.ts +57 -0
- package/src/structures/InteractionCallbackResponse.ts +35 -0
- package/src/structures/InteractionCollector.ts +260 -0
- package/src/structures/InteractionWebhook.ts +65 -0
- package/src/structures/InviteGuild.ts +22 -0
- package/src/structures/LabelComponent.ts +51 -0
- package/src/structures/MediaChannel.ts +8 -0
- package/src/structures/MediaGalleryComponent.ts +31 -0
- package/src/structures/MediaGalleryItem.ts +54 -0
- package/src/structures/MentionableSelectMenuComponent.ts +8 -0
- package/src/structures/MentionableSelectMenuInteraction.ts +76 -0
- package/src/structures/Message.ts +1202 -0
- package/src/structures/MessageCollector.ts +155 -0
- package/src/structures/MessageComponentInteraction.ts +132 -0
- package/src/structures/MessageContextMenuCommandInteraction.ts +18 -0
- package/src/structures/MessageMentions.ts +327 -0
- package/src/structures/MessagePayload.ts +325 -0
- package/src/structures/MessageReaction.ts +219 -0
- package/src/structures/ModalComponentResolver.ts +237 -0
- package/src/structures/ModalSubmitInteraction.ts +260 -0
- package/src/structures/OAuth2Guild.ts +30 -0
- package/src/structures/PartialGroupDMChannel.ts +151 -0
- package/src/structures/PermissionOverwrites.ts +222 -0
- package/src/structures/Poll.ts +195 -0
- package/src/structures/PollAnswer.ts +100 -0
- package/src/structures/Presence.ts +448 -0
- package/src/structures/PrimaryEntryPointCommandInteraction.ts +8 -0
- package/src/structures/ReactionCollector.ts +245 -0
- package/src/structures/ReactionEmoji.ts +30 -0
- package/src/structures/Role.ts +543 -0
- package/src/structures/RoleSelectMenuComponent.ts +8 -0
- package/src/structures/RoleSelectMenuInteraction.ts +34 -0
- package/src/structures/SKU.ts +62 -0
- package/src/structures/SectionComponent.ts +44 -0
- package/src/structures/SeparatorComponent.ts +29 -0
- package/src/structures/SoundboardSound.ts +176 -0
- package/src/structures/StageChannel.ts +118 -0
- package/src/structures/StageInstance.ts +173 -0
- package/src/structures/Sticker.ts +300 -0
- package/src/structures/StickerPack.ts +111 -0
- package/src/structures/StringSelectMenuComponent.ts +18 -0
- package/src/structures/StringSelectMenuInteraction.ts +21 -0
- package/src/structures/Subscription.ts +138 -0
- package/src/structures/Team.ts +131 -0
- package/src/structures/TeamMember.ts +77 -0
- package/src/structures/TextChannel.ts +33 -0
- package/src/structures/TextDisplayComponent.ts +18 -0
- package/src/structures/TextInputComponent.ts +28 -0
- package/src/structures/ThreadChannel.ts +680 -0
- package/src/structures/ThreadMember.ts +125 -0
- package/src/structures/ThreadOnlyChannel.ts +276 -0
- package/src/structures/ThumbnailComponent.ts +51 -0
- package/src/structures/Typing.ts +81 -0
- package/src/structures/UnfurledMediaItem.ts +33 -0
- package/src/structures/User.ts +511 -0
- package/src/structures/UserContextMenuCommandInteraction.ts +28 -0
- package/src/structures/UserSelectMenuComponent.ts +8 -0
- package/src/structures/UserSelectMenuInteraction.ts +54 -0
- package/src/structures/VoiceChannel.ts +119 -0
- package/src/structures/VoiceChannelEffect.ts +92 -0
- package/src/structures/VoiceRegion.ts +52 -0
- package/src/structures/VoiceState.ts +346 -0
- package/src/structures/Webhook.ts +526 -0
- package/src/structures/WelcomeChannel.ts +67 -0
- package/src/structures/WelcomeScreen.ts +53 -0
- package/src/structures/Widget.ts +110 -0
- package/src/structures/WidgetMember.ts +124 -0
- package/src/structures/interfaces/Application.ts +179 -0
- package/src/structures/interfaces/Collector.ts +372 -0
- package/src/structures/interfaces/InteractionResponses.ts +384 -0
- package/src/structures/interfaces/TextBasedChannel.ts +430 -0
- package/src/util/APITypes.ts +690 -0
- package/src/util/ActivityFlagsBitField.ts +26 -0
- package/src/util/ApplicationFlagsBitField.ts +43 -0
- package/src/util/AttachmentFlagsBitField.ts +26 -0
- package/src/util/BitField.ts +178 -0
- package/src/util/ChannelFlagsBitField.ts +43 -0
- package/src/util/Channels.ts +165 -0
- package/src/util/Colors.ts +72 -0
- package/src/util/Components.ts +285 -0
- package/src/util/Constants.ts +251 -0
- package/src/util/DataResolver.ts +146 -0
- package/src/util/Enums.ts +10 -0
- package/src/util/Events.ts +178 -0
- package/src/util/GuildMemberFlagsBitField.ts +43 -0
- package/src/util/IntentsBitField.ts +35 -0
- package/src/util/InviteFlagsBitField.ts +26 -0
- package/src/util/Invites.ts +27 -0
- package/src/util/LimitedCollection.ts +73 -0
- package/src/util/MessageFlagsBitField.ts +43 -0
- package/src/util/Options.ts +215 -0
- package/src/util/Partials.ts +50 -0
- package/src/util/PermissionsBitField.ts +113 -0
- package/src/util/RoleFlagsBitField.ts +26 -0
- package/src/util/SKUFlagsBitField.ts +26 -0
- package/src/util/ShardEvents.ts +26 -0
- package/src/util/Status.ts +16 -0
- package/src/util/Sweepers.ts +532 -0
- package/src/util/Symbols.ts +1 -0
- package/src/util/SystemChannelFlagsBitField.ts +45 -0
- package/src/util/ThreadMemberFlagsBitField.ts +33 -0
- package/src/util/Transformers.ts +123 -0
- package/src/util/UserFlagsBitField.ts +33 -0
- package/src/util/Util.ts +519 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { Collection } from '@ovencord/collection';
|
|
2
|
+
import { PermissionFlagsBits } from 'discord-api-types/v10';
|
|
3
|
+
import { GuildMessageManager } from '../managers/GuildMessageManager.js';
|
|
4
|
+
import { GuildChannel } from './GuildChannel.js';
|
|
5
|
+
import { TextBasedChannel } from './interfaces/TextBasedChannel.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Represents a voice-based guild channel on Discord.
|
|
9
|
+
*
|
|
10
|
+
* @extends {GuildChannel}
|
|
11
|
+
* @implements {TextBasedChannel}
|
|
12
|
+
*/
|
|
13
|
+
export class BaseGuildVoiceChannel extends GuildChannel {
|
|
14
|
+
public client: any;
|
|
15
|
+
public messages: any;
|
|
16
|
+
public nsfw: any;
|
|
17
|
+
public rtcRegion: any;
|
|
18
|
+
public bitrate: any;
|
|
19
|
+
public userLimit: any;
|
|
20
|
+
public videoQualityMode: any;
|
|
21
|
+
public lastMessageId: any;
|
|
22
|
+
public rateLimitPerUser: any;
|
|
23
|
+
constructor(guild, data, client) {
|
|
24
|
+
super(guild, data, client, false);
|
|
25
|
+
/**
|
|
26
|
+
* A manager of the messages sent to this channel
|
|
27
|
+
*
|
|
28
|
+
* @type {GuildMessageManager}
|
|
29
|
+
*/
|
|
30
|
+
this.messages = new GuildMessageManager(this);
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* If the guild considers this channel NSFW
|
|
34
|
+
*
|
|
35
|
+
* @type {boolean}
|
|
36
|
+
*/
|
|
37
|
+
this.nsfw = Boolean(data.nsfw);
|
|
38
|
+
|
|
39
|
+
this._patch(data);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
_patch(data) {
|
|
43
|
+
super._patch(data);
|
|
44
|
+
|
|
45
|
+
if ('rtc_region' in data) {
|
|
46
|
+
/**
|
|
47
|
+
* The RTC region for this voice-based channel. This region is automatically selected if `null`.
|
|
48
|
+
*
|
|
49
|
+
* @type {?string}
|
|
50
|
+
*/
|
|
51
|
+
this.rtcRegion = data.rtc_region;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if ('bitrate' in data) {
|
|
55
|
+
/**
|
|
56
|
+
* The bitrate of this voice-based channel
|
|
57
|
+
*
|
|
58
|
+
* @type {number}
|
|
59
|
+
*/
|
|
60
|
+
this.bitrate = data.bitrate;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if ('user_limit' in data) {
|
|
64
|
+
/**
|
|
65
|
+
* The maximum amount of users allowed in this channel.
|
|
66
|
+
*
|
|
67
|
+
* @type {number}
|
|
68
|
+
*/
|
|
69
|
+
this.userLimit = data.user_limit;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if ('video_quality_mode' in data) {
|
|
73
|
+
/**
|
|
74
|
+
* The camera video quality mode of the channel.
|
|
75
|
+
*
|
|
76
|
+
* @type {?VideoQualityMode}
|
|
77
|
+
*/
|
|
78
|
+
this.videoQualityMode = data.video_quality_mode;
|
|
79
|
+
} else {
|
|
80
|
+
this.videoQualityMode ??= null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if ('last_message_id' in data) {
|
|
84
|
+
/**
|
|
85
|
+
* The last message id sent in the channel, if one was sent
|
|
86
|
+
*
|
|
87
|
+
* @type {?Snowflake}
|
|
88
|
+
*/
|
|
89
|
+
this.lastMessageId = data.last_message_id;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if ('messages' in data) {
|
|
93
|
+
for (const message of data.messages) this.messages._add(message);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if ('rate_limit_per_user' in data) {
|
|
97
|
+
/**
|
|
98
|
+
* The rate limit per user (slowmode) for this channel in seconds
|
|
99
|
+
*
|
|
100
|
+
* @type {number}
|
|
101
|
+
*/
|
|
102
|
+
this.rateLimitPerUser = data.rate_limit_per_user;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if ('nsfw' in data) {
|
|
106
|
+
this.nsfw = data.nsfw;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The members in this voice-based channel
|
|
112
|
+
*
|
|
113
|
+
* @type {Collection<Snowflake, GuildMember>}
|
|
114
|
+
* @readonly
|
|
115
|
+
*/
|
|
116
|
+
get members() {
|
|
117
|
+
const coll = new Collection();
|
|
118
|
+
for (const state of this.guild.voiceStates.cache.values()) {
|
|
119
|
+
if (state.channelId === this.id && state.member) {
|
|
120
|
+
coll.set(state.id, state.member);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return coll;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Checks if the voice-based channel is full
|
|
129
|
+
*
|
|
130
|
+
* @type {boolean}
|
|
131
|
+
* @readonly
|
|
132
|
+
*/
|
|
133
|
+
get full() {
|
|
134
|
+
return this.userLimit > 0 && this.members.size >= this.userLimit;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Whether the channel is joinable by the client user
|
|
139
|
+
*
|
|
140
|
+
* @type {boolean}
|
|
141
|
+
* @readonly
|
|
142
|
+
*/
|
|
143
|
+
get joinable() {
|
|
144
|
+
if (!this.viewable) return false;
|
|
145
|
+
const permissions = this.permissionsFor(this.client.user);
|
|
146
|
+
if (!permissions) return false;
|
|
147
|
+
|
|
148
|
+
// This flag allows joining even if timed out
|
|
149
|
+
if (permissions.has(PermissionFlagsBits.Administrator, false)) return true;
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
this.guild.members.me.communicationDisabledUntilTimestamp < Date.now() &&
|
|
153
|
+
permissions.has(PermissionFlagsBits.Connect, false)
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Creates an invite to this guild channel.
|
|
159
|
+
*
|
|
160
|
+
* @param {InviteCreateOptions} [options={}] The options for creating the invite
|
|
161
|
+
* @returns {Promise<Invite>}
|
|
162
|
+
* @example
|
|
163
|
+
* // Create an invite to a channel
|
|
164
|
+
* channel.createInvite()
|
|
165
|
+
* .then(invite => console.log(`Created an invite with a code of ${invite.code}`))
|
|
166
|
+
* .catch(console.error);
|
|
167
|
+
*/
|
|
168
|
+
async createInvite(options) {
|
|
169
|
+
return this.guild.invites.create(this.id, options);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Fetches a collection of invites to this guild channel.
|
|
174
|
+
*
|
|
175
|
+
* @param {boolean} [cache=true] Whether to cache the fetched invites
|
|
176
|
+
* @returns {Promise<Collection<string, Invite>>}
|
|
177
|
+
*/
|
|
178
|
+
async fetchInvites(cache = true) {
|
|
179
|
+
return this.guild.invites.fetch({ channelId: this.id, cache });
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Sets the bitrate of the channel.
|
|
184
|
+
*
|
|
185
|
+
* @param {number} bitrate The new bitrate
|
|
186
|
+
* @param {string} [reason] Reason for changing the channel's bitrate
|
|
187
|
+
* @returns {Promise<BaseGuildVoiceChannel>}
|
|
188
|
+
* @example
|
|
189
|
+
* // Set the bitrate of a voice channel
|
|
190
|
+
* channel.setBitrate(48_000)
|
|
191
|
+
* .then(channel => console.log(`Set bitrate to ${channel.bitrate}bps for ${channel.name}`))
|
|
192
|
+
* .catch(console.error);
|
|
193
|
+
*/
|
|
194
|
+
async setBitrate(bitrate, reason) {
|
|
195
|
+
return this.edit({ bitrate, reason });
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Sets the RTC region of the channel.
|
|
200
|
+
*
|
|
201
|
+
* @param {?string} rtcRegion The new region of the channel. Set to `null` to remove a specific region for the channel
|
|
202
|
+
* @param {string} [reason] The reason for modifying this region.
|
|
203
|
+
* @returns {Promise<BaseGuildVoiceChannel>}
|
|
204
|
+
* @example
|
|
205
|
+
* // Set the RTC region to sydney
|
|
206
|
+
* channel.setRTCRegion('sydney');
|
|
207
|
+
* @example
|
|
208
|
+
* // Remove a fixed region for this channel - let Discord decide automatically
|
|
209
|
+
* channel.setRTCRegion(null, 'We want to let Discord decide.');
|
|
210
|
+
*/
|
|
211
|
+
async setRTCRegion(rtcRegion, reason) {
|
|
212
|
+
return this.edit({ rtcRegion, reason });
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Sets the user limit of the channel.
|
|
217
|
+
*
|
|
218
|
+
* @param {number} userLimit The new user limit
|
|
219
|
+
* @param {string} [reason] Reason for changing the user limit
|
|
220
|
+
* @returns {Promise<BaseGuildVoiceChannel>}
|
|
221
|
+
* @example
|
|
222
|
+
* // Set the user limit of a voice channel
|
|
223
|
+
* channel.setUserLimit(42)
|
|
224
|
+
* .then(channel => console.log(`Set user limit to ${channel.userLimit} for ${channel.name}`))
|
|
225
|
+
* .catch(console.error);
|
|
226
|
+
*/
|
|
227
|
+
async setUserLimit(userLimit, reason) {
|
|
228
|
+
return this.edit({ userLimit, reason });
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Sets the camera video quality mode of the channel.
|
|
233
|
+
*
|
|
234
|
+
* @param {VideoQualityMode} videoQualityMode The new camera video quality mode.
|
|
235
|
+
* @param {string} [reason] Reason for changing the camera video quality mode.
|
|
236
|
+
* @returns {Promise<BaseGuildVoiceChannel>}
|
|
237
|
+
*/
|
|
238
|
+
async setVideoQualityMode(videoQualityMode, reason) {
|
|
239
|
+
return this.edit({ videoQualityMode, reason });
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
|
243
|
+
|
|
244
|
+
// eslint-disable-next-line getter-return
|
|
245
|
+
get lastMessage() {}
|
|
246
|
+
|
|
247
|
+
send() {}
|
|
248
|
+
|
|
249
|
+
sendTyping() {}
|
|
250
|
+
|
|
251
|
+
createMessageCollector() {}
|
|
252
|
+
|
|
253
|
+
awaitMessages() {}
|
|
254
|
+
|
|
255
|
+
createMessageComponentCollector() {}
|
|
256
|
+
|
|
257
|
+
awaitMessageComponent() {}
|
|
258
|
+
|
|
259
|
+
bulkDelete() {}
|
|
260
|
+
|
|
261
|
+
fetchWebhooks() {}
|
|
262
|
+
|
|
263
|
+
createWebhook() {}
|
|
264
|
+
|
|
265
|
+
setRateLimitPerUser() {}
|
|
266
|
+
|
|
267
|
+
setNSFW() {}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
TextBasedChannel.applyToClass(BaseGuildVoiceChannel, ['lastPinAt']);
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { Collection } from '@ovencord/collection';
|
|
2
|
+
import { DiscordSnowflake } from '@sapphire/snowflake';
|
|
3
|
+
import { InteractionType, ApplicationCommandType, ComponentType } from 'discord-api-types/v10';
|
|
4
|
+
import { SelectMenuTypes } from '../util/Constants.js';
|
|
5
|
+
import { PermissionsBitField } from '../util/PermissionsBitField.js';
|
|
6
|
+
import { AuthorizingIntegrationOwners } from './AuthorizingIntegrationOwners.js';
|
|
7
|
+
import { Base } from './Base.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Represents an interaction.
|
|
11
|
+
*
|
|
12
|
+
* @extends {Base}
|
|
13
|
+
* @abstract
|
|
14
|
+
*/
|
|
15
|
+
export class BaseInteraction extends Base {
|
|
16
|
+
public client: any;
|
|
17
|
+
public type: any;
|
|
18
|
+
public id: any;
|
|
19
|
+
public applicationId: any;
|
|
20
|
+
public channelId: any;
|
|
21
|
+
public guildId: any;
|
|
22
|
+
public user: any;
|
|
23
|
+
public member: any;
|
|
24
|
+
public version: any;
|
|
25
|
+
public appPermissions: any;
|
|
26
|
+
public memberPermissions: any;
|
|
27
|
+
public locale: any;
|
|
28
|
+
public guildLocale: any;
|
|
29
|
+
public entitlements: any;
|
|
30
|
+
public authorizingIntegrationOwners: any;
|
|
31
|
+
public context: any;
|
|
32
|
+
public attachmentSizeLimit: any;
|
|
33
|
+
public commandType: any;
|
|
34
|
+
public componentType: any;
|
|
35
|
+
constructor(client, data) {
|
|
36
|
+
super(client);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The interaction's type
|
|
40
|
+
*
|
|
41
|
+
* @type {InteractionType}
|
|
42
|
+
*/
|
|
43
|
+
this.type = data.type;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The interaction's id
|
|
47
|
+
*
|
|
48
|
+
* @type {Snowflake}
|
|
49
|
+
*/
|
|
50
|
+
this.id = data.id;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The interaction's token
|
|
54
|
+
*
|
|
55
|
+
* @type {string}
|
|
56
|
+
* @name BaseInteraction#token
|
|
57
|
+
* @readonly
|
|
58
|
+
*/
|
|
59
|
+
Object.defineProperty(this, 'token', { value: data.token });
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The application's id
|
|
63
|
+
*
|
|
64
|
+
* @type {Snowflake}
|
|
65
|
+
*/
|
|
66
|
+
this.applicationId = data.application_id;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The id of the channel this interaction was sent in
|
|
70
|
+
*
|
|
71
|
+
* @type {?Snowflake}
|
|
72
|
+
*/
|
|
73
|
+
this.channelId = data.channel?.id ?? null;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The id of the guild this interaction was sent in
|
|
77
|
+
*
|
|
78
|
+
* @type {?Snowflake}
|
|
79
|
+
*/
|
|
80
|
+
this.guildId = data.guild_id ?? null;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The user who created this interaction
|
|
84
|
+
*
|
|
85
|
+
* @type {User}
|
|
86
|
+
*/
|
|
87
|
+
this.user = this.client.users._add(data.user ?? data.member.user);
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* If this interaction was sent in a guild, the member which sent it
|
|
91
|
+
*
|
|
92
|
+
* @type {?(GuildMember|APIInteractionGuildMember)}
|
|
93
|
+
*/
|
|
94
|
+
this.member = data.member ? (this.guild?.members._add(data.member) ?? data.member) : null;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The version
|
|
98
|
+
*
|
|
99
|
+
* @type {number}
|
|
100
|
+
*/
|
|
101
|
+
this.version = data.version;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Set of permissions the application or bot has within the channel the interaction was sent from
|
|
105
|
+
*
|
|
106
|
+
* @type {Readonly<PermissionsBitField>}
|
|
107
|
+
*/
|
|
108
|
+
this.appPermissions = new PermissionsBitField(data.app_permissions).freeze();
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The permissions of the member, if one exists, in the channel this interaction was executed in
|
|
112
|
+
*
|
|
113
|
+
* @type {?Readonly<PermissionsBitField>}
|
|
114
|
+
*/
|
|
115
|
+
this.memberPermissions = data.member?.permissions
|
|
116
|
+
? new PermissionsBitField(data.member.permissions).freeze()
|
|
117
|
+
: null;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The locale of the user who invoked this interaction
|
|
121
|
+
*
|
|
122
|
+
* @type {Locale}
|
|
123
|
+
*/
|
|
124
|
+
this.locale = data.locale;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The preferred locale from the guild this interaction was sent in
|
|
128
|
+
*
|
|
129
|
+
* @type {?Locale}
|
|
130
|
+
*/
|
|
131
|
+
this.guildLocale = data.guild_locale ?? null;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* The entitlements for the invoking user, representing access to premium SKUs
|
|
135
|
+
*
|
|
136
|
+
* @type {Collection<Snowflake, Entitlement>}
|
|
137
|
+
*/
|
|
138
|
+
this.entitlements = data.entitlements.reduce(
|
|
139
|
+
(coll, entitlement) => coll.set(entitlement.id, this.client.application.entitlements._add(entitlement)),
|
|
140
|
+
new Collection(),
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Mapping of integration types that the application was authorized for the related user or guild ids
|
|
145
|
+
*
|
|
146
|
+
* @type {AuthorizingIntegrationOwners}
|
|
147
|
+
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object}
|
|
148
|
+
*/
|
|
149
|
+
this.authorizingIntegrationOwners = new AuthorizingIntegrationOwners(
|
|
150
|
+
this.client,
|
|
151
|
+
data.authorizing_integration_owners,
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Context where the interaction was triggered from
|
|
156
|
+
*
|
|
157
|
+
* @type {?InteractionContextType}
|
|
158
|
+
*/
|
|
159
|
+
this.context = data.context ?? null;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Attachment size limit in bytes
|
|
163
|
+
*
|
|
164
|
+
* @type {number}
|
|
165
|
+
*/
|
|
166
|
+
this.attachmentSizeLimit = data.attachment_size_limit;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The timestamp the interaction was created at
|
|
171
|
+
*
|
|
172
|
+
* @type {number}
|
|
173
|
+
* @readonly
|
|
174
|
+
*/
|
|
175
|
+
get createdTimestamp() {
|
|
176
|
+
return DiscordSnowflake.timestampFrom(this.id);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The time the interaction was created at
|
|
181
|
+
*
|
|
182
|
+
* @type {Date}
|
|
183
|
+
* @readonly
|
|
184
|
+
*/
|
|
185
|
+
get createdAt() {
|
|
186
|
+
return new Date(this.createdTimestamp);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* The channel this interaction was sent in
|
|
191
|
+
*
|
|
192
|
+
* @type {?TextBasedChannels}
|
|
193
|
+
* @readonly
|
|
194
|
+
*/
|
|
195
|
+
get channel() {
|
|
196
|
+
return this.client.channels.cache.get(this.channelId) ?? null;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* The guild this interaction was sent in
|
|
201
|
+
*
|
|
202
|
+
* @type {?Guild}
|
|
203
|
+
* @readonly
|
|
204
|
+
*/
|
|
205
|
+
get guild() {
|
|
206
|
+
return this.client.guilds.cache.get(this.guildId) ?? null;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Indicates whether this interaction is received from a guild.
|
|
211
|
+
*
|
|
212
|
+
* @returns {boolean}
|
|
213
|
+
*/
|
|
214
|
+
inGuild() {
|
|
215
|
+
return Boolean(this.guildId && this.member);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Indicates whether this interaction is received from a cached guild.
|
|
220
|
+
*
|
|
221
|
+
* @returns {boolean}
|
|
222
|
+
*/
|
|
223
|
+
inCachedGuild() {
|
|
224
|
+
return Boolean(this.guild && this.member);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Indicates whether or not this interaction is received from an uncached guild.
|
|
229
|
+
*
|
|
230
|
+
* @returns {boolean}
|
|
231
|
+
*/
|
|
232
|
+
inRawGuild() {
|
|
233
|
+
return Boolean(this.guildId && !this.guild && this.member);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Indicates whether this interaction is an {@link AutocompleteInteraction}
|
|
238
|
+
*
|
|
239
|
+
* @returns {boolean}
|
|
240
|
+
*/
|
|
241
|
+
isAutocomplete() {
|
|
242
|
+
return this.type === InteractionType.ApplicationCommandAutocomplete;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Indicates whether this interaction is a {@link CommandInteraction}
|
|
247
|
+
*
|
|
248
|
+
* @returns {boolean}
|
|
249
|
+
*/
|
|
250
|
+
isCommand() {
|
|
251
|
+
return this.type === InteractionType.ApplicationCommand;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Indicates whether this interaction is a {@link ChatInputCommandInteraction}.
|
|
256
|
+
*
|
|
257
|
+
* @returns {boolean}
|
|
258
|
+
*/
|
|
259
|
+
isChatInputCommand() {
|
|
260
|
+
return this.type === InteractionType.ApplicationCommand && this.commandType === ApplicationCommandType.ChatInput;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Indicates whether this interaction is a {@link ContextMenuCommandInteraction}
|
|
265
|
+
*
|
|
266
|
+
* @returns {boolean}
|
|
267
|
+
*/
|
|
268
|
+
isContextMenuCommand() {
|
|
269
|
+
return (
|
|
270
|
+
this.type === InteractionType.ApplicationCommand &&
|
|
271
|
+
[ApplicationCommandType.User, ApplicationCommandType.Message].includes(this.commandType)
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Indicates whether this interaction is a {@link PrimaryEntryPointCommandInteraction}
|
|
277
|
+
*
|
|
278
|
+
* @returns {boolean}
|
|
279
|
+
*/
|
|
280
|
+
isPrimaryEntryPointCommand() {
|
|
281
|
+
return (
|
|
282
|
+
this.type === InteractionType.ApplicationCommand && this.commandType === ApplicationCommandType.PrimaryEntryPoint
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Indicates whether this interaction is a {@link MessageComponentInteraction}
|
|
288
|
+
*
|
|
289
|
+
* @returns {boolean}
|
|
290
|
+
*/
|
|
291
|
+
isMessageComponent() {
|
|
292
|
+
return this.type === InteractionType.MessageComponent;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Indicates whether this interaction is a {@link ModalSubmitInteraction}
|
|
297
|
+
*
|
|
298
|
+
* @returns {boolean}
|
|
299
|
+
*/
|
|
300
|
+
isModalSubmit() {
|
|
301
|
+
return this.type === InteractionType.ModalSubmit;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Indicates whether this interaction is a {@link UserContextMenuCommandInteraction}
|
|
306
|
+
*
|
|
307
|
+
* @returns {boolean}
|
|
308
|
+
*/
|
|
309
|
+
isUserContextMenuCommand() {
|
|
310
|
+
return this.isContextMenuCommand() && this.commandType === ApplicationCommandType.User;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Indicates whether this interaction is a {@link MessageContextMenuCommandInteraction}
|
|
315
|
+
*
|
|
316
|
+
* @returns {boolean}
|
|
317
|
+
*/
|
|
318
|
+
isMessageContextMenuCommand() {
|
|
319
|
+
return this.isContextMenuCommand() && this.commandType === ApplicationCommandType.Message;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Indicates whether this interaction is a {@link ButtonInteraction}.
|
|
324
|
+
*
|
|
325
|
+
* @returns {boolean}
|
|
326
|
+
*/
|
|
327
|
+
isButton() {
|
|
328
|
+
return this.type === InteractionType.MessageComponent && this.componentType === ComponentType.Button;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Indicates whether this interaction is a select menu of any known type.
|
|
333
|
+
*
|
|
334
|
+
* @returns {boolean}
|
|
335
|
+
*/
|
|
336
|
+
isSelectMenu() {
|
|
337
|
+
return this.type === InteractionType.MessageComponent && SelectMenuTypes.includes(this.componentType);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Indicates whether this interaction is a {@link StringSelectMenuInteraction}.
|
|
342
|
+
*
|
|
343
|
+
* @returns {boolean}
|
|
344
|
+
*/
|
|
345
|
+
isStringSelectMenu() {
|
|
346
|
+
return this.type === InteractionType.MessageComponent && this.componentType === ComponentType.StringSelect;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Indicates whether this interaction is a {@link UserSelectMenuInteraction}
|
|
351
|
+
*
|
|
352
|
+
* @returns {boolean}
|
|
353
|
+
*/
|
|
354
|
+
isUserSelectMenu() {
|
|
355
|
+
return this.type === InteractionType.MessageComponent && this.componentType === ComponentType.UserSelect;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Indicates whether this interaction is a {@link RoleSelectMenuInteraction}
|
|
360
|
+
*
|
|
361
|
+
* @returns {boolean}
|
|
362
|
+
*/
|
|
363
|
+
isRoleSelectMenu() {
|
|
364
|
+
return this.type === InteractionType.MessageComponent && this.componentType === ComponentType.RoleSelect;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Indicates whether this interaction is a {@link ChannelSelectMenuInteraction}
|
|
369
|
+
*
|
|
370
|
+
* @returns {boolean}
|
|
371
|
+
*/
|
|
372
|
+
isChannelSelectMenu() {
|
|
373
|
+
return this.type === InteractionType.MessageComponent && this.componentType === ComponentType.ChannelSelect;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Indicates whether this interaction is a {@link MentionableSelectMenuInteraction}
|
|
378
|
+
*
|
|
379
|
+
* @returns {boolean}
|
|
380
|
+
*/
|
|
381
|
+
isMentionableSelectMenu() {
|
|
382
|
+
return this.type === InteractionType.MessageComponent && this.componentType === ComponentType.MentionableSelect;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Indicates whether this interaction can be replied to.
|
|
387
|
+
*
|
|
388
|
+
* @returns {boolean}
|
|
389
|
+
*/
|
|
390
|
+
isRepliable() {
|
|
391
|
+
return ![InteractionType.Ping, InteractionType.ApplicationCommandAutocomplete].includes(this.type);
|
|
392
|
+
}
|
|
393
|
+
}
|