@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,178 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {Object} Events
|
|
4
|
+
* @property {string} ApplicationCommandPermissionsUpdate applicationCommandPermissionsUpdate
|
|
5
|
+
* @property {string} AutoModerationActionExecution autoModerationActionExecution
|
|
6
|
+
* @property {string} AutoModerationRuleCreate autoModerationRuleCreate
|
|
7
|
+
* @property {string} AutoModerationRuleDelete autoModerationRuleDelete
|
|
8
|
+
* @property {string} AutoModerationRuleUpdate autoModerationRuleUpdate
|
|
9
|
+
* @property {string} CacheSweep cacheSweep
|
|
10
|
+
* @property {string} ChannelCreate channelCreate
|
|
11
|
+
* @property {string} ChannelDelete channelDelete
|
|
12
|
+
* @property {string} ChannelPinsUpdate channelPinsUpdate
|
|
13
|
+
* @property {string} ChannelUpdate channelUpdate
|
|
14
|
+
* @property {string} ClientReady clientReady
|
|
15
|
+
* @property {string} Debug debug
|
|
16
|
+
* @property {string} EntitlementCreate entitlementCreate
|
|
17
|
+
* @property {string} EntitlementUpdate entitlementUpdate
|
|
18
|
+
* @property {string} EntitlementDelete entitlementDelete
|
|
19
|
+
* @property {string} Error error
|
|
20
|
+
* @property {string} GuildAuditLogEntryCreate guildAuditLogEntryCreate
|
|
21
|
+
* @property {string} GuildAvailable guildAvailable
|
|
22
|
+
* @property {string} GuildBanAdd guildBanAdd
|
|
23
|
+
* @property {string} GuildBanRemove guildBanRemove
|
|
24
|
+
* @property {string} GuildCreate guildCreate
|
|
25
|
+
* @property {string} GuildDelete guildDelete
|
|
26
|
+
* @property {string} GuildEmojiCreate emojiCreate
|
|
27
|
+
* @property {string} GuildEmojiDelete emojiDelete
|
|
28
|
+
* @property {string} GuildEmojiUpdate emojiUpdate
|
|
29
|
+
* @property {string} GuildIntegrationsUpdate guildIntegrationsUpdate
|
|
30
|
+
* @property {string} GuildMemberAdd guildMemberAdd
|
|
31
|
+
* @property {string} GuildMemberAvailable guildMemberAvailable
|
|
32
|
+
* @property {string} GuildMemberRemove guildMemberRemove
|
|
33
|
+
* @property {string} GuildMembersChunk guildMembersChunk
|
|
34
|
+
* @property {string} GuildMemberUpdate guildMemberUpdate
|
|
35
|
+
* @property {string} GuildRoleCreate roleCreate
|
|
36
|
+
* @property {string} GuildRoleDelete roleDelete
|
|
37
|
+
* @property {string} GuildRoleUpdate roleUpdate
|
|
38
|
+
* @property {string} GuildScheduledEventCreate guildScheduledEventCreate
|
|
39
|
+
* @property {string} GuildScheduledEventDelete guildScheduledEventDelete
|
|
40
|
+
* @property {string} GuildScheduledEventUpdate guildScheduledEventUpdate
|
|
41
|
+
* @property {string} GuildScheduledEventUserAdd guildScheduledEventUserAdd
|
|
42
|
+
* @property {string} GuildScheduledEventUserRemove guildScheduledEventUserRemove
|
|
43
|
+
* @property {string} GuildSoundboardSoundCreate guildSoundboardSoundCreate
|
|
44
|
+
* @property {string} GuildSoundboardSoundDelete guildSoundboardSoundDelete
|
|
45
|
+
* @property {string} GuildSoundboardSoundsUpdate guildSoundboardSoundsUpdate
|
|
46
|
+
* @property {string} GuildSoundboardSoundUpdate guildSoundboardSoundUpdate
|
|
47
|
+
* @property {string} GuildStickerCreate stickerCreate
|
|
48
|
+
* @property {string} GuildStickerDelete stickerDelete
|
|
49
|
+
* @property {string} GuildStickerUpdate stickerUpdate
|
|
50
|
+
* @property {string} GuildUnavailable guildUnavailable
|
|
51
|
+
* @property {string} GuildUpdate guildUpdate
|
|
52
|
+
* @property {string} InteractionCreate interactionCreate
|
|
53
|
+
* @property {string} Invalidated invalidated
|
|
54
|
+
* @property {string} InviteCreate inviteCreate
|
|
55
|
+
* @property {string} InviteDelete inviteDelete
|
|
56
|
+
* @property {string} MessageBulkDelete messageDeleteBulk
|
|
57
|
+
* @property {string} MessageCreate messageCreate
|
|
58
|
+
* @property {string} MessageDelete messageDelete
|
|
59
|
+
* @property {string} MessagePollVoteAdd messagePollVoteAdd
|
|
60
|
+
* @property {string} MessagePollVoteRemove messagePollVoteRemove
|
|
61
|
+
* @property {string} MessageReactionAdd messageReactionAdd
|
|
62
|
+
* @property {string} MessageReactionRemove messageReactionRemove
|
|
63
|
+
* @property {string} MessageReactionRemoveAll messageReactionRemoveAll
|
|
64
|
+
* @property {string} MessageReactionRemoveEmoji messageReactionRemoveEmoji
|
|
65
|
+
* @property {string} MessageUpdate messageUpdate
|
|
66
|
+
* @property {string} PresenceUpdate presenceUpdate
|
|
67
|
+
* @property {string} SoundboardSounds soundboardSounds
|
|
68
|
+
* @property {string} StageInstanceCreate stageInstanceCreate
|
|
69
|
+
* @property {string} StageInstanceDelete stageInstanceDelete
|
|
70
|
+
* @property {string} StageInstanceUpdate stageInstanceUpdate
|
|
71
|
+
* @property {string} SubscriptionCreate subscriptionCreate
|
|
72
|
+
* @property {string} SubscriptionUpdate subscriptionUpdate
|
|
73
|
+
* @property {string} SubscriptionDelete subscriptionDelete
|
|
74
|
+
* @property {string} ThreadCreate threadCreate
|
|
75
|
+
* @property {string} ThreadDelete threadDelete
|
|
76
|
+
* @property {string} ThreadListSync threadListSync
|
|
77
|
+
* @property {string} ThreadMembersUpdate threadMembersUpdate
|
|
78
|
+
* @property {string} ThreadMemberUpdate threadMemberUpdate
|
|
79
|
+
* @property {string} ThreadUpdate threadUpdate
|
|
80
|
+
* @property {string} TypingStart typingStart
|
|
81
|
+
* @property {string} UserUpdate userUpdate
|
|
82
|
+
* @property {string} VoiceChannelEffectSend voiceChannelEffectSend
|
|
83
|
+
* @property {string} VoiceServerUpdate voiceServerUpdate
|
|
84
|
+
* @property {string} VoiceStateUpdate voiceStateUpdate
|
|
85
|
+
* @property {string} Warn warn
|
|
86
|
+
* @property {string} WebhooksUpdate webhooksUpdate
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
// JSDoc for IntelliSense purposes
|
|
90
|
+
/**
|
|
91
|
+
* @type {Events}
|
|
92
|
+
* @ignore
|
|
93
|
+
*/
|
|
94
|
+
exports.Events = {
|
|
95
|
+
ApplicationCommandPermissionsUpdate: 'applicationCommandPermissionsUpdate',
|
|
96
|
+
AutoModerationActionExecution: 'autoModerationActionExecution',
|
|
97
|
+
AutoModerationRuleCreate: 'autoModerationRuleCreate',
|
|
98
|
+
AutoModerationRuleDelete: 'autoModerationRuleDelete',
|
|
99
|
+
AutoModerationRuleUpdate: 'autoModerationRuleUpdate',
|
|
100
|
+
CacheSweep: 'cacheSweep',
|
|
101
|
+
ChannelCreate: 'channelCreate',
|
|
102
|
+
ChannelDelete: 'channelDelete',
|
|
103
|
+
ChannelPinsUpdate: 'channelPinsUpdate',
|
|
104
|
+
ChannelUpdate: 'channelUpdate',
|
|
105
|
+
ClientReady: 'clientReady',
|
|
106
|
+
Debug: 'debug',
|
|
107
|
+
EntitlementCreate: 'entitlementCreate',
|
|
108
|
+
EntitlementDelete: 'entitlementDelete',
|
|
109
|
+
EntitlementUpdate: 'entitlementUpdate',
|
|
110
|
+
Error: 'error',
|
|
111
|
+
GuildAuditLogEntryCreate: 'guildAuditLogEntryCreate',
|
|
112
|
+
GuildAvailable: 'guildAvailable',
|
|
113
|
+
GuildBanAdd: 'guildBanAdd',
|
|
114
|
+
GuildBanRemove: 'guildBanRemove',
|
|
115
|
+
GuildCreate: 'guildCreate',
|
|
116
|
+
GuildDelete: 'guildDelete',
|
|
117
|
+
GuildEmojiCreate: 'emojiCreate',
|
|
118
|
+
GuildEmojiDelete: 'emojiDelete',
|
|
119
|
+
GuildEmojiUpdate: 'emojiUpdate',
|
|
120
|
+
GuildIntegrationsUpdate: 'guildIntegrationsUpdate',
|
|
121
|
+
GuildMemberAdd: 'guildMemberAdd',
|
|
122
|
+
GuildMemberAvailable: 'guildMemberAvailable',
|
|
123
|
+
GuildMemberRemove: 'guildMemberRemove',
|
|
124
|
+
GuildMembersChunk: 'guildMembersChunk',
|
|
125
|
+
GuildMemberUpdate: 'guildMemberUpdate',
|
|
126
|
+
GuildRoleCreate: 'roleCreate',
|
|
127
|
+
GuildRoleDelete: 'roleDelete',
|
|
128
|
+
GuildRoleUpdate: 'roleUpdate',
|
|
129
|
+
GuildScheduledEventCreate: 'guildScheduledEventCreate',
|
|
130
|
+
GuildScheduledEventDelete: 'guildScheduledEventDelete',
|
|
131
|
+
GuildScheduledEventUpdate: 'guildScheduledEventUpdate',
|
|
132
|
+
GuildScheduledEventUserAdd: 'guildScheduledEventUserAdd',
|
|
133
|
+
GuildScheduledEventUserRemove: 'guildScheduledEventUserRemove',
|
|
134
|
+
GuildSoundboardSoundCreate: 'guildSoundboardSoundCreate',
|
|
135
|
+
GuildSoundboardSoundDelete: 'guildSoundboardSoundDelete',
|
|
136
|
+
GuildSoundboardSoundsUpdate: 'guildSoundboardSoundsUpdate',
|
|
137
|
+
GuildSoundboardSoundUpdate: 'guildSoundboardSoundUpdate',
|
|
138
|
+
GuildStickerCreate: 'stickerCreate',
|
|
139
|
+
GuildStickerDelete: 'stickerDelete',
|
|
140
|
+
GuildStickerUpdate: 'stickerUpdate',
|
|
141
|
+
GuildUnavailable: 'guildUnavailable',
|
|
142
|
+
GuildUpdate: 'guildUpdate',
|
|
143
|
+
InteractionCreate: 'interactionCreate',
|
|
144
|
+
Invalidated: 'invalidated',
|
|
145
|
+
InviteCreate: 'inviteCreate',
|
|
146
|
+
InviteDelete: 'inviteDelete',
|
|
147
|
+
MessageBulkDelete: 'messageDeleteBulk',
|
|
148
|
+
MessageCreate: 'messageCreate',
|
|
149
|
+
MessageDelete: 'messageDelete',
|
|
150
|
+
MessagePollVoteAdd: 'messagePollVoteAdd',
|
|
151
|
+
MessagePollVoteRemove: 'messagePollVoteRemove',
|
|
152
|
+
MessageReactionAdd: 'messageReactionAdd',
|
|
153
|
+
MessageReactionRemove: 'messageReactionRemove',
|
|
154
|
+
MessageReactionRemoveAll: 'messageReactionRemoveAll',
|
|
155
|
+
MessageReactionRemoveEmoji: 'messageReactionRemoveEmoji',
|
|
156
|
+
MessageUpdate: 'messageUpdate',
|
|
157
|
+
PresenceUpdate: 'presenceUpdate',
|
|
158
|
+
SoundboardSounds: 'soundboardSounds',
|
|
159
|
+
StageInstanceCreate: 'stageInstanceCreate',
|
|
160
|
+
StageInstanceDelete: 'stageInstanceDelete',
|
|
161
|
+
StageInstanceUpdate: 'stageInstanceUpdate',
|
|
162
|
+
SubscriptionCreate: 'subscriptionCreate',
|
|
163
|
+
SubscriptionDelete: 'subscriptionDelete',
|
|
164
|
+
SubscriptionUpdate: 'subscriptionUpdate',
|
|
165
|
+
ThreadCreate: 'threadCreate',
|
|
166
|
+
ThreadDelete: 'threadDelete',
|
|
167
|
+
ThreadListSync: 'threadListSync',
|
|
168
|
+
ThreadMembersUpdate: 'threadMembersUpdate',
|
|
169
|
+
ThreadMemberUpdate: 'threadMemberUpdate',
|
|
170
|
+
ThreadUpdate: 'threadUpdate',
|
|
171
|
+
TypingStart: 'typingStart',
|
|
172
|
+
UserUpdate: 'userUpdate',
|
|
173
|
+
VoiceChannelEffectSend: 'voiceChannelEffectSend',
|
|
174
|
+
VoiceServerUpdate: 'voiceServerUpdate',
|
|
175
|
+
VoiceStateUpdate: 'voiceStateUpdate',
|
|
176
|
+
Warn: 'warn',
|
|
177
|
+
WebhooksUpdate: 'webhooksUpdate',
|
|
178
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* eslint-disable jsdoc/check-values */
|
|
2
|
+
|
|
3
|
+
import { GuildMemberFlags } from 'discord-api-types/v10';
|
|
4
|
+
import { BitField } from './BitField.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Data structure that makes it easy to interact with a {@link GuildMember#flags} bitfield.
|
|
8
|
+
*
|
|
9
|
+
* @extends {BitField}
|
|
10
|
+
*/
|
|
11
|
+
export class GuildMemberFlagsBitField extends BitField {
|
|
12
|
+
/**
|
|
13
|
+
* Numeric guild member flags.
|
|
14
|
+
*
|
|
15
|
+
* @type {GuildMemberFlags}
|
|
16
|
+
* @memberof GuildMemberFlagsBitField
|
|
17
|
+
*/
|
|
18
|
+
static Flags = GuildMemberFlags;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @name GuildMemberFlagsBitField
|
|
23
|
+
* @kind constructor
|
|
24
|
+
* @memberof GuildMemberFlagsBitField
|
|
25
|
+
* @param {BitFieldResolvable} [bits=0] Bit(s) to read from
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Bitfield of the packed bits
|
|
30
|
+
*
|
|
31
|
+
* @type {number}
|
|
32
|
+
* @name GuildMemberFlagsBitField#bitfield
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Data that can be resolved to give a guild member flag bitfield. This can be:
|
|
37
|
+
* - A string (see {@link GuildMemberFlagsBitField.Flags})
|
|
38
|
+
* - A guild member flag
|
|
39
|
+
* - An instance of GuildMemberFlagsBitField
|
|
40
|
+
* - An Array of GuildMemberFlagsResolvable
|
|
41
|
+
*
|
|
42
|
+
* @typedef {string|number|GuildMemberFlagsBitField|GuildMemberFlagsResolvable[]} GuildMemberFlagsResolvable
|
|
43
|
+
*/
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* eslint-disable jsdoc/check-values */
|
|
2
|
+
import { GatewayIntentBits } from 'discord-api-types/v10';
|
|
3
|
+
import { BitField } from './BitField.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Data structure that makes it easy to calculate intents.
|
|
7
|
+
*
|
|
8
|
+
* @extends {BitField}
|
|
9
|
+
*/
|
|
10
|
+
export class IntentsBitField extends BitField {
|
|
11
|
+
/**
|
|
12
|
+
* Numeric WebSocket intents
|
|
13
|
+
*
|
|
14
|
+
* @type {GatewayIntentBits}
|
|
15
|
+
* @memberof IntentsBitField
|
|
16
|
+
*/
|
|
17
|
+
static Flags = GatewayIntentBits;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @name IntentsBitField
|
|
22
|
+
* @kind constructor
|
|
23
|
+
* @memberof IntentsBitField
|
|
24
|
+
* @param {IntentsResolvable} [bits=0] Bit(s) to read from
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Data that can be resolved to give a permission number. This can be:
|
|
29
|
+
* - A string (see {@link IntentsBitField.Flags})
|
|
30
|
+
* - An intents flag
|
|
31
|
+
* - An instance of {@link IntentsBitField}
|
|
32
|
+
* - An array of IntentsResolvable
|
|
33
|
+
*
|
|
34
|
+
* @typedef {string|number|IntentsBitField|IntentsResolvable[]} IntentsResolvable
|
|
35
|
+
*/
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* eslint-disable jsdoc/check-values */
|
|
2
|
+
|
|
3
|
+
import { InviteFlags } from 'discord-api-types/v10';
|
|
4
|
+
import { BitField } from './BitField.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Data structure that makes it easy to interact with a {@link GuildInvite#flags} bit field.
|
|
8
|
+
*
|
|
9
|
+
* @extends {BitField}
|
|
10
|
+
*/
|
|
11
|
+
export class InviteFlagsBitField extends BitField {
|
|
12
|
+
/**
|
|
13
|
+
* Numeric invite flags.
|
|
14
|
+
*
|
|
15
|
+
* @type {InviteFlags}
|
|
16
|
+
* @memberof InviteFlagsBitField
|
|
17
|
+
*/
|
|
18
|
+
static Flags = InviteFlags;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @name InviteFlagsBitField
|
|
23
|
+
* @kind constructor
|
|
24
|
+
* @memberof InviteFlagsBitField
|
|
25
|
+
* @param {BitFieldResolvable} [bits=0] Bit(s) to read from
|
|
26
|
+
*/
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { InviteType } from 'discord-api-types/v10';
|
|
2
|
+
import { BaseInvite } from '../structures/BaseInvite.js';
|
|
3
|
+
import { GroupDMInvite } from '../structures/GroupDMInvite.js';
|
|
4
|
+
import { GuildInvite } from '../structures/GuildInvite.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Any invite.
|
|
8
|
+
*
|
|
9
|
+
* @typedef {GuildInvite|GroupDMInvite} Invite
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const InviteTypeToClass = {
|
|
13
|
+
[InviteType.Guild]: GuildInvite,
|
|
14
|
+
[InviteType.GroupDM]: GroupDMInvite,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Creates an invite.
|
|
19
|
+
*
|
|
20
|
+
* @param {Client} client The client
|
|
21
|
+
* @param {Object} data The data
|
|
22
|
+
* @returns {BaseInvite}
|
|
23
|
+
* @ignore
|
|
24
|
+
*/
|
|
25
|
+
export function createInvite(client, data) {
|
|
26
|
+
return new (InviteTypeToClass[data.type] ?? BaseInvite)(client, data);
|
|
27
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Collection } from '@ovencord/collection';
|
|
2
|
+
import { DiscordjsTypeError, ErrorCodes } from '../errors/index.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Options for defining the behavior of a LimitedCollection
|
|
6
|
+
*
|
|
7
|
+
* @typedef {Object} LimitedCollectionOptions
|
|
8
|
+
* @property {?number} [maxSize=Infinity] The maximum size of the Collection
|
|
9
|
+
* @property {?Function} [keepOverLimit=null] A function, which is passed the value and key of an entry, ran to decide
|
|
10
|
+
* to keep an entry past the maximum size
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A Collection which holds a max amount of entries.
|
|
15
|
+
*
|
|
16
|
+
* @extends {Collection}
|
|
17
|
+
* @param {LimitedCollectionOptions} [options={}] Options for constructing the Collection.
|
|
18
|
+
* @param {Iterable} [iterable=null] Optional entries passed to the Map constructor.
|
|
19
|
+
*/
|
|
20
|
+
export class LimitedCollection extends Collection {
|
|
21
|
+
public maxSize: any;
|
|
22
|
+
public keepOverLimit: any;
|
|
23
|
+
constructor(options = {}, iterable = undefined) {
|
|
24
|
+
if (typeof options !== 'object' || options === null) {
|
|
25
|
+
throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'options', 'object', true);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const { maxSize = Infinity, keepOverLimit = null } = options;
|
|
29
|
+
|
|
30
|
+
if (typeof maxSize !== 'number') {
|
|
31
|
+
throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'maxSize', 'number');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (keepOverLimit !== null && typeof keepOverLimit !== 'function') {
|
|
35
|
+
throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'keepOverLimit', 'function');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
super(iterable);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The max size of the Collection.
|
|
42
|
+
*
|
|
43
|
+
* @type {number}
|
|
44
|
+
*/
|
|
45
|
+
this.maxSize = maxSize;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A function called to check if an entry should be kept when the Collection is at max size.
|
|
49
|
+
*
|
|
50
|
+
* @type {?Function}
|
|
51
|
+
*/
|
|
52
|
+
this.keepOverLimit = keepOverLimit;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
set(key, value) {
|
|
56
|
+
if (this.maxSize === 0 && !this.keepOverLimit?.(value, key, this)) return this;
|
|
57
|
+
if (this.size >= this.maxSize && !this.has(key)) {
|
|
58
|
+
for (const [iteratedKey, iteratedValue] of this.entries()) {
|
|
59
|
+
const keep = this.keepOverLimit?.(iteratedValue, iteratedKey, this) ?? false;
|
|
60
|
+
if (!keep) {
|
|
61
|
+
this.delete(iteratedKey);
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return super.set(key, value);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static get [Symbol.species]() {
|
|
71
|
+
return Collection;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* eslint-disable jsdoc/check-values */
|
|
2
|
+
|
|
3
|
+
import { MessageFlags } from 'discord-api-types/v10';
|
|
4
|
+
import { BitField } from './BitField.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Data structure that makes it easy to interact with a {@link Message#flags} bitfield.
|
|
8
|
+
*
|
|
9
|
+
* @extends {BitField}
|
|
10
|
+
*/
|
|
11
|
+
export class MessageFlagsBitField extends BitField {
|
|
12
|
+
/**
|
|
13
|
+
* Numeric message flags.
|
|
14
|
+
*
|
|
15
|
+
* @type {MessageFlags}
|
|
16
|
+
* @memberof MessageFlagsBitField
|
|
17
|
+
*/
|
|
18
|
+
static Flags = MessageFlags;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @name MessageFlagsBitField
|
|
23
|
+
* @kind constructor
|
|
24
|
+
* @memberof MessageFlagsBitField
|
|
25
|
+
* @param {BitFieldResolvable} [bits=0] Bit(s) to read from
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Data that can be resolved to give a message flags bit field. This can be:
|
|
30
|
+
* - A string (see {@link MessageFlagsBitField.Flags})
|
|
31
|
+
* - A message flag
|
|
32
|
+
* - An instance of {@link MessageFlagsBitField}
|
|
33
|
+
* - An array of `MessageFlagsResolvable`
|
|
34
|
+
*
|
|
35
|
+
* @typedef {string|number|MessageFlagsBitField|MessageFlagsResolvable[]} MessageFlagsResolvable
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Bitfield of the packed bits
|
|
40
|
+
*
|
|
41
|
+
* @type {number}
|
|
42
|
+
* @name MessageFlagsBitField#bitfield
|
|
43
|
+
*/
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { DefaultRestOptions, DefaultUserAgentAppendix } from '@ovencord/rest';
|
|
2
|
+
import { DefaultWebSocketManagerOptions } from '@ovencord/ws';
|
|
3
|
+
import { version } from '../../package.json.js';
|
|
4
|
+
import { toSnakeCase } from './Transformers.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Object} CacheFactoryParams
|
|
8
|
+
* @property {Function} holds The class that the cache will hold.
|
|
9
|
+
* @property {Function} manager The fully extended manager class the cache is being requested from.
|
|
10
|
+
* @property {Function} managerType The base manager class the cache is being requested from.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {Function} CacheFactory
|
|
15
|
+
* @param {CacheFactoryParams} params The parameters
|
|
16
|
+
* @returns {Collection} A Collection used to store the cache of the manager.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Options for a client.
|
|
21
|
+
*
|
|
22
|
+
* @typedef {Object} ClientOptions
|
|
23
|
+
* @property {number} [closeTimeout=5_000] The amount of time in milliseconds to wait for the close frame to be received
|
|
24
|
+
* from the WebSocket. Don't have this too high/low. It's best to have it between 2_000-6_000 ms.
|
|
25
|
+
* @property {CacheFactory} [makeCache] Function to create a cache.
|
|
26
|
+
* You can use your own function, or the {@link Options} class to customize the Collection used for the cache.
|
|
27
|
+
* <warn>Overriding the cache used in `GuildManager`, `ChannelManager`, `GuildChannelManager`, `RoleManager`,
|
|
28
|
+
* and `PermissionOverwriteManager` is unsupported and **will** break functionality</warn>
|
|
29
|
+
* @property {MessageMentionOptions} [allowedMentions] The default value for {@link BaseMessageOptions#allowedMentions}
|
|
30
|
+
* @property {Partials[]} [partials] Structures allowed to be partial. This means events can be emitted even when
|
|
31
|
+
* they're missing all the data for a particular structure. See the "Partial Structures" topic on the
|
|
32
|
+
* {@link https://discordjs.guide/popular-topics/partials.html guide} for some
|
|
33
|
+
* important usage information, as partials require you to put checks in place when handling data.
|
|
34
|
+
* @property {boolean} [failIfNotExists=true] The default value for {@link MessageReplyOptions#failIfNotExists}
|
|
35
|
+
* @property {PresenceData} [presence] Presence data to use upon login
|
|
36
|
+
* @property {IntentsResolvable} intents Intents to enable for this connection
|
|
37
|
+
* @property {number} [waitGuildTimeout=15_000] Time in milliseconds that clients with the
|
|
38
|
+
* {@link GatewayIntentBits.Guilds} gateway intent should wait for missing guilds to be received before being ready.
|
|
39
|
+
* @property {SweeperOptions} [sweepers=this.DefaultSweeperSettings] Options for cache sweeping
|
|
40
|
+
* @property {WebSocketManagerOptions} [ws] Options for the WebSocketManager
|
|
41
|
+
* @property {RESTOptions} [rest] Options for the REST manager
|
|
42
|
+
* @property {Function} [jsonTransformer] A function used to transform outgoing json data
|
|
43
|
+
* @property {boolean} [enforceNonce=false] The default value for {@link MessageCreateOptions#enforceNonce}
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Options for {@link Sweepers} defining the behavior of cache sweeping
|
|
48
|
+
*
|
|
49
|
+
* @typedef {Object<SweeperKey, SweepOptions>} SweeperOptions
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Options for sweeping a single type of item from cache
|
|
54
|
+
*
|
|
55
|
+
* @typedef {Object} SweepOptions
|
|
56
|
+
* @property {number} interval The interval (in seconds) at which to perform sweeping of the item
|
|
57
|
+
* @property {number} [lifetime] How long an item should stay in cache until it is considered sweepable.
|
|
58
|
+
* <warn>This property is only valid for the `invites`, `messages`, and `threads` keys. The `filter` property
|
|
59
|
+
* is mutually exclusive to this property and takes priority</warn>
|
|
60
|
+
* @property {GlobalSweepFilter} filter The function used to determine the function passed to the sweep method
|
|
61
|
+
* <info>This property is optional when the key is `invites`, `messages`, or `threads` and `lifetime` is set</info>
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Contains various utilities for client options.
|
|
66
|
+
*/
|
|
67
|
+
export class Options extends null {
|
|
68
|
+
/**
|
|
69
|
+
* The default user agent appendix.
|
|
70
|
+
*
|
|
71
|
+
* @type {string}
|
|
72
|
+
* @memberof Options
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
static userAgentAppendix = `discord.js/${version} ${DefaultUserAgentAppendix}`.trimEnd();
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The default client options.
|
|
79
|
+
*
|
|
80
|
+
* @returns {ClientOptions}
|
|
81
|
+
*/
|
|
82
|
+
static createDefault() {
|
|
83
|
+
return {
|
|
84
|
+
closeTimeout: 5_000,
|
|
85
|
+
waitGuildTimeout: 15_000,
|
|
86
|
+
makeCache: this.cacheWithLimits(this.DefaultMakeCacheSettings),
|
|
87
|
+
partials: [],
|
|
88
|
+
failIfNotExists: true,
|
|
89
|
+
enforceNonce: false,
|
|
90
|
+
sweepers: this.DefaultSweeperSettings,
|
|
91
|
+
ws: {
|
|
92
|
+
...DefaultWebSocketManagerOptions,
|
|
93
|
+
largeThreshold: 50,
|
|
94
|
+
version: 10,
|
|
95
|
+
},
|
|
96
|
+
rest: {
|
|
97
|
+
...DefaultRestOptions,
|
|
98
|
+
userAgentAppendix: this.userAgentAppendix,
|
|
99
|
+
},
|
|
100
|
+
jsonTransformer: toSnakeCase,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Create a cache factory using predefined settings to sweep or limit.
|
|
106
|
+
*
|
|
107
|
+
* @param {Object<string, LimitedCollectionOptions|number>} [settings={}] Settings passed to the relevant constructor.
|
|
108
|
+
* If no setting is provided for a manager, it uses Collection.
|
|
109
|
+
* If a number is provided for a manager, it uses that number as the max size for a LimitedCollection.
|
|
110
|
+
* If LimitedCollectionOptions are provided for a manager, it uses those settings to form a LimitedCollection.
|
|
111
|
+
* @returns {CacheFactory}
|
|
112
|
+
* @example
|
|
113
|
+
* // Store up to 200 messages per channel and 200 members per guild, always keeping the client member.
|
|
114
|
+
* Options.cacheWithLimits({
|
|
115
|
+
* MessageManager: 200,
|
|
116
|
+
* GuildMemberManager: {
|
|
117
|
+
* maxSize: 200,
|
|
118
|
+
* keepOverLimit: (member) => member.id === client.user.id,
|
|
119
|
+
* },
|
|
120
|
+
* });
|
|
121
|
+
*/
|
|
122
|
+
static cacheWithLimits(settings = {}) {
|
|
123
|
+
import { Collection } from '@ovencord/collection';
|
|
124
|
+
import { LimitedCollection } from './LimitedCollection.js';
|
|
125
|
+
|
|
126
|
+
return ({ managerType, manager }) => {
|
|
127
|
+
const setting = settings[manager.name] ?? settings[managerType.name];
|
|
128
|
+
/* eslint-disable-next-line eqeqeq */
|
|
129
|
+
if (setting == null) {
|
|
130
|
+
return new Collection();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (typeof setting === 'number') {
|
|
134
|
+
if (setting === Infinity) {
|
|
135
|
+
return new Collection();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return new LimitedCollection({ maxSize: setting });
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* eslint-disable-next-line eqeqeq */
|
|
142
|
+
const noLimit = setting.maxSize == null || setting.maxSize === Infinity;
|
|
143
|
+
if (noLimit) {
|
|
144
|
+
return new Collection();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return new LimitedCollection(setting);
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Create a cache factory that always caches everything.
|
|
153
|
+
*
|
|
154
|
+
* @returns {CacheFactory}
|
|
155
|
+
*/
|
|
156
|
+
static cacheEverything() {
|
|
157
|
+
import { Collection } from '@ovencord/collection';
|
|
158
|
+
return () => new Collection();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* The default settings passed to {@link ClientOptions.makeCache}.
|
|
163
|
+
* The caches that this changes are:
|
|
164
|
+
* - `MessageManager` - Limit to 200 messages
|
|
165
|
+
* <info>If you want to keep default behavior and add on top of it you can use this object and add on to it, e.g.
|
|
166
|
+
* `makeCache: Options.cacheWithLimits({ ...Options.DefaultMakeCacheSettings, ReactionManager: 0 })`</info>
|
|
167
|
+
*
|
|
168
|
+
* @type {Object<string, LimitedCollectionOptions|number>}
|
|
169
|
+
*/
|
|
170
|
+
static get DefaultMakeCacheSettings() {
|
|
171
|
+
return {
|
|
172
|
+
MessageManager: 200,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The default settings passed to {@link ClientOptions.sweepers}.
|
|
178
|
+
* The sweepers that this changes are:
|
|
179
|
+
* - `threads` - Sweep archived threads every hour, removing those archived more than 4 hours ago
|
|
180
|
+
* <info>If you want to keep default behavior and add on top of it you can use this object and add on to it, e.g.
|
|
181
|
+
* `sweepers: { ...Options.DefaultSweeperSettings, messages: { interval: 300, lifetime: 600 } }`</info>
|
|
182
|
+
*
|
|
183
|
+
* @type {SweeperOptions}
|
|
184
|
+
*/
|
|
185
|
+
static get DefaultSweeperSettings() {
|
|
186
|
+
return {
|
|
187
|
+
threads: {
|
|
188
|
+
interval: 3_600,
|
|
189
|
+
lifetime: 14_400,
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* @external RESTOptions
|
|
199
|
+
* @see {@link https://discord.js.org/docs/packages/rest/stable/RESTOptions:Interface}
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* @external WebSocketManager
|
|
204
|
+
* @see {@link https://discord.js.org/docs/packages/ws/stable/WebSocketManager:Class}
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @external IShardingStrategy
|
|
209
|
+
* @see {@link https://discord.js.org/docs/packages/ws/stable/IShardingStrategy:Interface}
|
|
210
|
+
*/
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @external IIdentifyThrottler
|
|
214
|
+
* @see {@link https://discord.js.org/docs/packages/ws/stable/IIdentifyThrottler:Interface}
|
|
215
|
+
*/
|