lolka.js 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/package.json +21 -52
- package/src/client/BaseClient.js +120 -0
- package/src/client/Client.js +147 -446
- package/src/client/WebhookClient.js +103 -0
- package/src/client/actions/Action.js +3 -4
- package/src/client/actions/ActionsManager.js +65 -55
- package/src/client/actions/ApplicationCommandPermissionsUpdate.js +34 -0
- package/src/client/actions/AutoModerationActionExecution.js +26 -0
- package/src/client/actions/AutoModerationRuleCreate.js +27 -0
- package/src/client/actions/AutoModerationRuleDelete.js +31 -0
- package/src/client/actions/AutoModerationRuleUpdate.js +29 -0
- package/src/client/actions/ChannelCreate.js +3 -5
- package/src/client/actions/ChannelDelete.js +3 -4
- package/src/client/actions/ChannelUpdate.js +3 -3
- package/src/client/actions/EntitlementCreate.js +23 -0
- package/src/client/actions/EntitlementDelete.js +27 -0
- package/src/client/actions/EntitlementUpdate.js +25 -0
- package/src/client/actions/GuildAuditLogEntryCreate.js +29 -0
- package/src/client/actions/GuildBanAdd.js +20 -0
- package/src/client/actions/GuildBanRemove.js +25 -0
- package/src/client/actions/GuildChannelsPositionUpdate.js +3 -3
- package/src/client/actions/GuildDelete.js +44 -0
- package/src/client/actions/GuildEmojiCreate.js +3 -4
- package/src/client/actions/GuildEmojiDelete.js +3 -4
- package/src/client/actions/GuildEmojiUpdate.js +3 -4
- package/src/client/actions/GuildEmojisUpdate.js +2 -2
- package/src/client/actions/GuildIntegrationsUpdate.js +19 -0
- package/src/client/actions/GuildMemberRemove.js +6 -8
- package/src/client/actions/GuildMemberUpdate.js +6 -7
- package/src/client/actions/GuildRoleCreate.js +4 -6
- package/src/client/actions/GuildRoleDelete.js +3 -4
- package/src/client/actions/GuildRoleUpdate.js +39 -0
- package/src/client/actions/GuildRolesPositionUpdate.js +3 -3
- package/src/client/actions/GuildScheduledEventCreate.js +27 -0
- package/src/client/actions/GuildScheduledEventDelete.js +3 -4
- package/src/client/actions/GuildScheduledEventUpdate.js +30 -0
- package/src/client/actions/GuildScheduledEventUserAdd.js +3 -4
- package/src/client/actions/GuildScheduledEventUserRemove.js +3 -4
- package/src/client/actions/GuildSoundboardSoundDelete.js +3 -4
- package/src/client/actions/GuildStickerCreate.js +3 -4
- package/src/client/actions/GuildStickerDelete.js +3 -4
- package/src/client/actions/GuildStickerUpdate.js +3 -4
- package/src/client/actions/GuildStickersUpdate.js +2 -2
- package/src/client/actions/GuildUpdate.js +3 -4
- package/src/client/actions/InteractionCreate.js +15 -18
- package/src/client/actions/InviteCreate.js +27 -0
- package/src/client/actions/InviteDelete.js +29 -0
- package/src/client/actions/MessageCreate.js +3 -4
- package/src/client/actions/MessageDelete.js +3 -4
- package/src/client/actions/MessageDeleteBulk.js +3 -5
- package/src/client/actions/MessagePollVoteAdd.js +3 -4
- package/src/client/actions/MessagePollVoteRemove.js +3 -4
- package/src/client/actions/MessageReactionAdd.js +5 -7
- package/src/client/actions/MessageReactionRemove.js +4 -5
- package/src/client/actions/MessageReactionRemoveAll.js +4 -5
- package/src/client/actions/MessageReactionRemoveEmoji.js +4 -5
- package/src/client/actions/MessageUpdate.js +2 -2
- package/src/client/actions/PresenceUpdate.js +45 -0
- package/src/client/actions/StageInstanceCreate.js +3 -4
- package/src/client/actions/StageInstanceDelete.js +3 -4
- package/src/client/actions/StageInstanceUpdate.js +3 -4
- package/src/client/actions/ThreadCreate.js +3 -5
- package/src/client/actions/ThreadDelete.js +26 -0
- package/src/client/actions/ThreadListSync.js +60 -0
- package/src/client/actions/ThreadMemberUpdate.js +30 -0
- package/src/client/actions/ThreadMembersUpdate.js +3 -5
- package/src/client/actions/TypingStart.js +5 -6
- package/src/client/actions/UserUpdate.js +3 -4
- package/src/client/actions/VoiceStateUpdate.js +43 -0
- package/src/client/actions/WebhooksUpdate.js +37 -0
- package/src/client/voice/ClientVoiceManager.js +6 -10
- package/src/client/websocket/WebSocketManager.js +407 -0
- package/src/client/websocket/WebSocketShard.js +234 -0
- package/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.js +2 -27
- package/src/client/websocket/handlers/AUTO_MODERATION_ACTION_EXECUTION.js +2 -15
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_CREATE.js +2 -16
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_DELETE.js +2 -19
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_UPDATE.js +2 -18
- package/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.js +1 -2
- package/src/client/websocket/handlers/CHANNEL_UPDATE.js +1 -2
- package/src/client/websocket/handlers/ENTITLEMENT_CREATE.js +2 -12
- package/src/client/websocket/handlers/ENTITLEMENT_DELETE.js +2 -16
- package/src/client/websocket/handlers/ENTITLEMENT_UPDATE.js +2 -14
- package/src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.js +2 -17
- package/src/client/websocket/handlers/GUILD_BAN_ADD.js +2 -13
- package/src/client/websocket/handlers/GUILD_BAN_REMOVE.js +2 -18
- package/src/client/websocket/handlers/GUILD_CREATE.js +5 -7
- package/src/client/websocket/handlers/GUILD_DELETE.js +2 -34
- package/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.js +2 -13
- package/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.js +1 -3
- package/src/client/websocket/handlers/GUILD_MEMBER_ADD.js +11 -9
- package/src/client/websocket/handlers/GUILD_MEMBER_REMOVE.js +2 -2
- package/src/client/websocket/handlers/GUILD_MEMBER_UPDATE.js +2 -2
- package/src/client/websocket/handlers/GUILD_ROLE_UPDATE.js +2 -19
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_CREATE.js +2 -15
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_UPDATE.js +2 -17
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUNDS_UPDATE.js +1 -2
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_CREATE.js +1 -2
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_UPDATE.js +1 -2
- package/src/client/websocket/handlers/INVITE_CREATE.js +2 -18
- package/src/client/websocket/handlers/INVITE_DELETE.js +2 -21
- package/src/client/websocket/handlers/MESSAGE_UPDATE.js +1 -2
- package/src/client/websocket/handlers/PRESENCE_UPDATE.js +2 -40
- package/src/client/websocket/handlers/RATE_LIMITED.js +2 -1
- package/src/client/websocket/handlers/READY.js +5 -8
- package/src/client/websocket/handlers/RESUMED.js +14 -0
- package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.js +1 -2
- package/src/client/websocket/handlers/SUBSCRIPTION_CREATE.js +1 -2
- package/src/client/websocket/handlers/SUBSCRIPTION_DELETE.js +1 -2
- package/src/client/websocket/handlers/SUBSCRIPTION_UPDATE.js +1 -2
- package/src/client/websocket/handlers/THREAD_DELETE.js +2 -15
- package/src/client/websocket/handlers/THREAD_LIST_SYNC.js +2 -49
- package/src/client/websocket/handlers/THREAD_MEMBER_UPDATE.js +2 -23
- package/src/client/websocket/handlers/THREAD_UPDATE.js +1 -2
- package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.js +2 -3
- package/src/client/websocket/handlers/VOICE_SERVER_UPDATE.js +3 -30
- package/src/client/websocket/handlers/VOICE_STATE_UPDATE.js +2 -35
- package/src/client/websocket/handlers/WEBHOOKS_UPDATE.js +2 -14
- package/src/client/websocket/handlers/index.js +75 -74
- package/src/errors/DJSError.js +7 -7
- package/src/errors/ErrorCodes.js +134 -58
- package/src/errors/Messages.js +143 -115
- package/src/errors/index.js +3 -5
- package/src/index.js +227 -234
- package/src/managers/ApplicationCommandManager.js +24 -60
- package/src/managers/ApplicationCommandPermissionsManager.js +33 -57
- package/src/managers/ApplicationEmojiManager.js +8 -18
- package/src/managers/AutoModerationRuleManager.js +6 -24
- package/src/managers/BaseGuildEmojiManager.js +85 -0
- package/src/managers/BaseManager.js +1 -3
- package/src/managers/CachedManager.js +8 -12
- package/src/managers/CategoryChannelChildManager.js +4 -10
- package/src/managers/ChannelManager.js +8 -70
- package/src/managers/DMMessageManager.js +2 -4
- package/src/managers/DataManager.js +5 -10
- package/src/managers/EntitlementManager.js +8 -19
- package/src/managers/GuildApplicationCommandManager.js +3 -6
- package/src/managers/GuildBanManager.js +52 -27
- package/src/managers/GuildChannelManager.js +54 -91
- package/src/managers/GuildEmojiManager.js +18 -108
- package/src/managers/GuildEmojiRoleManager.js +14 -24
- package/src/managers/GuildForumThreadManager.js +5 -10
- package/src/managers/GuildInviteManager.js +27 -51
- package/src/managers/GuildManager.js +185 -45
- package/src/managers/GuildMemberManager.js +105 -89
- package/src/managers/GuildMemberRoleManager.js +14 -29
- package/src/managers/GuildMessageManager.js +2 -20
- package/src/managers/GuildScheduledEventManager.js +13 -31
- package/src/managers/GuildSoundboardSoundManager.js +5 -17
- package/src/managers/GuildStickerManager.js +21 -34
- package/src/managers/GuildTextThreadManager.js +5 -9
- package/src/managers/MessageManager.js +77 -64
- package/src/managers/PartialGroupDMMessageManager.js +2 -4
- package/src/managers/PermissionOverwriteManager.js +15 -26
- package/src/managers/PollAnswerVoterManager.js +2 -14
- package/src/managers/PresenceManager.js +6 -11
- package/src/managers/ReactionManager.js +6 -13
- package/src/managers/ReactionUserManager.js +4 -11
- package/src/managers/RoleManager.js +74 -76
- package/src/managers/StageInstanceManager.js +8 -18
- package/src/managers/SubscriptionManager.js +4 -9
- package/src/managers/ThreadManager.js +13 -33
- package/src/managers/ThreadMemberManager.js +34 -27
- package/src/managers/UserManager.js +34 -32
- package/src/managers/VoiceStateManager.js +4 -9
- package/src/sharding/Shard.js +40 -64
- package/src/sharding/ShardClientUtil.js +60 -60
- package/src/sharding/ShardingManager.js +30 -89
- package/src/structures/ActionRow.js +18 -6
- package/src/structures/ActionRowBuilder.js +35 -0
- package/src/structures/AnonymousGuild.js +10 -14
- package/src/structures/ApplicationCommand.js +49 -67
- package/src/structures/ApplicationEmoji.js +5 -22
- package/src/structures/ApplicationRoleConnectionMetadata.js +0 -6
- package/src/structures/Attachment.js +7 -25
- package/src/structures/AttachmentBuilder.js +111 -0
- package/src/structures/AutoModerationActionExecution.js +2 -17
- package/src/structures/AutoModerationRule.js +17 -46
- package/src/structures/AutocompleteInteraction.js +4 -14
- package/src/structures/Base.js +2 -4
- package/src/structures/BaseChannel.js +4 -21
- package/src/structures/BaseGuild.js +7 -19
- package/src/structures/BaseGuildEmoji.js +13 -13
- package/src/structures/BaseGuildTextChannel.js +16 -45
- package/src/structures/BaseGuildVoiceChannel.js +12 -43
- package/src/structures/BaseInteraction.js +25 -54
- package/src/structures/BaseSelectMenuComponent.js +2 -8
- package/src/structures/ButtonBuilder.js +44 -0
- package/src/structures/ButtonComponent.js +2 -9
- package/src/structures/ButtonInteraction.js +2 -3
- package/src/structures/CategoryChannel.js +3 -8
- package/src/structures/ChannelSelectMenuBuilder.js +31 -0
- package/src/structures/ChannelSelectMenuComponent.js +2 -4
- package/src/structures/ChannelSelectMenuInteraction.js +2 -5
- package/src/structures/ChatInputCommandInteraction.js +4 -7
- package/src/structures/ClientApplication.js +12 -60
- package/src/structures/ClientPresence.js +10 -15
- package/src/structures/ClientUser.js +19 -36
- package/src/structures/CommandInteraction.js +7 -27
- package/src/structures/CommandInteractionOptionResolver.js +8 -36
- package/src/structures/Component.js +1 -7
- package/src/structures/ContainerComponent.js +3 -9
- package/src/structures/ContextMenuCommandInteraction.js +5 -9
- package/src/structures/DMChannel.js +15 -34
- package/src/structures/DirectoryChannel.js +2 -6
- package/src/structures/Embed.js +2 -19
- package/src/structures/EmbedBuilder.js +50 -0
- package/src/structures/Emoji.js +19 -19
- package/src/structures/Entitlement.js +2 -22
- package/src/structures/FileComponent.js +3 -7
- package/src/structures/ForumChannel.js +3 -6
- package/src/structures/Guild.js +131 -187
- package/src/structures/GuildAuditLogs.js +6 -12
- package/src/structures/GuildAuditLogsEntry.js +63 -88
- package/src/structures/GuildBan.js +3 -9
- package/src/structures/GuildChannel.js +33 -68
- package/src/structures/GuildEmoji.js +7 -19
- package/src/structures/GuildMember.js +58 -107
- package/src/structures/GuildOnboarding.js +2 -9
- package/src/structures/GuildOnboardingPrompt.js +2 -12
- package/src/structures/GuildOnboardingPromptOption.js +2 -12
- package/src/structures/GuildPreview.js +21 -30
- package/src/structures/GuildPreviewEmoji.js +2 -5
- package/src/structures/GuildScheduledEvent.js +19 -59
- package/src/structures/GuildTemplate.js +45 -24
- package/src/structures/Integration.js +7 -30
- package/src/structures/IntegrationApplication.js +12 -9
- package/src/structures/InteractionCallback.js +1 -10
- package/src/structures/InteractionCallbackResource.js +2 -7
- package/src/structures/InteractionCallbackResponse.js +3 -6
- package/src/structures/InteractionCollector.js +36 -23
- package/src/structures/InteractionResponse.js +102 -0
- package/src/structures/InteractionWebhook.js +6 -14
- package/src/structures/Invite.js +341 -0
- package/src/structures/InviteGuild.js +4 -6
- package/src/structures/InviteStageInstance.js +87 -0
- package/src/structures/LabelComponent.js +3 -3
- package/src/structures/MediaChannel.js +2 -3
- package/src/structures/MediaGalleryComponent.js +3 -6
- package/src/structures/MediaGalleryItem.js +2 -7
- package/src/structures/MentionableSelectMenuBuilder.js +32 -0
- package/src/structures/MentionableSelectMenuComponent.js +2 -3
- package/src/structures/MentionableSelectMenuInteraction.js +3 -8
- package/src/structures/Message.js +100 -169
- package/src/structures/MessageCollector.js +5 -16
- package/src/structures/MessageComponentInteraction.js +14 -34
- package/src/structures/MessageContextMenuCommandInteraction.js +2 -4
- package/src/structures/MessageMentions.js +4 -30
- package/src/structures/MessagePayload.js +90 -92
- package/src/structures/MessageReaction.js +17 -31
- package/src/structures/ModalBuilder.js +36 -0
- package/src/structures/{ModalComponentResolver.js → ModalSubmitFields.js} +31 -37
- package/src/structures/ModalSubmitInteraction.js +55 -54
- package/src/structures/NewsChannel.js +32 -0
- package/src/structures/OAuth2Guild.js +3 -6
- package/src/structures/PartialGroupDMChannel.js +11 -23
- package/src/structures/PermissionOverwrites.js +25 -47
- package/src/structures/Poll.js +4 -19
- package/src/structures/PollAnswer.js +29 -13
- package/src/structures/Presence.js +13 -57
- package/src/structures/PrimaryEntryPointCommandInteraction.js +2 -3
- package/src/structures/ReactionCollector.js +4 -21
- package/src/structures/ReactionEmoji.js +3 -5
- package/src/structures/Role.js +48 -65
- package/src/structures/RoleSelectMenuBuilder.js +31 -0
- package/src/structures/RoleSelectMenuComponent.js +2 -3
- package/src/structures/RoleSelectMenuInteraction.js +2 -5
- package/src/structures/SKU.js +2 -9
- package/src/structures/SectionComponent.js +3 -7
- package/src/structures/SelectMenuBuilder.js +26 -0
- package/src/structures/SelectMenuComponent.js +26 -0
- package/src/structures/SelectMenuInteraction.js +26 -0
- package/src/structures/SelectMenuOptionBuilder.js +26 -0
- package/src/structures/SeparatorComponent.js +2 -5
- package/src/structures/SoundboardSound.js +2 -18
- package/src/structures/StageChannel.js +4 -13
- package/src/structures/StageInstance.js +16 -19
- package/src/structures/Sticker.js +4 -28
- package/src/structures/StickerPack.js +4 -16
- package/src/structures/StringSelectMenuBuilder.js +79 -0
- package/src/structures/StringSelectMenuComponent.js +2 -4
- package/src/structures/StringSelectMenuInteraction.js +2 -4
- package/src/structures/StringSelectMenuOptionBuilder.js +49 -0
- package/src/structures/Subscription.js +1 -15
- package/src/structures/Team.js +7 -16
- package/src/structures/TeamMember.js +15 -9
- package/src/structures/TextChannel.js +3 -6
- package/src/structures/TextDisplayComponent.js +2 -4
- package/src/structures/TextInputBuilder.js +31 -0
- package/src/structures/TextInputComponent.js +2 -5
- package/src/structures/ThreadChannel.js +35 -85
- package/src/structures/ThreadMember.js +12 -17
- package/src/structures/ThreadOnlyChannel.js +15 -36
- package/src/structures/ThumbnailComponent.js +3 -8
- package/src/structures/Typing.js +2 -10
- package/src/structures/UnfurledMediaItem.js +2 -5
- package/src/structures/User.js +68 -60
- package/src/structures/UserContextMenuCommandInteraction.js +2 -5
- package/src/structures/UserSelectMenuBuilder.js +31 -0
- package/src/structures/UserSelectMenuComponent.js +2 -3
- package/src/structures/UserSelectMenuInteraction.js +3 -7
- package/src/structures/VoiceChannel.js +4 -11
- package/src/structures/VoiceChannelEffect.js +2 -12
- package/src/structures/VoiceRegion.js +2 -7
- package/src/structures/VoiceState.js +10 -36
- package/src/structures/Webhook.js +37 -65
- package/src/structures/WelcomeChannel.js +5 -12
- package/src/structures/WelcomeScreen.js +3 -8
- package/src/structures/Widget.js +3 -13
- package/src/structures/WidgetMember.js +2 -17
- package/src/structures/interfaces/Application.js +10 -19
- package/src/structures/interfaces/Collector.js +12 -45
- package/src/structures/interfaces/InteractionResponses.js +152 -43
- package/src/structures/interfaces/TextBasedChannel.js +99 -83
- package/src/util/APITypes.js +16 -30
- package/src/util/ActivityFlagsBitField.js +2 -5
- package/src/util/ApplicationFlagsBitField.js +6 -11
- package/src/util/AttachmentFlagsBitField.js +2 -5
- package/src/util/BitField.js +8 -27
- package/src/util/ChannelFlagsBitField.js +6 -11
- package/src/util/Channels.js +61 -73
- package/src/util/Colors.js +43 -43
- package/src/util/Components.js +82 -61
- package/src/util/Constants.js +124 -94
- package/src/util/DataResolver.js +17 -36
- package/src/util/Enums.js +1 -2
- package/src/util/Events.js +14 -3
- package/src/util/Formatters.js +413 -0
- package/src/util/GuildMemberFlagsBitField.js +5 -9
- package/src/util/IntentsBitField.js +6 -10
- package/src/util/InviteFlagsBitField.js +1 -2
- package/src/util/LimitedCollection.js +6 -13
- package/src/util/LolkaSnowflake.js +14 -1
- package/src/util/MessageFlagsBitField.js +6 -11
- package/src/util/Options.js +57 -35
- package/src/util/Partials.js +4 -5
- package/src/util/PermissionsBitField.js +8 -21
- package/src/util/RoleFlagsBitField.js +2 -5
- package/src/util/SKUFlagsBitField.js +1 -4
- package/src/util/ShardEvents.js +3 -1
- package/src/util/Status.js +21 -5
- package/src/util/Sweepers.js +13 -59
- package/src/util/SystemChannelFlagsBitField.js +6 -11
- package/src/util/ThreadMemberFlagsBitField.js +2 -6
- package/src/util/Transformers.js +18 -17
- package/src/util/UserFlagsBitField.js +2 -6
- package/src/util/Util.js +97 -148
- package/src/util/WebSocketShardEvents.js +25 -0
- package/typings/index.d.mts +2392 -1768
- package/typings/index.d.ts +2392 -1768
- package/typings/rawDataTypes.d.ts +211 -0
- package/src/structures/ActivityInstance.js +0 -52
- package/src/structures/ActivityLocation.js +0 -65
- package/src/structures/AnnouncementChannel.js +0 -29
- package/src/structures/AuthorizingIntegrationOwners.js +0 -64
- package/src/structures/BaseInvite.js +0 -187
- package/src/structures/GroupDMInvite.js +0 -37
- package/src/structures/GuildInvite.js +0 -223
- package/src/util/Invites.js +0 -31
package/src/util/Sweepers.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { setInterval, clearInterval } = require('node:timers');
|
|
4
|
-
const {
|
|
5
|
-
const
|
|
6
|
-
const {
|
|
4
|
+
const { ThreadChannelTypes, SweeperKeys } = require('./Constants');
|
|
5
|
+
const Events = require('./Events');
|
|
6
|
+
const { DiscordjsTypeError, ErrorCodes } = require('../errors');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @typedef {Function} GlobalSweepFilter
|
|
@@ -19,7 +19,6 @@ class Sweepers {
|
|
|
19
19
|
constructor(client, options) {
|
|
20
20
|
/**
|
|
21
21
|
* The client that instantiated this
|
|
22
|
-
*
|
|
23
22
|
* @type {Client}
|
|
24
23
|
* @readonly
|
|
25
24
|
*/
|
|
@@ -27,14 +26,12 @@ class Sweepers {
|
|
|
27
26
|
|
|
28
27
|
/**
|
|
29
28
|
* The options the sweepers were instantiated with
|
|
30
|
-
*
|
|
31
29
|
* @type {SweeperOptions}
|
|
32
30
|
*/
|
|
33
31
|
this.options = options;
|
|
34
32
|
|
|
35
33
|
/**
|
|
36
34
|
* A record of interval timeout that is used to sweep the indicated items, or null if not being swept
|
|
37
|
-
*
|
|
38
35
|
* @type {Object<SweeperKey, ?Timeout>}
|
|
39
36
|
*/
|
|
40
37
|
this.intervals = Object.fromEntries(SweeperKeys.map(key => [key, null]));
|
|
@@ -57,9 +54,6 @@ class Sweepers {
|
|
|
57
54
|
break;
|
|
58
55
|
case 'threads':
|
|
59
56
|
clonedOptions.filter = this.constructor.archivedThreadSweepFilter(clonedOptions.lifetime);
|
|
60
|
-
break;
|
|
61
|
-
default:
|
|
62
|
-
break;
|
|
63
57
|
}
|
|
64
58
|
}
|
|
65
59
|
|
|
@@ -69,7 +63,6 @@ class Sweepers {
|
|
|
69
63
|
|
|
70
64
|
/**
|
|
71
65
|
* Sweeps all guild and global application commands and removes the ones which are indicated by the filter.
|
|
72
|
-
*
|
|
73
66
|
* @param {Function} filter The function used to determine which commands will be removed from the caches.
|
|
74
67
|
* @returns {number} Amount of commands that were removed from the caches
|
|
75
68
|
*/
|
|
@@ -87,7 +80,6 @@ class Sweepers {
|
|
|
87
80
|
|
|
88
81
|
/**
|
|
89
82
|
* Sweeps all auto moderation rules and removes the ones which are indicated by the filter.
|
|
90
|
-
*
|
|
91
83
|
* @param {Function} filter The function used to determine
|
|
92
84
|
* which auto moderation rules will be removed from the caches
|
|
93
85
|
* @returns {number} Amount of auto moderation rules that were removed from the caches
|
|
@@ -98,7 +90,6 @@ class Sweepers {
|
|
|
98
90
|
|
|
99
91
|
/**
|
|
100
92
|
* Sweeps all guild bans and removes the ones which are indicated by the filter.
|
|
101
|
-
*
|
|
102
93
|
* @param {Function} filter The function used to determine which bans will be removed from the caches.
|
|
103
94
|
* @returns {number} Amount of bans that were removed from the caches
|
|
104
95
|
*/
|
|
@@ -108,7 +99,6 @@ class Sweepers {
|
|
|
108
99
|
|
|
109
100
|
/**
|
|
110
101
|
* Sweeps all guild emojis and removes the ones which are indicated by the filter.
|
|
111
|
-
*
|
|
112
102
|
* @param {Function} filter The function used to determine which emojis will be removed from the caches.
|
|
113
103
|
* @returns {number} Amount of emojis that were removed from the caches
|
|
114
104
|
*/
|
|
@@ -118,7 +108,6 @@ class Sweepers {
|
|
|
118
108
|
|
|
119
109
|
/**
|
|
120
110
|
* Sweeps all client application entitlements and removes the ones which are indicated by the filter.
|
|
121
|
-
*
|
|
122
111
|
* @param {Function} filter The function used to determine which entitlements will be removed from the caches.
|
|
123
112
|
* @returns {number} Amount of entitlements that were removed from the caches
|
|
124
113
|
*/
|
|
@@ -136,7 +125,6 @@ class Sweepers {
|
|
|
136
125
|
|
|
137
126
|
/**
|
|
138
127
|
* Sweeps all guild invites and removes the ones which are indicated by the filter.
|
|
139
|
-
*
|
|
140
128
|
* @param {Function} filter The function used to determine which invites will be removed from the caches.
|
|
141
129
|
* @returns {number} Amount of invites that were removed from the caches
|
|
142
130
|
*/
|
|
@@ -147,7 +135,6 @@ class Sweepers {
|
|
|
147
135
|
/**
|
|
148
136
|
* Sweeps all guild members and removes the ones which are indicated by the filter.
|
|
149
137
|
* <info>It is highly recommended to keep the client guild member cached</info>
|
|
150
|
-
*
|
|
151
138
|
* @param {Function} filter The function used to determine which guild members will be removed from the caches.
|
|
152
139
|
* @returns {number} Amount of guild members that were removed from the caches
|
|
153
140
|
*/
|
|
@@ -157,7 +144,6 @@ class Sweepers {
|
|
|
157
144
|
|
|
158
145
|
/**
|
|
159
146
|
* Sweeps all text-based channels' messages and removes the ones which are indicated by the filter.
|
|
160
|
-
*
|
|
161
147
|
* @param {Function} filter The function used to determine which messages will be removed from the caches.
|
|
162
148
|
* @returns {number} Amount of messages that were removed from the caches
|
|
163
149
|
* @example
|
|
@@ -174,7 +160,6 @@ class Sweepers {
|
|
|
174
160
|
if (typeof filter !== 'function') {
|
|
175
161
|
throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'filter', 'function');
|
|
176
162
|
}
|
|
177
|
-
|
|
178
163
|
let channels = 0;
|
|
179
164
|
let messages = 0;
|
|
180
165
|
|
|
@@ -184,14 +169,12 @@ class Sweepers {
|
|
|
184
169
|
channels++;
|
|
185
170
|
messages += channel.messages.cache.sweep(filter);
|
|
186
171
|
}
|
|
187
|
-
|
|
188
172
|
this.client.emit(Events.CacheSweep, `Swept ${messages} messages in ${channels} text-based channels.`);
|
|
189
173
|
return messages;
|
|
190
174
|
}
|
|
191
175
|
|
|
192
176
|
/**
|
|
193
177
|
* Sweeps all presences and removes the ones which are indicated by the filter.
|
|
194
|
-
*
|
|
195
178
|
* @param {Function} filter The function used to determine which presences will be removed from the caches.
|
|
196
179
|
* @returns {number} Amount of presences that were removed from the caches
|
|
197
180
|
*/
|
|
@@ -201,7 +184,6 @@ class Sweepers {
|
|
|
201
184
|
|
|
202
185
|
/**
|
|
203
186
|
* Sweeps all message reactions and removes the ones which are indicated by the filter.
|
|
204
|
-
*
|
|
205
187
|
* @param {Function} filter The function used to determine which reactions will be removed from the caches.
|
|
206
188
|
* @returns {number} Amount of reactions that were removed from the caches
|
|
207
189
|
*/
|
|
@@ -209,7 +191,6 @@ class Sweepers {
|
|
|
209
191
|
if (typeof filter !== 'function') {
|
|
210
192
|
throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'filter', 'function');
|
|
211
193
|
}
|
|
212
|
-
|
|
213
194
|
let channels = 0;
|
|
214
195
|
let messages = 0;
|
|
215
196
|
let reactions = 0;
|
|
@@ -223,7 +204,6 @@ class Sweepers {
|
|
|
223
204
|
reactions += message.reactions.cache.sweep(filter);
|
|
224
205
|
}
|
|
225
206
|
}
|
|
226
|
-
|
|
227
207
|
this.client.emit(
|
|
228
208
|
Events.CacheSweep,
|
|
229
209
|
`Swept ${reactions} reactions on ${messages} messages in ${channels} text-based channels.`,
|
|
@@ -233,7 +213,6 @@ class Sweepers {
|
|
|
233
213
|
|
|
234
214
|
/**
|
|
235
215
|
* Sweeps all guild stage instances and removes the ones which are indicated by the filter.
|
|
236
|
-
*
|
|
237
216
|
* @param {Function} filter The function used to determine which stage instances will be removed from the caches.
|
|
238
217
|
* @returns {number} Amount of stage instances that were removed from the caches
|
|
239
218
|
*/
|
|
@@ -243,7 +222,6 @@ class Sweepers {
|
|
|
243
222
|
|
|
244
223
|
/**
|
|
245
224
|
* Sweeps all guild stickers and removes the ones which are indicated by the filter.
|
|
246
|
-
*
|
|
247
225
|
* @param {Function} filter The function used to determine which stickers will be removed from the caches.
|
|
248
226
|
* @returns {number} Amount of stickers that were removed from the caches
|
|
249
227
|
*/
|
|
@@ -254,7 +232,6 @@ class Sweepers {
|
|
|
254
232
|
/**
|
|
255
233
|
* Sweeps all thread members and removes the ones which are indicated by the filter.
|
|
256
234
|
* <info>It is highly recommended to keep the client thread member cached</info>
|
|
257
|
-
*
|
|
258
235
|
* @param {Function} filter The function used to determine which thread members will be removed from the caches.
|
|
259
236
|
* @returns {number} Amount of thread members that were removed from the caches
|
|
260
237
|
*/
|
|
@@ -270,14 +247,12 @@ class Sweepers {
|
|
|
270
247
|
threads++;
|
|
271
248
|
members += channel.members.cache.sweep(filter);
|
|
272
249
|
}
|
|
273
|
-
|
|
274
250
|
this.client.emit(Events.CacheSweep, `Swept ${members} thread members in ${threads} threads.`);
|
|
275
251
|
return members;
|
|
276
252
|
}
|
|
277
253
|
|
|
278
254
|
/**
|
|
279
255
|
* Sweeps all threads and removes the ones which are indicated by the filter.
|
|
280
|
-
*
|
|
281
256
|
* @param {Function} filter The function used to determine which threads will be removed from the caches.
|
|
282
257
|
* @returns {number} filter Amount of threads that were removed from the caches
|
|
283
258
|
* @example
|
|
@@ -303,14 +278,12 @@ class Sweepers {
|
|
|
303
278
|
this.client.channels._remove(key);
|
|
304
279
|
}
|
|
305
280
|
}
|
|
306
|
-
|
|
307
281
|
this.client.emit(Events.CacheSweep, `Swept ${threads} threads.`);
|
|
308
282
|
return threads;
|
|
309
283
|
}
|
|
310
284
|
|
|
311
285
|
/**
|
|
312
286
|
* Sweeps all users and removes the ones which are indicated by the filter.
|
|
313
|
-
*
|
|
314
287
|
* @param {Function} filter The function used to determine which users will be removed from the caches.
|
|
315
288
|
* @returns {number} Amount of users that were removed from the caches
|
|
316
289
|
*/
|
|
@@ -328,7 +301,6 @@ class Sweepers {
|
|
|
328
301
|
|
|
329
302
|
/**
|
|
330
303
|
* Sweeps all guild voice states and removes the ones which are indicated by the filter.
|
|
331
|
-
*
|
|
332
304
|
* @param {Function} filter The function used to determine which voice states will be removed from the caches.
|
|
333
305
|
* @returns {number} Amount of voice states that were removed from the caches
|
|
334
306
|
*/
|
|
@@ -338,7 +310,6 @@ class Sweepers {
|
|
|
338
310
|
|
|
339
311
|
/**
|
|
340
312
|
* Cancels all sweeping intervals
|
|
341
|
-
*
|
|
342
313
|
* @returns {void}
|
|
343
314
|
*/
|
|
344
315
|
destroy() {
|
|
@@ -349,7 +320,6 @@ class Sweepers {
|
|
|
349
320
|
|
|
350
321
|
/**
|
|
351
322
|
* Options for generating a filter function based on lifetime
|
|
352
|
-
*
|
|
353
323
|
* @typedef {Object} LifetimeFilterOptions
|
|
354
324
|
* @property {number} [lifetime=14400] How long, in seconds, an entry should stay in the collection
|
|
355
325
|
* before it is considered sweepable.
|
|
@@ -361,27 +331,23 @@ class Sweepers {
|
|
|
361
331
|
|
|
362
332
|
/**
|
|
363
333
|
* Create a sweepFilter function that uses a lifetime to determine sweepability.
|
|
364
|
-
*
|
|
365
334
|
* @param {LifetimeFilterOptions} [options={}] The options used to generate the filter function
|
|
366
335
|
* @returns {GlobalSweepFilter}
|
|
367
336
|
*/
|
|
368
337
|
static filterByLifetime({
|
|
369
|
-
lifetime =
|
|
370
|
-
getComparisonTimestamp =
|
|
338
|
+
lifetime = 14400,
|
|
339
|
+
getComparisonTimestamp = e => e?.createdTimestamp,
|
|
371
340
|
excludeFromSweep = () => false,
|
|
372
341
|
} = {}) {
|
|
373
342
|
if (typeof lifetime !== 'number') {
|
|
374
343
|
throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'lifetime', 'number');
|
|
375
344
|
}
|
|
376
|
-
|
|
377
345
|
if (typeof getComparisonTimestamp !== 'function') {
|
|
378
346
|
throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'getComparisonTimestamp', 'function');
|
|
379
347
|
}
|
|
380
|
-
|
|
381
348
|
if (typeof excludeFromSweep !== 'function') {
|
|
382
349
|
throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'excludeFromSweep', 'function');
|
|
383
350
|
}
|
|
384
|
-
|
|
385
351
|
return () => {
|
|
386
352
|
if (lifetime <= 0) return null;
|
|
387
353
|
const lifetimeMs = lifetime * 1_000;
|
|
@@ -390,7 +356,6 @@ class Sweepers {
|
|
|
390
356
|
if (excludeFromSweep(entry, key, coll)) {
|
|
391
357
|
return false;
|
|
392
358
|
}
|
|
393
|
-
|
|
394
359
|
const comparisonTimestamp = getComparisonTimestamp(entry, key, coll);
|
|
395
360
|
if (!comparisonTimestamp || typeof comparisonTimestamp !== 'number') return false;
|
|
396
361
|
return now - comparisonTimestamp > lifetimeMs;
|
|
@@ -400,47 +365,43 @@ class Sweepers {
|
|
|
400
365
|
|
|
401
366
|
/**
|
|
402
367
|
* Creates a sweep filter that sweeps archived threads
|
|
403
|
-
*
|
|
404
368
|
* @param {number} [lifetime=14400] How long a thread has to be archived to be valid for sweeping
|
|
405
369
|
* @returns {GlobalSweepFilter}
|
|
406
370
|
*/
|
|
407
|
-
static archivedThreadSweepFilter(lifetime =
|
|
371
|
+
static archivedThreadSweepFilter(lifetime = 14400) {
|
|
408
372
|
return this.filterByLifetime({
|
|
409
373
|
lifetime,
|
|
410
|
-
getComparisonTimestamp:
|
|
411
|
-
excludeFromSweep:
|
|
374
|
+
getComparisonTimestamp: e => e.archiveTimestamp,
|
|
375
|
+
excludeFromSweep: e => !e.archived,
|
|
412
376
|
});
|
|
413
377
|
}
|
|
414
378
|
|
|
415
379
|
/**
|
|
416
380
|
* Creates a sweep filter that sweeps expired invites
|
|
417
|
-
*
|
|
418
381
|
* @param {number} [lifetime=14400] How long ago an invite has to have expired to be valid for sweeping
|
|
419
382
|
* @returns {GlobalSweepFilter}
|
|
420
383
|
*/
|
|
421
|
-
static expiredInviteSweepFilter(lifetime =
|
|
384
|
+
static expiredInviteSweepFilter(lifetime = 14400) {
|
|
422
385
|
return this.filterByLifetime({
|
|
423
386
|
lifetime,
|
|
424
|
-
getComparisonTimestamp:
|
|
387
|
+
getComparisonTimestamp: i => i.expiresTimestamp,
|
|
425
388
|
});
|
|
426
389
|
}
|
|
427
390
|
|
|
428
391
|
/**
|
|
429
392
|
* Creates a sweep filter that sweeps outdated messages (edits taken into account)
|
|
430
|
-
*
|
|
431
393
|
* @param {number} [lifetime=3600] How long ago a message has to have been sent or edited to be valid for sweeping
|
|
432
394
|
* @returns {GlobalSweepFilter}
|
|
433
395
|
*/
|
|
434
|
-
static outdatedMessageSweepFilter(lifetime =
|
|
396
|
+
static outdatedMessageSweepFilter(lifetime = 3600) {
|
|
435
397
|
return this.filterByLifetime({
|
|
436
398
|
lifetime,
|
|
437
|
-
getComparisonTimestamp:
|
|
399
|
+
getComparisonTimestamp: m => m.editedTimestamp ?? m.createdTimestamp,
|
|
438
400
|
});
|
|
439
401
|
}
|
|
440
402
|
|
|
441
403
|
/**
|
|
442
404
|
* Configuration options for emitting the cache sweep client event
|
|
443
|
-
*
|
|
444
405
|
* @typedef {Object} SweepEventOptions
|
|
445
406
|
* @property {boolean} [emit=true] Whether to emit the client event in this method
|
|
446
407
|
* @property {string} [outputName] A name to output in the client event if it should differ from the key
|
|
@@ -449,7 +410,6 @@ class Sweepers {
|
|
|
449
410
|
|
|
450
411
|
/**
|
|
451
412
|
* Sweep a direct sub property of all guilds
|
|
452
|
-
*
|
|
453
413
|
* @param {string} key The name of the property
|
|
454
414
|
* @param {Function} filter Filter function passed to sweep
|
|
455
415
|
* @param {SweepEventOptions} [eventOptions={}] Options for the Client event emitted here
|
|
@@ -483,7 +443,6 @@ class Sweepers {
|
|
|
483
443
|
|
|
484
444
|
/**
|
|
485
445
|
* Validates a set of properties
|
|
486
|
-
*
|
|
487
446
|
* @param {string} key Key of the options object to check
|
|
488
447
|
* @private
|
|
489
448
|
*/
|
|
@@ -492,20 +451,16 @@ class Sweepers {
|
|
|
492
451
|
if (typeof props !== 'object') {
|
|
493
452
|
throw new DiscordjsTypeError(ErrorCodes.InvalidType, `sweepers.${key}`, 'object', true);
|
|
494
453
|
}
|
|
495
|
-
|
|
496
454
|
if (typeof props.interval !== 'number') {
|
|
497
455
|
throw new DiscordjsTypeError(ErrorCodes.InvalidType, `sweepers.${key}.interval`, 'number');
|
|
498
456
|
}
|
|
499
|
-
|
|
500
457
|
// Invites, Messages, and Threads can be provided a lifetime parameter, which we use to generate the filter
|
|
501
458
|
if (['invites', 'messages', 'threads'].includes(key) && !('filter' in props)) {
|
|
502
459
|
if (typeof props.lifetime !== 'number') {
|
|
503
460
|
throw new DiscordjsTypeError(ErrorCodes.InvalidType, `sweepers.${key}.lifetime`, 'number');
|
|
504
461
|
}
|
|
505
|
-
|
|
506
462
|
return;
|
|
507
463
|
}
|
|
508
|
-
|
|
509
464
|
if (typeof props.filter !== 'function') {
|
|
510
465
|
throw new DiscordjsTypeError(ErrorCodes.InvalidType, `sweepers.${key}.filter`, 'function');
|
|
511
466
|
}
|
|
@@ -513,7 +468,6 @@ class Sweepers {
|
|
|
513
468
|
|
|
514
469
|
/**
|
|
515
470
|
* Initialize an interval for sweeping
|
|
516
|
-
*
|
|
517
471
|
* @param {string} intervalKey The name of the property that stores the interval for this sweeper
|
|
518
472
|
* @param {string} sweepKey The name of the function that sweeps the desired caches
|
|
519
473
|
* @param {Object} opts Validated options for a sweep
|
|
@@ -530,4 +484,4 @@ class Sweepers {
|
|
|
530
484
|
}
|
|
531
485
|
}
|
|
532
486
|
|
|
533
|
-
exports
|
|
487
|
+
module.exports = Sweepers;
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
/* eslint-disable jsdoc/check-values */
|
|
2
1
|
'use strict';
|
|
3
2
|
|
|
4
3
|
const { GuildSystemChannelFlags } = require('discord-api-types/v10');
|
|
5
|
-
const
|
|
4
|
+
const BitField = require('./BitField');
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Data structure that makes it easy to interact with a {@link Guild#systemChannelFlags} bitfield.
|
|
9
8
|
* <info>Note that all event message types are enabled by default,
|
|
10
9
|
* and by setting their corresponding flags you are disabling them</info>
|
|
11
|
-
*
|
|
12
10
|
* @extends {BitField}
|
|
13
11
|
*/
|
|
14
12
|
class SystemChannelFlagsBitField extends BitField {
|
|
15
13
|
/**
|
|
16
14
|
* Numeric system channel flags.
|
|
17
|
-
*
|
|
18
15
|
* @type {GuildSystemChannelFlags}
|
|
19
16
|
* @memberof SystemChannelFlagsBitField
|
|
20
17
|
*/
|
|
@@ -30,19 +27,17 @@ class SystemChannelFlagsBitField extends BitField {
|
|
|
30
27
|
|
|
31
28
|
/**
|
|
32
29
|
* Bitfield of the packed bits
|
|
33
|
-
*
|
|
34
30
|
* @type {number}
|
|
35
31
|
* @name SystemChannelFlagsBitField#bitfield
|
|
36
32
|
*/
|
|
37
33
|
|
|
38
34
|
/**
|
|
39
35
|
* Data that can be resolved to give a system channel flag bitfield. This can be:
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
36
|
+
* * A string (see {@link SystemChannelFlagsBitField.Flags})
|
|
37
|
+
* * A system channel flag
|
|
38
|
+
* * An instance of SystemChannelFlagsBitField
|
|
39
|
+
* * An Array of SystemChannelFlagsResolvable
|
|
45
40
|
* @typedef {string|number|SystemChannelFlagsBitField|SystemChannelFlagsResolvable[]} SystemChannelFlagsResolvable
|
|
46
41
|
*/
|
|
47
42
|
|
|
48
|
-
exports
|
|
43
|
+
module.exports = SystemChannelFlagsBitField;
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
/* eslint-disable jsdoc/check-values */
|
|
2
1
|
'use strict';
|
|
3
2
|
|
|
4
3
|
const { ThreadMemberFlags } = require('discord-api-types/v10');
|
|
5
|
-
const
|
|
4
|
+
const BitField = require('./BitField');
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Data structure that makes it easy to interact with a {@link ThreadMember#flags} bitfield.
|
|
9
|
-
*
|
|
10
8
|
* @extends {BitField}
|
|
11
9
|
*/
|
|
12
10
|
class ThreadMemberFlagsBitField extends BitField {
|
|
13
11
|
/**
|
|
14
12
|
* Numeric thread member flags. There are currently no bitflags relevant to bots for this.
|
|
15
|
-
*
|
|
16
13
|
* @type {ThreadMemberFlags}
|
|
17
14
|
* @memberof ThreadMemberFlagsBitField
|
|
18
15
|
*/
|
|
@@ -28,9 +25,8 @@ class ThreadMemberFlagsBitField extends BitField {
|
|
|
28
25
|
|
|
29
26
|
/**
|
|
30
27
|
* Bitfield of the packed bits
|
|
31
|
-
*
|
|
32
28
|
* @type {number}
|
|
33
29
|
* @name ThreadMemberFlagsBitField#bitfield
|
|
34
30
|
*/
|
|
35
31
|
|
|
36
|
-
exports
|
|
32
|
+
module.exports = ThreadMemberFlagsBitField;
|
package/src/util/Transformers.js
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
const { isJSONEncodable } = require('@discordjs/util');
|
|
4
4
|
const snakeCase = require('lodash.snakecase');
|
|
5
|
-
const {
|
|
5
|
+
const { resolvePartialEmoji } = require('./Util');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Transforms camel-cased keys into snake cased keys
|
|
9
|
-
*
|
|
10
9
|
* @param {*} obj The object to transform
|
|
11
10
|
* @returns {*}
|
|
12
11
|
*/
|
|
@@ -15,12 +14,18 @@ function toSnakeCase(obj) {
|
|
|
15
14
|
if (obj instanceof Date) return obj;
|
|
16
15
|
if (isJSONEncodable(obj)) return toSnakeCase(obj.toJSON());
|
|
17
16
|
if (Array.isArray(obj)) return obj.map(toSnakeCase);
|
|
18
|
-
return Object.fromEntries(
|
|
17
|
+
return Object.fromEntries(
|
|
18
|
+
Object.entries(obj).map(([key, value]) => [
|
|
19
|
+
snakeCase(key),
|
|
20
|
+
// TODO: The special handling of 'emoji' is just a temporary fix for v14, will be dropped in v15.
|
|
21
|
+
// See https://github.com/discordjs/discord.js/issues/10909
|
|
22
|
+
key === 'emoji' && typeof value === 'string' ? resolvePartialEmoji(value) : toSnakeCase(value),
|
|
23
|
+
]),
|
|
24
|
+
);
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
/**
|
|
22
28
|
* Transforms an API auto moderation action object to a camel-cased variant.
|
|
23
|
-
*
|
|
24
29
|
* @param {APIAutoModerationAction} autoModerationAction The action to transform
|
|
25
30
|
* @returns {AutoModerationAction}
|
|
26
31
|
* @ignore
|
|
@@ -38,7 +43,6 @@ function _transformAPIAutoModerationAction(autoModerationAction) {
|
|
|
38
43
|
|
|
39
44
|
/**
|
|
40
45
|
* Transforms an API message interaction metadata object to a camel-cased variant.
|
|
41
|
-
*
|
|
42
46
|
* @param {Client} client The client
|
|
43
47
|
* @param {APIMessageInteractionMetadata} messageInteractionMetadata The metadata to transform
|
|
44
48
|
* @returns {MessageInteractionMetadata}
|
|
@@ -49,10 +53,7 @@ function _transformAPIMessageInteractionMetadata(client, messageInteractionMetad
|
|
|
49
53
|
id: messageInteractionMetadata.id,
|
|
50
54
|
type: messageInteractionMetadata.type,
|
|
51
55
|
user: client.users._add(messageInteractionMetadata.user),
|
|
52
|
-
authorizingIntegrationOwners:
|
|
53
|
-
client,
|
|
54
|
-
messageInteractionMetadata.authorizing_integration_owners,
|
|
55
|
-
),
|
|
56
|
+
authorizingIntegrationOwners: messageInteractionMetadata.authorizing_integration_owners,
|
|
56
57
|
originalResponseMessageId: messageInteractionMetadata.original_response_message_id ?? null,
|
|
57
58
|
interactedMessageId: messageInteractionMetadata.interacted_message_id ?? null,
|
|
58
59
|
triggeringInteractionMetadata: messageInteractionMetadata.triggering_interaction_metadata
|
|
@@ -63,7 +64,6 @@ function _transformAPIMessageInteractionMetadata(client, messageInteractionMetad
|
|
|
63
64
|
|
|
64
65
|
/**
|
|
65
66
|
* Transforms a guild scheduled event recurrence rule object to a snake-cased variant.
|
|
66
|
-
*
|
|
67
67
|
* @param {GuildScheduledEventRecurrenceRuleOptions} recurrenceRule The recurrence rule to transform
|
|
68
68
|
* @returns {APIGuildScheduledEventRecurrenceRule}
|
|
69
69
|
* @ignore
|
|
@@ -82,7 +82,6 @@ function _transformGuildScheduledEventRecurrenceRule(recurrenceRule) {
|
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
* Transforms API incidents data to a camel-cased variant.
|
|
85
|
-
*
|
|
86
85
|
* @param {APIIncidentsData} data The incidents data to transform
|
|
87
86
|
* @returns {IncidentActions}
|
|
88
87
|
* @ignore
|
|
@@ -116,9 +115,11 @@ function _transformCollectibles(collectibles) {
|
|
|
116
115
|
};
|
|
117
116
|
}
|
|
118
117
|
|
|
119
|
-
exports
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
118
|
+
module.exports = {
|
|
119
|
+
toSnakeCase,
|
|
120
|
+
_transformAPIAutoModerationAction,
|
|
121
|
+
_transformAPIMessageInteractionMetadata,
|
|
122
|
+
_transformGuildScheduledEventRecurrenceRule,
|
|
123
|
+
_transformAPIIncidentsData,
|
|
124
|
+
_transformCollectibles,
|
|
125
|
+
};
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
/* eslint-disable jsdoc/check-values */
|
|
2
1
|
'use strict';
|
|
3
2
|
|
|
4
3
|
const { UserFlags } = require('discord-api-types/v10');
|
|
5
|
-
const
|
|
4
|
+
const BitField = require('./BitField');
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Data structure that makes it easy to interact with a {@link User#flags} bitfield.
|
|
9
|
-
*
|
|
10
8
|
* @extends {BitField}
|
|
11
9
|
*/
|
|
12
10
|
class UserFlagsBitField extends BitField {
|
|
13
11
|
/**
|
|
14
12
|
* Numeric user flags.
|
|
15
|
-
*
|
|
16
13
|
* @type {UserFlags}
|
|
17
14
|
* @memberof UserFlagsBitField
|
|
18
15
|
*/
|
|
@@ -28,9 +25,8 @@ class UserFlagsBitField extends BitField {
|
|
|
28
25
|
|
|
29
26
|
/**
|
|
30
27
|
* Bitfield of the packed bits
|
|
31
|
-
*
|
|
32
28
|
* @type {number}
|
|
33
29
|
* @name UserFlagsBitField#bitfield
|
|
34
30
|
*/
|
|
35
31
|
|
|
36
|
-
exports
|
|
32
|
+
module.exports = UserFlagsBitField;
|