@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,456 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @external ActivityFlags
|
|
5
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ActivityFlags}
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @external ActivityType
|
|
10
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ActivityType}
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @external APIActionRowComponent
|
|
15
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIActionRowComponent}
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @external APIApplication
|
|
20
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIApplication}
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @external APIApplicationCommand
|
|
25
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIApplicationCommand}
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @external APIApplicationCommandOption
|
|
30
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIApplicationCommandOption}
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @external APIAutoModerationAction
|
|
35
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIAutoModerationAction}
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @external APIButtonComponent
|
|
40
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIButtonComponent}
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @external APIChannel
|
|
45
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIChannel}
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @external APIChannelSelectComponent
|
|
50
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIChannelSelectComponent}
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @external APIEmbed
|
|
55
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIEmbed}
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @external APIEmbedField
|
|
60
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIEmbedField}
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @external APIEmbedProvider
|
|
65
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIEmbedProvider}
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @external APIEmoji
|
|
70
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIEmoji}
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @external APIGuild
|
|
75
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIGuild}
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @external APIGuildForumDefaultReactionEmoji
|
|
80
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIGuildForumDefaultReactionEmoji}
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @external APIGuildForumTag
|
|
85
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIGuildForumTag}
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @external APIInteraction
|
|
90
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIInteraction}
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @external APIInteractionDataResolvedChannel
|
|
95
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIInteractionDataResolvedChannel}
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @external APIInteractionDataResolvedGuildMember
|
|
100
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIInteractionDataResolvedGuildMember}
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @external APIInteractionGuildMember
|
|
105
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIInteractionGuildMember}
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @external APIMentionableSelectComponent
|
|
110
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIMentionableSelectComponent}
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @external APIMessage
|
|
115
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIMessage}
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @external APIMessageActionRowComponent
|
|
120
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIMessageActionRowComponent}
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @external APIMessageComponent
|
|
125
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIMessageComponent}
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @external APIMessageComponentEmoji
|
|
130
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIMessageComponentEmoji}
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @external APIModalInteractionResponse
|
|
135
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIModalInteractionResponse}
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @external APIModalInteractionResponseCallbackData
|
|
140
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIModalInteractionResponseCallbackData}
|
|
141
|
+
*/
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @external APIModalComponent
|
|
145
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIModalComponent}
|
|
146
|
+
*/
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @external APIModalSubmission
|
|
150
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIModalSubmission}
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @external APIPresence
|
|
155
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIPresence}
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @external APIRoleSelectComponent
|
|
160
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIRoleSelectComponent}
|
|
161
|
+
*/
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @external APISelectMenuOption
|
|
165
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APISelectMenuOption}
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* @external APIStringSelectComponent
|
|
170
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIStringSelectComponent}
|
|
171
|
+
*/
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* @external APITextInputComponent
|
|
175
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APITextInputComponent}
|
|
176
|
+
*/
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* @external APIUser
|
|
180
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIUser}
|
|
181
|
+
*/
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* @external APIUserSelectComponent
|
|
185
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIUserSelectComponent}
|
|
186
|
+
*/
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* @external ApplicationCommandType
|
|
190
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ApplicationCommandType}
|
|
191
|
+
*/
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @external ApplicationCommandOptionType
|
|
195
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ApplicationCommandOptionType}
|
|
196
|
+
*/
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @external ApplicationCommandPermissionType
|
|
200
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ApplicationCommandPermissionType}
|
|
201
|
+
*/
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* @external ApplicationFlags
|
|
205
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ApplicationFlags}
|
|
206
|
+
*/
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @external ApplicationRoleConnectionMetadataType
|
|
210
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ApplicationRoleConnectionMetadataType}
|
|
211
|
+
*/
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @external AutoModerationActionType
|
|
215
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/AutoModerationActionType}
|
|
216
|
+
*/
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* @external AutoModerationRuleEventType
|
|
220
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/AutoModerationRuleEventType}
|
|
221
|
+
*/
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* @external AutoModerationRuleTriggerType
|
|
225
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/AutoModerationRuleTriggerType}
|
|
226
|
+
*/
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* @external AutoModerationRuleKeywordPresetType
|
|
230
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/AutoModerationRuleKeywordPresetType}
|
|
231
|
+
*/
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* @external AuditLogEvent
|
|
235
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/AuditLogEvent}
|
|
236
|
+
*/
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* @external ButtonStyle
|
|
240
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ButtonStyle}
|
|
241
|
+
*/
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* @external ChannelFlags
|
|
245
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ChannelFlags}
|
|
246
|
+
*/
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* @external ChannelType
|
|
250
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ChannelType}
|
|
251
|
+
*/
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* @external ComponentType
|
|
255
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ComponentType}
|
|
256
|
+
*/
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* @external ForumLayoutType
|
|
260
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ForumLayoutType}
|
|
261
|
+
*/
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* @external GatewayCloseCodes
|
|
265
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/GatewayCloseCodes}
|
|
266
|
+
*/
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* @external GatewayDispatchEvents
|
|
270
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/GatewayDispatchEvents}
|
|
271
|
+
*/
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* @external GatewayIntentBits
|
|
275
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/GatewayIntentBits}
|
|
276
|
+
*/
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* @external GatewayOpcodes
|
|
280
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/GatewayOpcodes}
|
|
281
|
+
*/
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* @external GuildDefaultMessageNotifications
|
|
285
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/GuildDefaultMessageNotifications}
|
|
286
|
+
*/
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* @external GuildExplicitContentFilter
|
|
290
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/GuildExplicitContentFilter}
|
|
291
|
+
*/
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* @external GuildFeature
|
|
295
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/GuildFeature}
|
|
296
|
+
*/
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* @external GuildMFALevel
|
|
300
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/GuildMFALevel}
|
|
301
|
+
*/
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* @external GuildMemberFlags
|
|
305
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/GuildMemberFlags}
|
|
306
|
+
*/
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* @external GuildNSFWLevel
|
|
310
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/GuildNSFWLevel}
|
|
311
|
+
*/
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* @external GuildPremiumTier
|
|
315
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/GuildPremiumTier}
|
|
316
|
+
*/
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* @external GuildScheduledEventEntityType
|
|
320
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/GuildScheduledEventEntityType}
|
|
321
|
+
*/
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* @external GuildScheduledEventPrivacyLevel
|
|
325
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/GuildScheduledEventPrivacyLevel}
|
|
326
|
+
*/
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* @external GuildScheduledEventStatus
|
|
330
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/GuildScheduledEventStatus}
|
|
331
|
+
*/
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* @external GuildSystemChannelFlags
|
|
335
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/GuildSystemChannelFlags}
|
|
336
|
+
*/
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* @external GuildVerificationLevel
|
|
340
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/GuildVerificationLevel}
|
|
341
|
+
*/
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* @external IntegrationExpireBehavior
|
|
345
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/IntegrationExpireBehavior}
|
|
346
|
+
*/
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* @external InteractionType
|
|
350
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/InteractionType}
|
|
351
|
+
*/
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* @external InteractionResponseType
|
|
355
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/InteractionResponseType}
|
|
356
|
+
*/
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* @external InviteTargetType
|
|
360
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/InviteTargetType}
|
|
361
|
+
*/
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* @external Locale
|
|
365
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-rest/common/enum/Locale}
|
|
366
|
+
*/
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* @external LocaleString
|
|
370
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-rest/common#LocaleString}
|
|
371
|
+
*/
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* @external MessageActivityType
|
|
375
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/MessageActivityType}
|
|
376
|
+
*/
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* @external MessageType
|
|
380
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/MessageType}
|
|
381
|
+
*/
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* @external MessageFlags
|
|
385
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/MessageFlags}
|
|
386
|
+
*/
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* @external OAuth2Scopes
|
|
390
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/OAuth2Scopes}
|
|
391
|
+
*/
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* @external OverwriteType
|
|
395
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/OverwriteType}
|
|
396
|
+
*/
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* @external PermissionFlagsBits
|
|
400
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-payloads/common#PermissionFlagsBits}
|
|
401
|
+
*/
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* @external RESTJSONErrorCodes
|
|
405
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-rest/common/enum/RESTJSONErrorCodes}
|
|
406
|
+
*/
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* @external SortOrderType
|
|
410
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/SortOrderType}
|
|
411
|
+
*/
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* @external StageInstancePrivacyLevel
|
|
415
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/StageInstancePrivacyLevel}
|
|
416
|
+
*/
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* @external StickerType
|
|
420
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/StickerType}
|
|
421
|
+
*/
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* @external StickerFormatType
|
|
425
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/StickerFormatType}
|
|
426
|
+
*/
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* @external TeamMemberMembershipState
|
|
430
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/TeamMemberMembershipState}
|
|
431
|
+
*/
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* @external TextInputStyle
|
|
435
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/TextInputStyle}
|
|
436
|
+
*/
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* @external ThreadAutoArchiveDuration
|
|
440
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ThreadAutoArchiveDuration}
|
|
441
|
+
*/
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* @external UserFlags
|
|
445
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/UserFlags}
|
|
446
|
+
*/
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* @external VideoQualityMode
|
|
450
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/VideoQualityMode}
|
|
451
|
+
*/
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* @external WebhookType
|
|
455
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/WebhookType}
|
|
456
|
+
*/
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { ActivityFlags } = require('discord-api-types/v10');
|
|
4
|
+
const BitField = require('./BitField');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Data structure that makes it easy to interact with an {@link Activity#flags} bitfield.
|
|
8
|
+
* @extends {BitField}
|
|
9
|
+
*/
|
|
10
|
+
class ActivityFlagsBitField extends BitField {
|
|
11
|
+
/**
|
|
12
|
+
* Numeric activity flags.
|
|
13
|
+
* @type {ActivityFlags}
|
|
14
|
+
* @memberof ActivityFlagsBitField
|
|
15
|
+
*/
|
|
16
|
+
static Flags = ActivityFlags;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @name ActivityFlagsBitField
|
|
21
|
+
* @kind constructor
|
|
22
|
+
* @memberof ActivityFlagsBitField
|
|
23
|
+
* @param {BitFieldResolvable} [bits=0] Bit(s) to read from
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
module.exports = ActivityFlagsBitField;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { ApplicationFlags } = require('discord-api-types/v10');
|
|
4
|
+
const BitField = require('./BitField');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Data structure that makes it easy to interact with a {@link ClientApplication#flags} bitfield.
|
|
8
|
+
* @extends {BitField}
|
|
9
|
+
*/
|
|
10
|
+
class ApplicationFlagsBitField extends BitField {
|
|
11
|
+
/**
|
|
12
|
+
* Numeric application flags. All available properties:
|
|
13
|
+
* @type {ApplicationFlags}
|
|
14
|
+
* @memberof ApplicationFlagsBitField
|
|
15
|
+
*/
|
|
16
|
+
static Flags = ApplicationFlags;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @name ApplicationFlagsBitField
|
|
21
|
+
* @kind constructor
|
|
22
|
+
* @memberof ApplicationFlagsBitField
|
|
23
|
+
* @param {BitFieldResolvable} [bits=0] Bit(s) to read from
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
module.exports = ApplicationFlagsBitField;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { DiscordjsRangeError, ErrorCodes } = require('../errors');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Data structure that makes it easy to interact with a bitfield.
|
|
7
|
+
*/
|
|
8
|
+
class BitField {
|
|
9
|
+
/**
|
|
10
|
+
* Numeric bitfield flags.
|
|
11
|
+
* <info>Defined in extension classes</info>
|
|
12
|
+
* @type {Object}
|
|
13
|
+
* @memberof BitField
|
|
14
|
+
* @abstract
|
|
15
|
+
*/
|
|
16
|
+
static Flags = {};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @type {number|bigint}
|
|
20
|
+
* @memberof BitField
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
static DefaultBit = 0;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @param {BitFieldResolvable} [bits=this.constructor.DefaultBit] Bit(s) to read from
|
|
27
|
+
*/
|
|
28
|
+
constructor(bits = this.constructor.DefaultBit) {
|
|
29
|
+
/**
|
|
30
|
+
* Bitfield of the packed bits
|
|
31
|
+
* @type {number|bigint}
|
|
32
|
+
*/
|
|
33
|
+
this.bitfield = this.constructor.resolve(bits);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Checks whether the bitfield has a bit, or any of multiple bits.
|
|
38
|
+
* @param {BitFieldResolvable} bit Bit(s) to check for
|
|
39
|
+
* @returns {boolean}
|
|
40
|
+
*/
|
|
41
|
+
any(bit) {
|
|
42
|
+
return (this.bitfield & this.constructor.resolve(bit)) !== this.constructor.DefaultBit;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Checks if this bitfield equals another
|
|
47
|
+
* @param {BitFieldResolvable} bit Bit(s) to check for
|
|
48
|
+
* @returns {boolean}
|
|
49
|
+
*/
|
|
50
|
+
equals(bit) {
|
|
51
|
+
return this.bitfield === this.constructor.resolve(bit);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Checks whether the bitfield has a bit, or multiple bits.
|
|
56
|
+
* @param {BitFieldResolvable} bit Bit(s) to check for
|
|
57
|
+
* @returns {boolean}
|
|
58
|
+
*/
|
|
59
|
+
has(bit) {
|
|
60
|
+
bit = this.constructor.resolve(bit);
|
|
61
|
+
return (this.bitfield & bit) === bit;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Gets all given bits that are missing from the bitfield.
|
|
66
|
+
* @param {BitFieldResolvable} bits Bit(s) to check for
|
|
67
|
+
* @param {...*} hasParams Additional parameters for the has method, if any
|
|
68
|
+
* @returns {string[]}
|
|
69
|
+
*/
|
|
70
|
+
missing(bits, ...hasParams) {
|
|
71
|
+
return new this.constructor(bits).remove(this).toArray(...hasParams);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Freezes these bits, making them immutable.
|
|
76
|
+
* @returns {Readonly<BitField>}
|
|
77
|
+
*/
|
|
78
|
+
freeze() {
|
|
79
|
+
return Object.freeze(this);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Adds bits to these ones.
|
|
84
|
+
* @param {...BitFieldResolvable} [bits] Bits to add
|
|
85
|
+
* @returns {BitField} These bits or new BitField if the instance is frozen.
|
|
86
|
+
*/
|
|
87
|
+
add(...bits) {
|
|
88
|
+
let total = this.constructor.DefaultBit;
|
|
89
|
+
for (const bit of bits) {
|
|
90
|
+
total |= this.constructor.resolve(bit);
|
|
91
|
+
}
|
|
92
|
+
if (Object.isFrozen(this)) return new this.constructor(this.bitfield | total);
|
|
93
|
+
this.bitfield |= total;
|
|
94
|
+
return this;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Removes bits from these.
|
|
99
|
+
* @param {...BitFieldResolvable} [bits] Bits to remove
|
|
100
|
+
* @returns {BitField} These bits or new BitField if the instance is frozen.
|
|
101
|
+
*/
|
|
102
|
+
remove(...bits) {
|
|
103
|
+
let total = this.constructor.DefaultBit;
|
|
104
|
+
for (const bit of bits) {
|
|
105
|
+
total |= this.constructor.resolve(bit);
|
|
106
|
+
}
|
|
107
|
+
if (Object.isFrozen(this)) return new this.constructor(this.bitfield & ~total);
|
|
108
|
+
this.bitfield &= ~total;
|
|
109
|
+
return this;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Gets an object mapping field names to a {@link boolean} indicating whether the
|
|
114
|
+
* bit is available.
|
|
115
|
+
* @param {...*} hasParams Additional parameters for the has method, if any
|
|
116
|
+
* @returns {Object}
|
|
117
|
+
*/
|
|
118
|
+
serialize(...hasParams) {
|
|
119
|
+
const serialized = {};
|
|
120
|
+
for (const [flag, bit] of Object.entries(this.constructor.Flags)) {
|
|
121
|
+
if (isNaN(flag)) serialized[flag] = this.has(bit, ...hasParams);
|
|
122
|
+
}
|
|
123
|
+
return serialized;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Gets an {@link Array} of bitfield names based on the bits available.
|
|
128
|
+
* @param {...*} hasParams Additional parameters for the has method, if any
|
|
129
|
+
* @returns {string[]}
|
|
130
|
+
*/
|
|
131
|
+
toArray(...hasParams) {
|
|
132
|
+
return [...this[Symbol.iterator](...hasParams)];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
toJSON() {
|
|
136
|
+
return typeof this.bitfield === 'number' ? this.bitfield : this.bitfield.toString();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
valueOf() {
|
|
140
|
+
return this.bitfield;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
*[Symbol.iterator](...hasParams) {
|
|
144
|
+
for (const bitName of Object.keys(this.constructor.Flags)) {
|
|
145
|
+
if (isNaN(bitName) && this.has(bitName, ...hasParams)) yield bitName;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Data that can be resolved to give a bitfield. This can be:
|
|
151
|
+
* * A bit number (this can be a number literal or a value taken from {@link BitField.Flags})
|
|
152
|
+
* * A string bit number
|
|
153
|
+
* * An instance of BitField
|
|
154
|
+
* * An Array of BitFieldResolvable
|
|
155
|
+
* @typedef {number|string|bigint|BitField|BitFieldResolvable[]} BitFieldResolvable
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Resolves bitfields to their numeric form.
|
|
160
|
+
* @param {BitFieldResolvable} [bit] bit(s) to resolve
|
|
161
|
+
* @returns {number|bigint}
|
|
162
|
+
*/
|
|
163
|
+
static resolve(bit) {
|
|
164
|
+
const { DefaultBit } = this;
|
|
165
|
+
if (typeof DefaultBit === typeof bit && bit >= DefaultBit) return bit;
|
|
166
|
+
if (bit instanceof BitField) return bit.bitfield;
|
|
167
|
+
if (Array.isArray(bit)) return bit.map(p => this.resolve(p)).reduce((prev, p) => prev | p, DefaultBit);
|
|
168
|
+
if (typeof bit === 'string') {
|
|
169
|
+
if (!isNaN(bit)) return typeof DefaultBit === 'bigint' ? BigInt(bit) : Number(bit);
|
|
170
|
+
if (this.Flags[bit] !== undefined) return this.Flags[bit];
|
|
171
|
+
}
|
|
172
|
+
throw new DiscordjsRangeError(ErrorCodes.BitFieldInvalid, bit);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
module.exports = BitField;
|