@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,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { ChannelFlags } = require('discord-api-types/v10');
|
|
4
|
+
const BitField = require('./BitField');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Data structure that makes it easy to interact with a {@link BaseChannel#flags} bitfield.
|
|
8
|
+
* @extends {BitField}
|
|
9
|
+
*/
|
|
10
|
+
class ChannelFlagsBitField extends BitField {
|
|
11
|
+
/**
|
|
12
|
+
* Numeric guild channel flags.
|
|
13
|
+
* @type {ChannelFlags}
|
|
14
|
+
* @memberof ChannelFlagsBitField
|
|
15
|
+
*/
|
|
16
|
+
static Flags = ChannelFlags;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @name ChannelFlagsBitField
|
|
21
|
+
* @kind constructor
|
|
22
|
+
* @memberof ChannelFlagsBitField
|
|
23
|
+
* @param {BitFieldResolvable} [bits=0] Bit(s) to read from
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Bitfield of the packed bits
|
|
28
|
+
* @type {number}
|
|
29
|
+
* @name ChannelFlagsBitField#bitfield
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Data that can be resolved to give a channel flag bitfield. This can be:
|
|
34
|
+
* * A string (see {@link ChannelFlagsBitField.Flags})
|
|
35
|
+
* * A channel flag
|
|
36
|
+
* * An instance of ChannelFlagsBitField
|
|
37
|
+
* * An Array of ChannelFlagsResolvable
|
|
38
|
+
* @typedef {string|number|ChannelFlagsBitField|ChannelFlagsResolvable[]} ChannelFlagsResolvable
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
module.exports = ChannelFlagsBitField;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { lazy } = require('@discordjs/util');
|
|
4
|
+
const { ChannelType } = require('discord-api-types/v10');
|
|
5
|
+
|
|
6
|
+
const getCategoryChannel = lazy(() => require('../structures/CategoryChannel'));
|
|
7
|
+
const getDMChannel = lazy(() => require('../structures/DMChannel'));
|
|
8
|
+
const getNewsChannel = lazy(() => require('../structures/NewsChannel'));
|
|
9
|
+
const getStageChannel = lazy(() => require('../structures/StageChannel'));
|
|
10
|
+
const getTextChannel = lazy(() => require('../structures/TextChannel'));
|
|
11
|
+
const getThreadChannel = lazy(() => require('../structures/ThreadChannel'));
|
|
12
|
+
const getVoiceChannel = lazy(() => require('../structures/VoiceChannel'));
|
|
13
|
+
const getDirectoryChannel = lazy(() => require('../structures/DirectoryChannel'));
|
|
14
|
+
const getPartialGroupDMChannel = lazy(() => require('../structures/PartialGroupDMChannel'));
|
|
15
|
+
const getForumChannel = lazy(() => require('../structures/ForumChannel'));
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Creates a discord.js channel from data received from the API.
|
|
19
|
+
* @param {Client} client The client
|
|
20
|
+
* @param {APIChannel} data The data of the channel to create
|
|
21
|
+
* @param {Guild} [guild] The guild where this channel belongs
|
|
22
|
+
* @param {Object} [extras] Extra information to supply for creating this channel
|
|
23
|
+
* @returns {Channel} Any kind of channel.
|
|
24
|
+
* @ignore
|
|
25
|
+
*/
|
|
26
|
+
function createChannel(client, data, guild, { allowUnknownGuild } = {}) {
|
|
27
|
+
let channel;
|
|
28
|
+
if (!data.guild_id && !guild) {
|
|
29
|
+
if ((data.recipients && data.type !== ChannelType.GroupDM) || data.type === ChannelType.DM) {
|
|
30
|
+
channel = new (getDMChannel())(client, data);
|
|
31
|
+
} else if (data.type === ChannelType.GroupDM) {
|
|
32
|
+
channel = new (getPartialGroupDMChannel())(client, data);
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
guild ??= client.guilds.cache.get(data.guild_id);
|
|
36
|
+
|
|
37
|
+
if (guild || allowUnknownGuild) {
|
|
38
|
+
switch (data.type) {
|
|
39
|
+
case ChannelType.GuildText: {
|
|
40
|
+
channel = new (getTextChannel())(guild, data, client);
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
case ChannelType.GuildVoice: {
|
|
44
|
+
channel = new (getVoiceChannel())(guild, data, client);
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
case ChannelType.GuildCategory: {
|
|
48
|
+
channel = new (getCategoryChannel())(guild, data, client);
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
case ChannelType.GuildAnnouncement: {
|
|
52
|
+
channel = new (getNewsChannel())(guild, data, client);
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
case ChannelType.GuildStageVoice: {
|
|
56
|
+
channel = new (getStageChannel())(guild, data, client);
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
case ChannelType.AnnouncementThread:
|
|
60
|
+
case ChannelType.PublicThread:
|
|
61
|
+
case ChannelType.PrivateThread: {
|
|
62
|
+
channel = new (getThreadChannel())(guild, data, client);
|
|
63
|
+
if (!allowUnknownGuild) channel.parent?.threads.cache.set(channel.id, channel);
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
case ChannelType.GuildDirectory:
|
|
67
|
+
channel = new (getDirectoryChannel())(guild, data, client);
|
|
68
|
+
break;
|
|
69
|
+
case ChannelType.GuildForum:
|
|
70
|
+
channel = new (getForumChannel())(guild, data, client);
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
if (channel && !allowUnknownGuild) guild.channels?.cache.set(channel.id, channel);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return channel;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Transforms an API guild forum tag to camel-cased guild forum tag.
|
|
81
|
+
* @param {APIGuildForumTag} tag The tag to transform
|
|
82
|
+
* @returns {GuildForumTag}
|
|
83
|
+
* @ignore
|
|
84
|
+
*/
|
|
85
|
+
function transformAPIGuildForumTag(tag) {
|
|
86
|
+
return {
|
|
87
|
+
id: tag.id,
|
|
88
|
+
name: tag.name,
|
|
89
|
+
moderated: tag.moderated,
|
|
90
|
+
emoji:
|
|
91
|
+
tag.emoji_id ?? tag.emoji_name
|
|
92
|
+
? {
|
|
93
|
+
id: tag.emoji_id,
|
|
94
|
+
name: tag.emoji_name,
|
|
95
|
+
}
|
|
96
|
+
: null,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Transforms a camel-cased guild forum tag to an API guild forum tag.
|
|
102
|
+
* @param {GuildForumTag} tag The tag to transform
|
|
103
|
+
* @returns {APIGuildForumTag}
|
|
104
|
+
* @ignore
|
|
105
|
+
*/
|
|
106
|
+
function transformGuildForumTag(tag) {
|
|
107
|
+
return {
|
|
108
|
+
id: tag.id,
|
|
109
|
+
name: tag.name,
|
|
110
|
+
moderated: tag.moderated,
|
|
111
|
+
emoji_id: tag.emoji?.id ?? null,
|
|
112
|
+
emoji_name: tag.emoji?.name ?? null,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Transforms an API guild forum default reaction object to a
|
|
118
|
+
* camel-cased guild forum default reaction object.
|
|
119
|
+
* @param {APIGuildForumDefaultReactionEmoji} defaultReaction The default reaction to transform
|
|
120
|
+
* @returns {DefaultReactionEmoji}
|
|
121
|
+
* @ignore
|
|
122
|
+
*/
|
|
123
|
+
function transformAPIGuildDefaultReaction(defaultReaction) {
|
|
124
|
+
return {
|
|
125
|
+
id: defaultReaction.emoji_id,
|
|
126
|
+
name: defaultReaction.emoji_name,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Transforms a camel-cased guild forum default reaction object to an
|
|
132
|
+
* API guild forum default reaction object.
|
|
133
|
+
* @param {DefaultReactionEmoji} defaultReaction The default reaction to transform
|
|
134
|
+
* @returns {APIGuildForumDefaultReactionEmoji}
|
|
135
|
+
* @ignore
|
|
136
|
+
*/
|
|
137
|
+
function transformGuildDefaultReaction(defaultReaction) {
|
|
138
|
+
return {
|
|
139
|
+
emoji_id: defaultReaction.id,
|
|
140
|
+
emoji_name: defaultReaction.name,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
module.exports = {
|
|
145
|
+
createChannel,
|
|
146
|
+
transformAPIGuildForumTag,
|
|
147
|
+
transformGuildForumTag,
|
|
148
|
+
transformAPIGuildDefaultReaction,
|
|
149
|
+
transformGuildDefaultReaction,
|
|
150
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {Object} Colors
|
|
5
|
+
* @property {number} Default 0x000000 | rgb(0,0,0)
|
|
6
|
+
* @property {number} White 0xFFFFFF | rgb(255,255,255)
|
|
7
|
+
* @property {number} Aqua 0x1ABC9C | rgb(26,188,156)
|
|
8
|
+
* @property {number} Green 0x57F287 | rgb(87,242,135)
|
|
9
|
+
* @property {number} Blue 0x3498DB | rgb(52,152,219)
|
|
10
|
+
* @property {number} Yellow 0xFEE75C | rgb(254,231,92)
|
|
11
|
+
* @property {number} Purple 0x9B59B6 | rgb(155,89,182)
|
|
12
|
+
* @property {number} LuminousVividPink 0xE91E63 | rgb(233,30,99)
|
|
13
|
+
* @property {number} Fuchsia 0xEB459E | rgb(235,69,158)
|
|
14
|
+
* @property {number} Gold 0xF1C40F | rgb(241,196,15)
|
|
15
|
+
* @property {number} Orange 0xE67E22 | rgb(230,126,34)
|
|
16
|
+
* @property {number} Red 0xED4245 | rgb(237,66,69)
|
|
17
|
+
* @property {number} Grey 0x95A5A6 | rgb(149,165,166)
|
|
18
|
+
* @property {number} Navy 0x34495E | rgb(52,73,94)
|
|
19
|
+
* @property {number} DarkAqua 0x11806A | rgb(17,128,106)
|
|
20
|
+
* @property {number} DarkGreen 0x1F8B4C | rgb(31,139,76)
|
|
21
|
+
* @property {number} DarkBlue 0x206694 | rgb(32,102,148)
|
|
22
|
+
* @property {number} DarkPurple 0x71368A | rgb(113,54,138)
|
|
23
|
+
* @property {number} DarkVividPink 0xAD1457 | rgb(173,20,87)
|
|
24
|
+
* @property {number} DarkGold 0xC27C0E | rgb(194,124,14)
|
|
25
|
+
* @property {number} DarkOrange 0xA84300 | rgb(168,67,0)
|
|
26
|
+
* @property {number} DarkRed 0x992D22 | rgb(153,45,34)
|
|
27
|
+
* @property {number} DarkGrey 0x979C9F | rgb(151,156,159)
|
|
28
|
+
* @property {number} DarkerGrey 0x7F8C8D | rgb(127,140,141)
|
|
29
|
+
* @property {number} LightGrey 0xBCC0C0 | rgb(188,192,192)
|
|
30
|
+
* @property {number} DarkNavy 0x2C3E50 | rgb(44,62,80)
|
|
31
|
+
* @property {number} Blurple 0x5865F2 | rgb(88,101,242)
|
|
32
|
+
* @property {number} Greyple 0x99AAb5 | rgb(153,170,181)
|
|
33
|
+
* @property {number} DarkButNotBlack 0x2C2F33 | rgb(44,47,51)
|
|
34
|
+
* @property {number} NotQuiteBlack 0x23272A | rgb(35,39,42)
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
// JSDoc for IntelliSense purposes
|
|
38
|
+
/**
|
|
39
|
+
* @type {Colors}
|
|
40
|
+
* @ignore
|
|
41
|
+
*/
|
|
42
|
+
module.exports = {
|
|
43
|
+
Default: 0x000000,
|
|
44
|
+
White: 0xffffff,
|
|
45
|
+
Aqua: 0x1abc9c,
|
|
46
|
+
Green: 0x57f287,
|
|
47
|
+
Blue: 0x3498db,
|
|
48
|
+
Yellow: 0xfee75c,
|
|
49
|
+
Purple: 0x9b59b6,
|
|
50
|
+
LuminousVividPink: 0xe91e63,
|
|
51
|
+
Fuchsia: 0xeb459e,
|
|
52
|
+
Gold: 0xf1c40f,
|
|
53
|
+
Orange: 0xe67e22,
|
|
54
|
+
Red: 0xed4245,
|
|
55
|
+
Grey: 0x95a5a6,
|
|
56
|
+
Navy: 0x34495e,
|
|
57
|
+
DarkAqua: 0x11806a,
|
|
58
|
+
DarkGreen: 0x1f8b4c,
|
|
59
|
+
DarkBlue: 0x206694,
|
|
60
|
+
DarkPurple: 0x71368a,
|
|
61
|
+
DarkVividPink: 0xad1457,
|
|
62
|
+
DarkGold: 0xc27c0e,
|
|
63
|
+
DarkOrange: 0xa84300,
|
|
64
|
+
DarkRed: 0x992d22,
|
|
65
|
+
DarkGrey: 0x979c9f,
|
|
66
|
+
DarkerGrey: 0x7f8c8d,
|
|
67
|
+
LightGrey: 0xbcc0c0,
|
|
68
|
+
DarkNavy: 0x2c3e50,
|
|
69
|
+
Blurple: 0x5865f2,
|
|
70
|
+
Greyple: 0x99aab5,
|
|
71
|
+
DarkButNotBlack: 0x2c2f33,
|
|
72
|
+
NotQuiteBlack: 0x23272a,
|
|
73
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// This file contains the typedefs for camel-cased JSON data
|
|
4
|
+
const { ComponentBuilder } = require('@discordjs/builders');
|
|
5
|
+
const { ComponentType } = require('discord-api-types/v10');
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Object} BaseComponentData
|
|
8
|
+
* @property {ComponentType} type The type of component
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {BaseComponentData} ActionRowData
|
|
13
|
+
* @property {ComponentData[]} components The components in this action row
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {BaseComponentData} ButtonComponentData
|
|
18
|
+
* @property {ButtonStyle} style The style of the button
|
|
19
|
+
* @property {?boolean} disabled Whether this button is disabled
|
|
20
|
+
* @property {string} label The label of this button
|
|
21
|
+
* @property {?APIMessageComponentEmoji} emoji The emoji on this button
|
|
22
|
+
* @property {?string} customId The custom id of the button
|
|
23
|
+
* @property {?string} url The URL of the button
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @typedef {object} SelectMenuComponentOptionData
|
|
28
|
+
* @property {string} label The label of the option
|
|
29
|
+
* @property {string} value The value of the option
|
|
30
|
+
* @property {?string} description The description of the option
|
|
31
|
+
* @property {?APIMessageComponentEmoji} emoji The emoji on the option
|
|
32
|
+
* @property {?boolean} default Whether this option is selected by default
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @typedef {BaseComponentData} SelectMenuComponentData
|
|
37
|
+
* @property {string} customId The custom id of the select menu
|
|
38
|
+
* @property {?boolean} disabled Whether the select menu is disabled or not
|
|
39
|
+
* @property {?number} maxValues The maximum amount of options that can be selected
|
|
40
|
+
* @property {?number} minValues The minimum amount of options that can be selected
|
|
41
|
+
* @property {?SelectMenuComponentOptionData[]} options The options in this select menu
|
|
42
|
+
* @property {?string} placeholder The placeholder of the select menu
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @typedef {ActionRowData|ButtonComponentData|SelectMenuComponentData} MessageComponentData
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @typedef {BaseComponentData} TextInputComponentData
|
|
51
|
+
* @property {string} customId The custom id of the text input
|
|
52
|
+
* @property {TextInputStyle} style The style of the text input
|
|
53
|
+
* @property {string} label The text that appears on top of the text input field
|
|
54
|
+
* @property {?number} minLength The minimum number of characters that can be entered in the text input
|
|
55
|
+
* @property {?number} maxLength The maximum number of characters that can be entered in the text input
|
|
56
|
+
* @property {?boolean} required Whether or not the text input is required or not
|
|
57
|
+
* @property {?string} value The pre-filled text in the text input
|
|
58
|
+
* @property {?string} placeholder Placeholder for the text input
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @typedef {ActionRowData|ButtonComponentData|SelectMenuComponentData|TextInputComponentData} ComponentData
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Any emoji data that can be used within a button
|
|
67
|
+
* @typedef {APIMessageComponentEmoji|string} ComponentEmojiResolvable
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Transforms API data into a component
|
|
72
|
+
* @param {APIMessageComponent|Component} data The data to create the component from
|
|
73
|
+
* @returns {Component}
|
|
74
|
+
*/
|
|
75
|
+
function createComponent(data) {
|
|
76
|
+
if (data instanceof Component) {
|
|
77
|
+
return data;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
switch (data.type) {
|
|
81
|
+
case ComponentType.ActionRow:
|
|
82
|
+
return new ActionRow(data);
|
|
83
|
+
case ComponentType.Button:
|
|
84
|
+
return new ButtonComponent(data);
|
|
85
|
+
case ComponentType.StringSelect:
|
|
86
|
+
return new StringSelectMenuComponent(data);
|
|
87
|
+
case ComponentType.TextInput:
|
|
88
|
+
return new TextInputComponent(data);
|
|
89
|
+
case ComponentType.UserSelect:
|
|
90
|
+
return new UserSelectMenuComponent(data);
|
|
91
|
+
case ComponentType.RoleSelect:
|
|
92
|
+
return new RoleSelectMenuComponent(data);
|
|
93
|
+
case ComponentType.MentionableSelect:
|
|
94
|
+
return new MentionableSelectMenuComponent(data);
|
|
95
|
+
case ComponentType.ChannelSelect:
|
|
96
|
+
return new ChannelSelectMenuComponent(data);
|
|
97
|
+
default:
|
|
98
|
+
return new Component(data);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Transforms API data into a component builder
|
|
104
|
+
* @param {APIMessageComponent|ComponentBuilder} data The data to create the component from
|
|
105
|
+
* @returns {ComponentBuilder}
|
|
106
|
+
*/
|
|
107
|
+
function createComponentBuilder(data) {
|
|
108
|
+
if (data instanceof ComponentBuilder) {
|
|
109
|
+
return data;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
switch (data.type) {
|
|
113
|
+
case ComponentType.ActionRow:
|
|
114
|
+
return new ActionRowBuilder(data);
|
|
115
|
+
case ComponentType.Button:
|
|
116
|
+
return new ButtonBuilder(data);
|
|
117
|
+
case ComponentType.StringSelect:
|
|
118
|
+
return new StringSelectMenuBuilder(data);
|
|
119
|
+
case ComponentType.TextInput:
|
|
120
|
+
return new TextInputBuilder(data);
|
|
121
|
+
case ComponentType.UserSelect:
|
|
122
|
+
return new UserSelectMenuBuilder(data);
|
|
123
|
+
case ComponentType.RoleSelect:
|
|
124
|
+
return new RoleSelectMenuBuilder(data);
|
|
125
|
+
case ComponentType.MentionableSelect:
|
|
126
|
+
return new MentionableSelectMenuBuilder(data);
|
|
127
|
+
case ComponentType.ChannelSelect:
|
|
128
|
+
return new ChannelSelectMenuBuilder(data);
|
|
129
|
+
default:
|
|
130
|
+
return new ComponentBuilder(data);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
module.exports = { createComponent, createComponentBuilder };
|
|
135
|
+
|
|
136
|
+
const ActionRow = require('../structures/ActionRow');
|
|
137
|
+
const ActionRowBuilder = require('../structures/ActionRowBuilder');
|
|
138
|
+
const ButtonBuilder = require('../structures/ButtonBuilder');
|
|
139
|
+
const ButtonComponent = require('../structures/ButtonComponent');
|
|
140
|
+
const ChannelSelectMenuBuilder = require('../structures/ChannelSelectMenuBuilder');
|
|
141
|
+
const ChannelSelectMenuComponent = require('../structures/ChannelSelectMenuComponent');
|
|
142
|
+
const Component = require('../structures/Component');
|
|
143
|
+
const MentionableSelectMenuBuilder = require('../structures/MentionableSelectMenuBuilder');
|
|
144
|
+
const MentionableSelectMenuComponent = require('../structures/MentionableSelectMenuComponent');
|
|
145
|
+
const RoleSelectMenuBuilder = require('../structures/RoleSelectMenuBuilder');
|
|
146
|
+
const RoleSelectMenuComponent = require('../structures/RoleSelectMenuComponent');
|
|
147
|
+
const StringSelectMenuBuilder = require('../structures/StringSelectMenuBuilder');
|
|
148
|
+
const StringSelectMenuComponent = require('../structures/StringSelectMenuComponent');
|
|
149
|
+
const TextInputBuilder = require('../structures/TextInputBuilder');
|
|
150
|
+
const TextInputComponent = require('../structures/TextInputComponent');
|
|
151
|
+
const UserSelectMenuBuilder = require('../structures/UserSelectMenuBuilder');
|
|
152
|
+
const UserSelectMenuComponent = require('../structures/UserSelectMenuComponent');
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { ChannelType, MessageType, ComponentType, ImageFormat, StickerFormatType } = require('discord-api-types/v10');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Max bulk deletable message age
|
|
7
|
+
* @typedef {number} MaxBulkDeletableMessageAge
|
|
8
|
+
*/
|
|
9
|
+
exports.MaxBulkDeletableMessageAge = 1_209_600_000;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The name of an item to be swept in Sweepers
|
|
13
|
+
* * `autoModerationRules`
|
|
14
|
+
* * `applicationCommands` - both global and guild commands
|
|
15
|
+
* * `bans`
|
|
16
|
+
* * `emojis`
|
|
17
|
+
* * `invites` - accepts the `lifetime` property, using it will sweep based on expires timestamp
|
|
18
|
+
* * `guildMembers`
|
|
19
|
+
* * `messages` - accepts the `lifetime` property, using it will sweep based on edited or created timestamp
|
|
20
|
+
* * `presences`
|
|
21
|
+
* * `reactions`
|
|
22
|
+
* * `stageInstances`
|
|
23
|
+
* * `stickers`
|
|
24
|
+
* * `threadMembers`
|
|
25
|
+
* * `threads` - accepts the `lifetime` property, using it will sweep archived threads based on archived timestamp
|
|
26
|
+
* * `users`
|
|
27
|
+
* * `voiceStates`
|
|
28
|
+
* @typedef {string} SweeperKey
|
|
29
|
+
*/
|
|
30
|
+
exports.SweeperKeys = [
|
|
31
|
+
'autoModerationRules',
|
|
32
|
+
'applicationCommands',
|
|
33
|
+
'bans',
|
|
34
|
+
'emojis',
|
|
35
|
+
'invites',
|
|
36
|
+
'guildMembers',
|
|
37
|
+
'messages',
|
|
38
|
+
'presences',
|
|
39
|
+
'reactions',
|
|
40
|
+
'stageInstances',
|
|
41
|
+
'stickers',
|
|
42
|
+
'threadMembers',
|
|
43
|
+
'threads',
|
|
44
|
+
'users',
|
|
45
|
+
'voiceStates',
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The types of messages that are not `System`. The available types are:
|
|
50
|
+
* * {@link MessageType.Default}
|
|
51
|
+
* * {@link MessageType.Reply}
|
|
52
|
+
* * {@link MessageType.ChatInputCommand}
|
|
53
|
+
* * {@link MessageType.ContextMenuCommand}
|
|
54
|
+
* @typedef {MessageType[]} NonSystemMessageTypes
|
|
55
|
+
*/
|
|
56
|
+
exports.NonSystemMessageTypes = [
|
|
57
|
+
MessageType.Default,
|
|
58
|
+
MessageType.Reply,
|
|
59
|
+
MessageType.ChatInputCommand,
|
|
60
|
+
MessageType.ContextMenuCommand,
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The guild channels that are text-based.
|
|
65
|
+
* * TextChannel
|
|
66
|
+
* * NewsChannel
|
|
67
|
+
* * ThreadChannel
|
|
68
|
+
* * VoiceChannel
|
|
69
|
+
* * StageChannel
|
|
70
|
+
* @typedef {TextChannel|NewsChannel|ThreadChannel|VoiceChannel|StageChannel} GuildTextBasedChannel
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The types of guild channels that are text-based. The available types are:
|
|
75
|
+
* * {@link ChannelType.GuildText}
|
|
76
|
+
* * {@link ChannelType.GuildAnnouncement}
|
|
77
|
+
* * {@link ChannelType.AnnouncementThread}
|
|
78
|
+
* * {@link ChannelType.PublicThread}
|
|
79
|
+
* * {@link ChannelType.PrivateThread}
|
|
80
|
+
* * {@link ChannelType.GuildVoice}
|
|
81
|
+
* * {@link ChannelType.GuildStageVoice}
|
|
82
|
+
* @typedef {ChannelType[]} GuildTextBasedChannelTypes
|
|
83
|
+
*/
|
|
84
|
+
exports.GuildTextBasedChannelTypes = [
|
|
85
|
+
ChannelType.GuildText,
|
|
86
|
+
ChannelType.GuildAnnouncement,
|
|
87
|
+
ChannelType.AnnouncementThread,
|
|
88
|
+
ChannelType.PublicThread,
|
|
89
|
+
ChannelType.PrivateThread,
|
|
90
|
+
ChannelType.GuildVoice,
|
|
91
|
+
ChannelType.GuildStageVoice,
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The channels that are text-based.
|
|
96
|
+
* * DMChannel
|
|
97
|
+
* * GuildTextBasedChannel
|
|
98
|
+
* @typedef {DMChannel|GuildTextBasedChannel} TextBasedChannels
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Data that resolves to give a text-based channel. This can be:
|
|
103
|
+
* * A text-based channel
|
|
104
|
+
* * A snowflake
|
|
105
|
+
* @typedef {TextBasedChannels|Snowflake} TextBasedChannelsResolvable
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The types of channels that are text-based. The available types are:
|
|
110
|
+
* * {@link ChannelType.DM}
|
|
111
|
+
* * {@link ChannelType.GuildText}
|
|
112
|
+
* * {@link ChannelType.GuildAnnouncement}
|
|
113
|
+
* * {@link ChannelType.AnnouncementThread}
|
|
114
|
+
* * {@link ChannelType.PublicThread}
|
|
115
|
+
* * {@link ChannelType.PrivateThread}
|
|
116
|
+
* * {@link ChannelType.GuildVoice}
|
|
117
|
+
* * {@link ChannelType.GuildStageVoice}
|
|
118
|
+
* @typedef {ChannelType[]} TextBasedChannelTypes
|
|
119
|
+
*/
|
|
120
|
+
exports.TextBasedChannelTypes = [...exports.GuildTextBasedChannelTypes, ChannelType.DM];
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The types of channels that are threads. The available types are:
|
|
124
|
+
* * {@link ChannelType.AnnouncementThread}
|
|
125
|
+
* * {@link ChannelType.PublicThread}
|
|
126
|
+
* * {@link ChannelType.PrivateThread}
|
|
127
|
+
* @typedef {ChannelType[]} ThreadChannelTypes
|
|
128
|
+
*/
|
|
129
|
+
exports.ThreadChannelTypes = [ChannelType.AnnouncementThread, ChannelType.PublicThread, ChannelType.PrivateThread];
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The types of channels that are voice-based. The available types are:
|
|
133
|
+
* * {@link ChannelType.GuildVoice}
|
|
134
|
+
* * {@link ChannelType.GuildStageVoice}
|
|
135
|
+
* @typedef {ChannelType[]} VoiceBasedChannelTypes
|
|
136
|
+
*/
|
|
137
|
+
exports.VoiceBasedChannelTypes = [ChannelType.GuildVoice, ChannelType.GuildStageVoice];
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* The types of select menus. The available types are:
|
|
141
|
+
* * {@link ComponentType.StringSelect}
|
|
142
|
+
* * {@link ComponentType.UserSelect}
|
|
143
|
+
* * {@link ComponentType.RoleSelect}
|
|
144
|
+
* * {@link ComponentType.MentionableSelect}
|
|
145
|
+
* * {@link ComponentType.ChannelSelect}
|
|
146
|
+
* @typedef {ComponentType[]} SelectMenuTypes
|
|
147
|
+
*/
|
|
148
|
+
exports.SelectMenuTypes = [
|
|
149
|
+
ComponentType.StringSelect,
|
|
150
|
+
ComponentType.UserSelect,
|
|
151
|
+
ComponentType.RoleSelect,
|
|
152
|
+
ComponentType.MentionableSelect,
|
|
153
|
+
ComponentType.ChannelSelect,
|
|
154
|
+
];
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The types of messages that can be deleted. The available types are:
|
|
158
|
+
* * {@link MessageType.AutoModerationAction}
|
|
159
|
+
* * {@link MessageType.ChannelFollowAdd}
|
|
160
|
+
* * {@link MessageType.ChannelPinnedMessage}
|
|
161
|
+
* * {@link MessageType.ChatInputCommand}
|
|
162
|
+
* * {@link MessageType.ContextMenuCommand}
|
|
163
|
+
* * {@link MessageType.Default}
|
|
164
|
+
* * {@link MessageType.GuildBoost}
|
|
165
|
+
* * {@link MessageType.GuildBoostTier1}
|
|
166
|
+
* * {@link MessageType.GuildBoostTier2}
|
|
167
|
+
* * {@link MessageType.GuildBoostTier3}
|
|
168
|
+
* * {@link MessageType.GuildInviteReminder}
|
|
169
|
+
* * {@link MessageType.InteractionPremiumUpsell}
|
|
170
|
+
* * {@link MessageType.Reply}
|
|
171
|
+
* * {@link MessageType.RoleSubscriptionPurchase}
|
|
172
|
+
* * {@link MessageType.StageEnd}
|
|
173
|
+
* * {@link MessageType.StageRaiseHand}
|
|
174
|
+
* * {@link MessageType.StageSpeaker}
|
|
175
|
+
* * {@link MessageType.StageStart}
|
|
176
|
+
* * {@link MessageType.StageTopic}
|
|
177
|
+
* * {@link MessageType.ThreadCreated}
|
|
178
|
+
* * {@link MessageType.UserJoin}
|
|
179
|
+
* @typedef {MessageType[]} DeletableMessageTypes
|
|
180
|
+
*/
|
|
181
|
+
exports.DeletableMessageTypes = [
|
|
182
|
+
MessageType.AutoModerationAction,
|
|
183
|
+
MessageType.ChannelFollowAdd,
|
|
184
|
+
MessageType.ChannelPinnedMessage,
|
|
185
|
+
MessageType.ChatInputCommand,
|
|
186
|
+
MessageType.ContextMenuCommand,
|
|
187
|
+
MessageType.Default,
|
|
188
|
+
MessageType.GuildBoost,
|
|
189
|
+
MessageType.GuildBoostTier1,
|
|
190
|
+
MessageType.GuildBoostTier2,
|
|
191
|
+
MessageType.GuildBoostTier3,
|
|
192
|
+
MessageType.GuildInviteReminder,
|
|
193
|
+
MessageType.InteractionPremiumUpsell,
|
|
194
|
+
MessageType.Reply,
|
|
195
|
+
MessageType.RoleSubscriptionPurchase,
|
|
196
|
+
MessageType.StageEnd,
|
|
197
|
+
MessageType.StageRaiseHand,
|
|
198
|
+
MessageType.StageSpeaker,
|
|
199
|
+
MessageType.StageStart,
|
|
200
|
+
MessageType.StageTopic,
|
|
201
|
+
MessageType.ThreadCreated,
|
|
202
|
+
MessageType.UserJoin,
|
|
203
|
+
];
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* A mapping between sticker formats and their respective image formats.
|
|
207
|
+
* * {@link StickerFormatType.PNG} -> {@link ImageFormat.PNG}
|
|
208
|
+
* * {@link StickerFormatType.APNG} -> {@link ImageFormat.PNG}
|
|
209
|
+
* * {@link StickerFormatType.Lottie} -> {@link ImageFormat.Lottie}
|
|
210
|
+
* * {@link StickerFormatType.GIF} -> {@link ImageFormat.GIF}
|
|
211
|
+
* @typedef {Object} StickerFormatExtensionMap
|
|
212
|
+
*/
|
|
213
|
+
exports.StickerFormatExtensionMap = {
|
|
214
|
+
[StickerFormatType.PNG]: ImageFormat.PNG,
|
|
215
|
+
[StickerFormatType.APNG]: ImageFormat.PNG,
|
|
216
|
+
[StickerFormatType.Lottie]: ImageFormat.Lottie,
|
|
217
|
+
[StickerFormatType.GIF]: ImageFormat.GIF,
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* @typedef {Object} Constants Constants that can be used in an enum or object-like way.
|
|
222
|
+
* @property {number} MaxBulkDeletableMessageAge Max bulk deletable message age
|
|
223
|
+
* @property {SweeperKey[]} SweeperKeys The possible names of items that can be swept in sweepers
|
|
224
|
+
* @property {NonSystemMessageTypes} NonSystemMessageTypes The types of messages that are not deemed a system type
|
|
225
|
+
* @property {TextBasedChannelTypes} TextBasedChannelTypes The types of channels that are text-based
|
|
226
|
+
* @property {ThreadChannelTypes} ThreadChannelTypes The types of channels that are threads
|
|
227
|
+
* @property {VoiceBasedChannelTypes} VoiceBasedChannelTypes The types of channels that are voice-based
|
|
228
|
+
* @property {SelectMenuTypes} SelectMenuTypes The types of components that are select menus.
|
|
229
|
+
* @property {Object} StickerFormatExtensionMap A mapping between sticker formats and their respective image formats.
|
|
230
|
+
*/
|