lolka.js 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +191 -0
- package/README.md +148 -0
- package/package.json +104 -0
- package/src/client/Client.js +943 -0
- package/src/client/actions/Action.js +151 -0
- package/src/client/actions/ActionsManager.js +75 -0
- package/src/client/actions/ChannelCreate.js +25 -0
- package/src/client/actions/ChannelDelete.js +24 -0
- package/src/client/actions/ChannelUpdate.js +42 -0
- package/src/client/actions/GuildChannelsPositionUpdate.js +21 -0
- package/src/client/actions/GuildEmojiCreate.js +21 -0
- package/src/client/actions/GuildEmojiDelete.js +20 -0
- package/src/client/actions/GuildEmojiUpdate.js +21 -0
- package/src/client/actions/GuildEmojisUpdate.js +34 -0
- package/src/client/actions/GuildMemberRemove.js +33 -0
- package/src/client/actions/GuildMemberUpdate.js +45 -0
- package/src/client/actions/GuildRoleCreate.js +27 -0
- package/src/client/actions/GuildRoleDelete.js +30 -0
- package/src/client/actions/GuildRolesPositionUpdate.js +21 -0
- package/src/client/actions/GuildScheduledEventDelete.js +32 -0
- package/src/client/actions/GuildScheduledEventUserAdd.js +33 -0
- package/src/client/actions/GuildScheduledEventUserRemove.js +33 -0
- package/src/client/actions/GuildSoundboardSoundDelete.js +30 -0
- package/src/client/actions/GuildStickerCreate.js +21 -0
- package/src/client/actions/GuildStickerDelete.js +20 -0
- package/src/client/actions/GuildStickerUpdate.js +21 -0
- package/src/client/actions/GuildStickersUpdate.js +34 -0
- package/src/client/actions/GuildUpdate.js +34 -0
- package/src/client/actions/InteractionCreate.js +110 -0
- package/src/client/actions/MessageCreate.js +43 -0
- package/src/client/actions/MessageDelete.js +33 -0
- package/src/client/actions/MessageDeleteBulk.js +49 -0
- package/src/client/actions/MessagePollVoteAdd.js +41 -0
- package/src/client/actions/MessagePollVoteRemove.js +39 -0
- package/src/client/actions/MessageReactionAdd.js +72 -0
- package/src/client/actions/MessageReactionRemove.js +51 -0
- package/src/client/actions/MessageReactionRemoveAll.js +34 -0
- package/src/client/actions/MessageReactionRemoveEmoji.js +29 -0
- package/src/client/actions/MessageUpdate.js +26 -0
- package/src/client/actions/StageInstanceCreate.js +29 -0
- package/src/client/actions/StageInstanceDelete.js +32 -0
- package/src/client/actions/StageInstanceUpdate.js +31 -0
- package/src/client/actions/ThreadCreate.js +26 -0
- package/src/client/actions/ThreadMembersUpdate.js +49 -0
- package/src/client/actions/TypingStart.js +30 -0
- package/src/client/actions/UserUpdate.js +37 -0
- package/src/client/voice/ClientVoiceManager.js +48 -0
- package/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.js +30 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_ACTION_EXECUTION.js +18 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_CREATE.js +19 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_DELETE.js +22 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_UPDATE.js +21 -0
- package/src/client/websocket/handlers/CHANNEL_CREATE.js +5 -0
- package/src/client/websocket/handlers/CHANNEL_DELETE.js +5 -0
- package/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.js +23 -0
- package/src/client/websocket/handlers/CHANNEL_UPDATE.js +17 -0
- package/src/client/websocket/handlers/ENTITLEMENT_CREATE.js +15 -0
- package/src/client/websocket/handlers/ENTITLEMENT_DELETE.js +19 -0
- package/src/client/websocket/handlers/ENTITLEMENT_UPDATE.js +17 -0
- package/src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.js +20 -0
- package/src/client/websocket/handlers/GUILD_BAN_ADD.js +16 -0
- package/src/client/websocket/handlers/GUILD_BAN_REMOVE.js +21 -0
- package/src/client/websocket/handlers/GUILD_CREATE.js +35 -0
- package/src/client/websocket/handlers/GUILD_DELETE.js +37 -0
- package/src/client/websocket/handlers/GUILD_EMOJIS_UPDATE.js +5 -0
- package/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.js +16 -0
- package/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.js +41 -0
- package/src/client/websocket/handlers/GUILD_MEMBER_ADD.js +18 -0
- package/src/client/websocket/handlers/GUILD_MEMBER_REMOVE.js +5 -0
- package/src/client/websocket/handlers/GUILD_MEMBER_UPDATE.js +5 -0
- package/src/client/websocket/handlers/GUILD_ROLE_CREATE.js +5 -0
- package/src/client/websocket/handlers/GUILD_ROLE_DELETE.js +5 -0
- package/src/client/websocket/handlers/GUILD_ROLE_UPDATE.js +22 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_CREATE.js +18 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_DELETE.js +5 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_UPDATE.js +20 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_ADD.js +5 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_REMOVE.js +5 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUNDS_UPDATE.js +25 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_CREATE.js +19 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_DELETE.js +5 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_UPDATE.js +21 -0
- package/src/client/websocket/handlers/GUILD_STICKERS_UPDATE.js +5 -0
- package/src/client/websocket/handlers/GUILD_UPDATE.js +5 -0
- package/src/client/websocket/handlers/INTERACTION_CREATE.js +5 -0
- package/src/client/websocket/handlers/INVITE_CREATE.js +21 -0
- package/src/client/websocket/handlers/INVITE_DELETE.js +24 -0
- package/src/client/websocket/handlers/MESSAGE_CREATE.js +5 -0
- package/src/client/websocket/handlers/MESSAGE_DELETE.js +5 -0
- package/src/client/websocket/handlers/MESSAGE_DELETE_BULK.js +5 -0
- package/src/client/websocket/handlers/MESSAGE_POLL_VOTE_ADD.js +5 -0
- package/src/client/websocket/handlers/MESSAGE_POLL_VOTE_REMOVE.js +5 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_ADD.js +5 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE.js +5 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_ALL.js +5 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_EMOJI.js +5 -0
- package/src/client/websocket/handlers/MESSAGE_UPDATE.js +17 -0
- package/src/client/websocket/handlers/PRESENCE_UPDATE.js +43 -0
- package/src/client/websocket/handlers/RATE_LIMITED.js +24 -0
- package/src/client/websocket/handlers/READY.js +30 -0
- package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.js +25 -0
- package/src/client/websocket/handlers/STAGE_INSTANCE_CREATE.js +5 -0
- package/src/client/websocket/handlers/STAGE_INSTANCE_DELETE.js +5 -0
- package/src/client/websocket/handlers/STAGE_INSTANCE_UPDATE.js +5 -0
- package/src/client/websocket/handlers/SUBSCRIPTION_CREATE.js +15 -0
- package/src/client/websocket/handlers/SUBSCRIPTION_DELETE.js +17 -0
- package/src/client/websocket/handlers/SUBSCRIPTION_UPDATE.js +17 -0
- package/src/client/websocket/handlers/THREAD_CREATE.js +5 -0
- package/src/client/websocket/handlers/THREAD_DELETE.js +18 -0
- package/src/client/websocket/handlers/THREAD_LIST_SYNC.js +52 -0
- package/src/client/websocket/handlers/THREAD_MEMBERS_UPDATE.js +5 -0
- package/src/client/websocket/handlers/THREAD_MEMBER_UPDATE.js +26 -0
- package/src/client/websocket/handlers/THREAD_UPDATE.js +17 -0
- package/src/client/websocket/handlers/TYPING_START.js +5 -0
- package/src/client/websocket/handlers/USER_UPDATE.js +5 -0
- package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.js +17 -0
- package/src/client/websocket/handlers/VOICE_SERVER_UPDATE.js +33 -0
- package/src/client/websocket/handlers/VOICE_STATE_UPDATE.js +38 -0
- package/src/client/websocket/handlers/WEBHOOKS_UPDATE.js +17 -0
- package/src/client/websocket/handlers/index.js +78 -0
- package/src/errors/DJSError.js +52 -0
- package/src/errors/ErrorCodes.js +280 -0
- package/src/errors/Messages.js +159 -0
- package/src/errors/index.js +7 -0
- package/src/index.js +261 -0
- package/src/managers/ApplicationCommandManager.js +305 -0
- package/src/managers/ApplicationCommandPermissionsManager.js +452 -0
- package/src/managers/ApplicationEmojiManager.js +152 -0
- package/src/managers/AutoModerationRuleManager.js +310 -0
- package/src/managers/BaseManager.js +21 -0
- package/src/managers/CachedManager.js +68 -0
- package/src/managers/CategoryChannelChildManager.js +85 -0
- package/src/managers/ChannelManager.js +197 -0
- package/src/managers/DMMessageManager.js +19 -0
- package/src/managers/DataManager.js +66 -0
- package/src/managers/EntitlementManager.js +185 -0
- package/src/managers/GuildApplicationCommandManager.js +31 -0
- package/src/managers/GuildBanManager.js +224 -0
- package/src/managers/GuildChannelManager.js +556 -0
- package/src/managers/GuildEmojiManager.js +264 -0
- package/src/managers/GuildEmojiRoleManager.js +136 -0
- package/src/managers/GuildForumThreadManager.js +88 -0
- package/src/managers/GuildInviteManager.js +239 -0
- package/src/managers/GuildManager.js +268 -0
- package/src/managers/GuildMemberManager.js +622 -0
- package/src/managers/GuildMemberRoleManager.js +232 -0
- package/src/managers/GuildMessageManager.js +35 -0
- package/src/managers/GuildScheduledEventManager.js +333 -0
- package/src/managers/GuildSoundboardSoundManager.js +226 -0
- package/src/managers/GuildStickerManager.js +195 -0
- package/src/managers/GuildTextThreadManager.js +95 -0
- package/src/managers/MessageManager.js +355 -0
- package/src/managers/PartialGroupDMMessageManager.js +19 -0
- package/src/managers/PermissionOverwriteManager.js +177 -0
- package/src/managers/PollAnswerVoterManager.js +62 -0
- package/src/managers/PresenceManager.js +63 -0
- package/src/managers/ReactionManager.js +75 -0
- package/src/managers/ReactionUserManager.js +85 -0
- package/src/managers/RoleManager.js +446 -0
- package/src/managers/StageInstanceManager.js +169 -0
- package/src/managers/SubscriptionManager.js +86 -0
- package/src/managers/ThreadManager.js +213 -0
- package/src/managers/ThreadMemberManager.js +197 -0
- package/src/managers/UserManager.js +149 -0
- package/src/managers/VoiceStateManager.js +64 -0
- package/src/sharding/Shard.js +506 -0
- package/src/sharding/ShardClientUtil.js +292 -0
- package/src/sharding/ShardingManager.js +390 -0
- package/src/structures/ActionRow.js +34 -0
- package/src/structures/ActivityInstance.js +52 -0
- package/src/structures/ActivityLocation.js +65 -0
- package/src/structures/AnnouncementChannel.js +29 -0
- package/src/structures/AnonymousGuild.js +107 -0
- package/src/structures/ApplicationCommand.js +657 -0
- package/src/structures/ApplicationEmoji.js +186 -0
- package/src/structures/ApplicationRoleConnectionMetadata.js +52 -0
- package/src/structures/Attachment.js +181 -0
- package/src/structures/AuthorizingIntegrationOwners.js +64 -0
- package/src/structures/AutoModerationActionExecution.js +131 -0
- package/src/structures/AutoModerationRule.js +317 -0
- package/src/structures/AutocompleteInteraction.js +112 -0
- package/src/structures/Base.js +45 -0
- package/src/structures/BaseChannel.js +188 -0
- package/src/structures/BaseGuild.js +134 -0
- package/src/structures/BaseGuildEmoji.js +111 -0
- package/src/structures/BaseGuildTextChannel.js +225 -0
- package/src/structures/BaseGuildVoiceChannel.js +265 -0
- package/src/structures/BaseInteraction.js +378 -0
- package/src/structures/BaseInvite.js +187 -0
- package/src/structures/BaseSelectMenuComponent.js +62 -0
- package/src/structures/ButtonComponent.js +72 -0
- package/src/structures/ButtonInteraction.js +12 -0
- package/src/structures/CategoryChannel.js +50 -0
- package/src/structures/ChannelSelectMenuComponent.js +22 -0
- package/src/structures/ChannelSelectMenuInteraction.js +36 -0
- package/src/structures/ChatInputCommandInteraction.js +45 -0
- package/src/structures/ClientApplication.js +463 -0
- package/src/structures/ClientPresence.js +89 -0
- package/src/structures/ClientUser.js +221 -0
- package/src/structures/CommandInteraction.js +188 -0
- package/src/structures/CommandInteractionOptionResolver.js +336 -0
- package/src/structures/Component.js +62 -0
- package/src/structures/ContainerComponent.js +66 -0
- package/src/structures/ContextMenuCommandInteraction.js +69 -0
- package/src/structures/DMChannel.js +162 -0
- package/src/structures/DirectoryChannel.js +40 -0
- package/src/structures/Embed.js +254 -0
- package/src/structures/Emoji.js +115 -0
- package/src/structures/Entitlement.js +199 -0
- package/src/structures/FileComponent.js +44 -0
- package/src/structures/ForumChannel.js +34 -0
- package/src/structures/GroupDMInvite.js +37 -0
- package/src/structures/Guild.js +1557 -0
- package/src/structures/GuildAuditLogs.js +97 -0
- package/src/structures/GuildAuditLogsEntry.js +552 -0
- package/src/structures/GuildBan.js +65 -0
- package/src/structures/GuildChannel.js +511 -0
- package/src/structures/GuildEmoji.js +160 -0
- package/src/structures/GuildInvite.js +223 -0
- package/src/structures/GuildMember.js +650 -0
- package/src/structures/GuildOnboarding.js +71 -0
- package/src/structures/GuildOnboardingPrompt.js +88 -0
- package/src/structures/GuildOnboardingPromptOption.js +96 -0
- package/src/structures/GuildPreview.js +213 -0
- package/src/structures/GuildPreviewEmoji.js +30 -0
- package/src/structures/GuildScheduledEvent.js +579 -0
- package/src/structures/GuildTemplate.js +221 -0
- package/src/structures/Integration.js +243 -0
- package/src/structures/IntegrationApplication.js +82 -0
- package/src/structures/InteractionCallback.js +83 -0
- package/src/structures/InteractionCallbackResource.js +57 -0
- package/src/structures/InteractionCallbackResponse.js +36 -0
- package/src/structures/InteractionCollector.js +256 -0
- package/src/structures/InteractionWebhook.js +67 -0
- package/src/structures/InviteGuild.js +24 -0
- package/src/structures/LabelComponent.js +54 -0
- package/src/structures/MediaChannel.js +12 -0
- package/src/structures/MediaGalleryComponent.js +34 -0
- package/src/structures/MediaGalleryItem.js +56 -0
- package/src/structures/MentionableSelectMenuComponent.js +12 -0
- package/src/structures/MentionableSelectMenuInteraction.js +76 -0
- package/src/structures/Message.js +1203 -0
- package/src/structures/MessageCollector.js +157 -0
- package/src/structures/MessageComponentInteraction.js +128 -0
- package/src/structures/MessageContextMenuCommandInteraction.js +22 -0
- package/src/structures/MessageMentions.js +323 -0
- package/src/structures/MessagePayload.js +346 -0
- package/src/structures/MessageReaction.js +214 -0
- package/src/structures/ModalComponentResolver.js +269 -0
- package/src/structures/ModalSubmitInteraction.js +274 -0
- package/src/structures/OAuth2Guild.js +31 -0
- package/src/structures/PartialGroupDMChannel.js +146 -0
- package/src/structures/PermissionOverwrites.js +221 -0
- package/src/structures/Poll.js +190 -0
- package/src/structures/PollAnswer.js +98 -0
- package/src/structures/Presence.js +429 -0
- package/src/structures/PrimaryEntryPointCommandInteraction.js +12 -0
- package/src/structures/ReactionCollector.js +246 -0
- package/src/structures/ReactionEmoji.js +33 -0
- package/src/structures/Role.js +539 -0
- package/src/structures/RoleSelectMenuComponent.js +12 -0
- package/src/structures/RoleSelectMenuInteraction.js +36 -0
- package/src/structures/SKU.js +59 -0
- package/src/structures/SectionComponent.js +46 -0
- package/src/structures/SeparatorComponent.js +33 -0
- package/src/structures/SoundboardSound.js +220 -0
- package/src/structures/StageChannel.js +121 -0
- package/src/structures/StageInstance.js +170 -0
- package/src/structures/Sticker.js +292 -0
- package/src/structures/StickerPack.js +107 -0
- package/src/structures/StringSelectMenuComponent.js +22 -0
- package/src/structures/StringSelectMenuInteraction.js +23 -0
- package/src/structures/Subscription.js +131 -0
- package/src/structures/Team.js +129 -0
- package/src/structures/TeamMember.js +77 -0
- package/src/structures/TextChannel.js +36 -0
- package/src/structures/TextDisplayComponent.js +22 -0
- package/src/structures/TextInputComponent.js +32 -0
- package/src/structures/ThreadChannel.js +662 -0
- package/src/structures/ThreadMember.js +124 -0
- package/src/structures/ThreadOnlyChannel.js +270 -0
- package/src/structures/ThumbnailComponent.js +54 -0
- package/src/structures/Typing.js +82 -0
- package/src/structures/UnfurledMediaItem.js +36 -0
- package/src/structures/User.js +505 -0
- package/src/structures/UserContextMenuCommandInteraction.js +32 -0
- package/src/structures/UserSelectMenuComponent.js +12 -0
- package/src/structures/UserSelectMenuInteraction.js +55 -0
- package/src/structures/VoiceChannel.js +123 -0
- package/src/structures/VoiceChannelEffect.js +88 -0
- package/src/structures/VoiceRegion.js +51 -0
- package/src/structures/VoiceState.js +338 -0
- package/src/structures/Webhook.js +520 -0
- package/src/structures/WelcomeChannel.js +67 -0
- package/src/structures/WelcomeScreen.js +54 -0
- package/src/structures/Widget.js +107 -0
- package/src/structures/WidgetMember.js +114 -0
- package/src/structures/interfaces/Application.js +173 -0
- package/src/structures/interfaces/Collector.js +368 -0
- package/src/structures/interfaces/InteractionResponses.js +385 -0
- package/src/structures/interfaces/TextBasedChannel.js +431 -0
- package/src/util/APITypes.js +700 -0
- package/src/util/ActivityFlagsBitField.js +29 -0
- package/src/util/ApplicationFlagsBitField.js +46 -0
- package/src/util/AttachmentFlagsBitField.js +29 -0
- package/src/util/BitField.js +197 -0
- package/src/util/ChannelFlagsBitField.js +46 -0
- package/src/util/Channels.js +173 -0
- package/src/util/Colors.js +73 -0
- package/src/util/Components.js +329 -0
- package/src/util/Constants.js +253 -0
- package/src/util/DataResolver.js +161 -0
- package/src/util/Enums.js +14 -0
- package/src/util/Events.js +179 -0
- package/src/util/GuildMemberFlagsBitField.js +46 -0
- package/src/util/IntentsBitField.js +38 -0
- package/src/util/InviteFlagsBitField.js +29 -0
- package/src/util/Invites.js +31 -0
- package/src/util/LimitedCollection.js +75 -0
- package/src/util/LolkaSnowflake.js +47 -0
- package/src/util/MessageFlagsBitField.js +46 -0
- package/src/util/Options.js +221 -0
- package/src/util/Partials.js +51 -0
- package/src/util/PermissionsBitField.js +117 -0
- package/src/util/RoleFlagsBitField.js +29 -0
- package/src/util/SKUFlagsBitField.js +29 -0
- package/src/util/ShardEvents.js +27 -0
- package/src/util/Status.js +17 -0
- package/src/util/Sweepers.js +533 -0
- package/src/util/Symbols.js +3 -0
- package/src/util/SystemChannelFlagsBitField.js +48 -0
- package/src/util/ThreadMemberFlagsBitField.js +36 -0
- package/src/util/Transformers.js +124 -0
- package/src/util/UserFlagsBitField.js +36 -0
- package/src/util/Util.js +609 -0
- package/typings/index.d.mts +7512 -0
- package/typings/index.d.ts +7512 -0
package/src/index.js
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { __exportStar } = require('tslib');
|
|
4
|
+
|
|
5
|
+
// "Root" classes (starting points)
|
|
6
|
+
exports.Client = require('./client/Client.js').Client;
|
|
7
|
+
exports.Shard = require('./sharding/Shard.js').Shard;
|
|
8
|
+
exports.ShardClientUtil = require('./sharding/ShardClientUtil.js').ShardClientUtil;
|
|
9
|
+
exports.ShardingManager = require('./sharding/ShardingManager.js').ShardingManager;
|
|
10
|
+
|
|
11
|
+
// Errors
|
|
12
|
+
exports.DiscordjsError = require('./errors/DJSError.js').DiscordjsError;
|
|
13
|
+
exports.DiscordjsTypeError = require('./errors/DJSError.js').DiscordjsTypeError;
|
|
14
|
+
exports.DiscordjsRangeError = require('./errors/DJSError.js').DiscordjsRangeError;
|
|
15
|
+
exports.DiscordjsErrorCodes = require('./errors/ErrorCodes.js').ErrorCodes;
|
|
16
|
+
|
|
17
|
+
// Utilities
|
|
18
|
+
exports.ActivityFlagsBitField = require('./util/ActivityFlagsBitField.js').ActivityFlagsBitField;
|
|
19
|
+
exports.ApplicationFlagsBitField = require('./util/ApplicationFlagsBitField.js').ApplicationFlagsBitField;
|
|
20
|
+
exports.AttachmentFlagsBitField = require('./util/AttachmentFlagsBitField.js').AttachmentFlagsBitField;
|
|
21
|
+
exports.BaseManager = require('./managers/BaseManager.js').BaseManager;
|
|
22
|
+
exports.BitField = require('./util/BitField.js').BitField;
|
|
23
|
+
exports.ChannelFlagsBitField = require('./util/ChannelFlagsBitField.js').ChannelFlagsBitField;
|
|
24
|
+
exports.Collection = require('@discordjs/collection').Collection;
|
|
25
|
+
exports.Colors = require('./util/Colors.js').Colors;
|
|
26
|
+
exports.Constants = require('./util/Constants.js');
|
|
27
|
+
exports.Events = require('./util/Events.js').Events;
|
|
28
|
+
exports.GuildMemberFlagsBitField = require('./util/GuildMemberFlagsBitField.js').GuildMemberFlagsBitField;
|
|
29
|
+
exports.IntentsBitField = require('./util/IntentsBitField.js').IntentsBitField;
|
|
30
|
+
exports.InviteFlagsBitField = require('./util/InviteFlagsBitField.js').InviteFlagsBitField;
|
|
31
|
+
exports.LimitedCollection = require('./util/LimitedCollection.js').LimitedCollection;
|
|
32
|
+
exports.MessageFlagsBitField = require('./util/MessageFlagsBitField.js').MessageFlagsBitField;
|
|
33
|
+
exports.Options = require('./util/Options.js').Options;
|
|
34
|
+
exports.Partials = require('./util/Partials.js').Partials;
|
|
35
|
+
exports.PermissionsBitField = require('./util/PermissionsBitField.js').PermissionsBitField;
|
|
36
|
+
exports.RoleFlagsBitField = require('./util/RoleFlagsBitField.js').RoleFlagsBitField;
|
|
37
|
+
exports.ShardEvents = require('./util/ShardEvents.js').ShardEvents;
|
|
38
|
+
exports.SKUFlagsBitField = require('./util/SKUFlagsBitField.js').SKUFlagsBitField;
|
|
39
|
+
exports.SnowflakeUtil = require('./util/LolkaSnowflake').DiscordSnowflake;
|
|
40
|
+
exports.Status = require('./util/Status.js').Status;
|
|
41
|
+
exports.Sweepers = require('./util/Sweepers.js').Sweepers;
|
|
42
|
+
exports.SystemChannelFlagsBitField = require('./util/SystemChannelFlagsBitField.js').SystemChannelFlagsBitField;
|
|
43
|
+
exports.ThreadMemberFlagsBitField = require('./util/ThreadMemberFlagsBitField.js').ThreadMemberFlagsBitField;
|
|
44
|
+
exports.UserFlagsBitField = require('./util/UserFlagsBitField.js').UserFlagsBitField;
|
|
45
|
+
|
|
46
|
+
__exportStar(require('./util/DataResolver.js'), exports);
|
|
47
|
+
|
|
48
|
+
exports.cleanCodeBlockContent = require('./util/Util.js').cleanCodeBlockContent;
|
|
49
|
+
exports.cleanContent = require('./util/Util.js').cleanContent;
|
|
50
|
+
exports.discordSort = require('./util/Util.js').discordSort;
|
|
51
|
+
exports.fetchRecommendedShardCount = require('./util/Util.js').fetchRecommendedShardCount;
|
|
52
|
+
exports.flatten = require('./util/Util.js').flatten;
|
|
53
|
+
exports.parseEmoji = require('./util/Util.js').parseEmoji;
|
|
54
|
+
exports.parseWebhookURL = require('./util/Util.js').parseWebhookURL;
|
|
55
|
+
exports.resolveColor = require('./util/Util.js').resolveColor;
|
|
56
|
+
exports.resolveSKUId = require('./util/Util.js').resolveSKUId;
|
|
57
|
+
exports.verifyString = require('./util/Util.js').verifyString;
|
|
58
|
+
|
|
59
|
+
exports.version = require('../package.json').version;
|
|
60
|
+
|
|
61
|
+
// Managers
|
|
62
|
+
exports.ApplicationCommandManager = require('./managers/ApplicationCommandManager.js').ApplicationCommandManager;
|
|
63
|
+
exports.ApplicationCommandPermissionsManager =
|
|
64
|
+
require('./managers/ApplicationCommandPermissionsManager.js').ApplicationCommandPermissionsManager;
|
|
65
|
+
exports.ApplicationEmojiManager = require('./managers/ApplicationEmojiManager.js').ApplicationEmojiManager;
|
|
66
|
+
exports.AutoModerationRuleManager = require('./managers/AutoModerationRuleManager.js').AutoModerationRuleManager;
|
|
67
|
+
exports.CachedManager = require('./managers/CachedManager.js').CachedManager;
|
|
68
|
+
exports.ChannelManager = require('./managers/ChannelManager.js').ChannelManager;
|
|
69
|
+
exports.ClientVoiceManager = require('./client/voice/ClientVoiceManager.js').ClientVoiceManager;
|
|
70
|
+
exports.DataManager = require('./managers/DataManager.js').DataManager;
|
|
71
|
+
exports.DMMessageManager = require('./managers/DMMessageManager.js').DMMessageManager;
|
|
72
|
+
exports.EntitlementManager = require('./managers/EntitlementManager.js').EntitlementManager;
|
|
73
|
+
exports.GuildApplicationCommandManager =
|
|
74
|
+
require('./managers/GuildApplicationCommandManager.js').GuildApplicationCommandManager;
|
|
75
|
+
exports.GuildBanManager = require('./managers/GuildBanManager.js').GuildBanManager;
|
|
76
|
+
exports.GuildChannelManager = require('./managers/GuildChannelManager.js').GuildChannelManager;
|
|
77
|
+
exports.GuildEmojiManager = require('./managers/GuildEmojiManager.js').GuildEmojiManager;
|
|
78
|
+
exports.GuildEmojiRoleManager = require('./managers/GuildEmojiRoleManager.js').GuildEmojiRoleManager;
|
|
79
|
+
exports.GuildForumThreadManager = require('./managers/GuildForumThreadManager.js').GuildForumThreadManager;
|
|
80
|
+
exports.GuildInviteManager = require('./managers/GuildInviteManager.js').GuildInviteManager;
|
|
81
|
+
exports.GuildManager = require('./managers/GuildManager.js').GuildManager;
|
|
82
|
+
exports.GuildMemberManager = require('./managers/GuildMemberManager.js').GuildMemberManager;
|
|
83
|
+
exports.GuildMemberRoleManager = require('./managers/GuildMemberRoleManager.js').GuildMemberRoleManager;
|
|
84
|
+
exports.GuildMessageManager = require('./managers/GuildMessageManager.js').GuildMessageManager;
|
|
85
|
+
exports.GuildScheduledEventManager = require('./managers/GuildScheduledEventManager.js').GuildScheduledEventManager;
|
|
86
|
+
exports.GuildSoundboardSoundManager = require('./managers/GuildSoundboardSoundManager.js').GuildSoundboardSoundManager;
|
|
87
|
+
exports.GuildStickerManager = require('./managers/GuildStickerManager.js').GuildStickerManager;
|
|
88
|
+
exports.GuildTextThreadManager = require('./managers/GuildTextThreadManager.js').GuildTextThreadManager;
|
|
89
|
+
exports.MessageManager = require('./managers/MessageManager.js').MessageManager;
|
|
90
|
+
exports.PermissionOverwriteManager = require('./managers/PermissionOverwriteManager.js').PermissionOverwriteManager;
|
|
91
|
+
exports.PollAnswerVoterManager = require('./managers/PollAnswerVoterManager.js').PollAnswerVoterManager;
|
|
92
|
+
exports.PresenceManager = require('./managers/PresenceManager.js').PresenceManager;
|
|
93
|
+
exports.ReactionManager = require('./managers/ReactionManager.js').ReactionManager;
|
|
94
|
+
exports.ReactionUserManager = require('./managers/ReactionUserManager.js').ReactionUserManager;
|
|
95
|
+
exports.RoleManager = require('./managers/RoleManager.js').RoleManager;
|
|
96
|
+
exports.StageInstanceManager = require('./managers/StageInstanceManager.js').StageInstanceManager;
|
|
97
|
+
exports.SubscriptionManager = require('./managers/SubscriptionManager.js').SubscriptionManager;
|
|
98
|
+
exports.ThreadManager = require('./managers/ThreadManager.js').ThreadManager;
|
|
99
|
+
exports.ThreadMemberManager = require('./managers/ThreadMemberManager.js').ThreadMemberManager;
|
|
100
|
+
exports.UserManager = require('./managers/UserManager.js').UserManager;
|
|
101
|
+
exports.VoiceStateManager = require('./managers/VoiceStateManager.js').VoiceStateManager;
|
|
102
|
+
|
|
103
|
+
// Structures
|
|
104
|
+
exports.ActionRow = require('./structures/ActionRow.js').ActionRow;
|
|
105
|
+
exports.Activity = require('./structures/Presence.js').Activity;
|
|
106
|
+
exports.ActivityInstance = require('./structures/ActivityInstance.js').ActivityInstance;
|
|
107
|
+
exports.ActivityLocation = require('./structures/ActivityLocation.js').ActivityLocation;
|
|
108
|
+
exports.AnnouncementChannel = require('./structures/AnnouncementChannel.js').AnnouncementChannel;
|
|
109
|
+
exports.AnonymousGuild = require('./structures/AnonymousGuild.js').AnonymousGuild;
|
|
110
|
+
exports.AuthorizingIntegrationOwners =
|
|
111
|
+
require('./structures/AuthorizingIntegrationOwners.js').AuthorizingIntegrationOwners;
|
|
112
|
+
exports.Application = require('./structures/interfaces/Application.js').Application;
|
|
113
|
+
exports.ApplicationCommand = require('./structures/ApplicationCommand.js').ApplicationCommand;
|
|
114
|
+
exports.ApplicationEmoji = require('./structures/ApplicationEmoji.js').ApplicationEmoji;
|
|
115
|
+
exports.ApplicationRoleConnectionMetadata =
|
|
116
|
+
require('./structures/ApplicationRoleConnectionMetadata.js').ApplicationRoleConnectionMetadata;
|
|
117
|
+
exports.Attachment = require('./structures/Attachment.js').Attachment;
|
|
118
|
+
exports.AutocompleteInteraction = require('./structures/AutocompleteInteraction.js').AutocompleteInteraction;
|
|
119
|
+
exports.AutoModerationActionExecution =
|
|
120
|
+
require('./structures/AutoModerationActionExecution.js').AutoModerationActionExecution;
|
|
121
|
+
exports.AutoModerationRule = require('./structures/AutoModerationRule.js').AutoModerationRule;
|
|
122
|
+
exports.Base = require('./structures/Base.js').Base;
|
|
123
|
+
exports.BaseChannel = require('./structures/BaseChannel.js').BaseChannel;
|
|
124
|
+
exports.BaseGuild = require('./structures/BaseGuild.js').BaseGuild;
|
|
125
|
+
exports.BaseGuildEmoji = require('./structures/BaseGuildEmoji.js').BaseGuildEmoji;
|
|
126
|
+
exports.BaseGuildTextChannel = require('./structures/BaseGuildTextChannel.js').BaseGuildTextChannel;
|
|
127
|
+
exports.BaseGuildVoiceChannel = require('./structures/BaseGuildVoiceChannel.js').BaseGuildVoiceChannel;
|
|
128
|
+
exports.BaseInteraction = require('./structures/BaseInteraction.js').BaseInteraction;
|
|
129
|
+
exports.BaseInvite = require('./structures/BaseInvite.js').BaseInvite;
|
|
130
|
+
exports.BaseSelectMenuComponent = require('./structures/BaseSelectMenuComponent.js').BaseSelectMenuComponent;
|
|
131
|
+
exports.ButtonComponent = require('./structures/ButtonComponent.js').ButtonComponent;
|
|
132
|
+
exports.ButtonInteraction = require('./structures/ButtonInteraction.js').ButtonInteraction;
|
|
133
|
+
exports.CategoryChannel = require('./structures/CategoryChannel.js').CategoryChannel;
|
|
134
|
+
exports.ChannelSelectMenuComponent = require('./structures/ChannelSelectMenuComponent.js').ChannelSelectMenuComponent;
|
|
135
|
+
exports.ChannelSelectMenuInteraction =
|
|
136
|
+
require('./structures/ChannelSelectMenuInteraction.js').ChannelSelectMenuInteraction;
|
|
137
|
+
exports.ChatInputCommandInteraction =
|
|
138
|
+
require('./structures/ChatInputCommandInteraction.js').ChatInputCommandInteraction;
|
|
139
|
+
exports.ClientApplication = require('./structures/ClientApplication.js').ClientApplication;
|
|
140
|
+
exports.ClientPresence = require('./structures/ClientPresence.js').ClientPresence;
|
|
141
|
+
exports.ClientUser = require('./structures/ClientUser.js').ClientUser;
|
|
142
|
+
exports.Collector = require('./structures/interfaces/Collector.js').Collector;
|
|
143
|
+
exports.CommandInteraction = require('./structures/CommandInteraction.js').CommandInteraction;
|
|
144
|
+
exports.CommandInteractionOptionResolver =
|
|
145
|
+
require('./structures/CommandInteractionOptionResolver.js').CommandInteractionOptionResolver;
|
|
146
|
+
exports.Component = require('./structures/Component.js').Component;
|
|
147
|
+
exports.ContainerComponent = require('./structures/ContainerComponent.js').ContainerComponent;
|
|
148
|
+
exports.ContextMenuCommandInteraction =
|
|
149
|
+
require('./structures/ContextMenuCommandInteraction.js').ContextMenuCommandInteraction;
|
|
150
|
+
exports.DirectoryChannel = require('./structures/DirectoryChannel.js').DirectoryChannel;
|
|
151
|
+
exports.DMChannel = require('./structures/DMChannel.js').DMChannel;
|
|
152
|
+
exports.Embed = require('./structures/Embed.js').Embed;
|
|
153
|
+
exports.Emoji = require('./structures/Emoji.js').Emoji;
|
|
154
|
+
exports.Entitlement = require('./structures/Entitlement.js').Entitlement;
|
|
155
|
+
exports.FileComponent = require('./structures/FileComponent.js').FileComponent;
|
|
156
|
+
exports.ForumChannel = require('./structures/ForumChannel.js').ForumChannel;
|
|
157
|
+
exports.GroupDMInvite = require('./structures/GroupDMInvite.js').GroupDMInvite;
|
|
158
|
+
exports.Guild = require('./structures/Guild.js').Guild;
|
|
159
|
+
exports.GuildAuditLogs = require('./structures/GuildAuditLogs.js').GuildAuditLogs;
|
|
160
|
+
exports.GuildAuditLogsEntry = require('./structures/GuildAuditLogsEntry.js').GuildAuditLogsEntry;
|
|
161
|
+
exports.GuildBan = require('./structures/GuildBan.js').GuildBan;
|
|
162
|
+
exports.GuildChannel = require('./structures/GuildChannel.js').GuildChannel;
|
|
163
|
+
exports.GuildEmoji = require('./structures/GuildEmoji.js').GuildEmoji;
|
|
164
|
+
exports.GuildInvite = require('./structures/GuildInvite.js').GuildInvite;
|
|
165
|
+
exports.GuildMember = require('./structures/GuildMember.js').GuildMember;
|
|
166
|
+
exports.GuildOnboarding = require('./structures/GuildOnboarding.js').GuildOnboarding;
|
|
167
|
+
exports.GuildOnboardingPrompt = require('./structures/GuildOnboardingPrompt.js').GuildOnboardingPrompt;
|
|
168
|
+
exports.GuildOnboardingPromptOption =
|
|
169
|
+
require('./structures/GuildOnboardingPromptOption.js').GuildOnboardingPromptOption;
|
|
170
|
+
exports.GuildPreview = require('./structures/GuildPreview.js').GuildPreview;
|
|
171
|
+
exports.GuildPreviewEmoji = require('./structures/GuildPreviewEmoji.js').GuildPreviewEmoji;
|
|
172
|
+
exports.GuildScheduledEvent = require('./structures/GuildScheduledEvent.js').GuildScheduledEvent;
|
|
173
|
+
exports.GuildTemplate = require('./structures/GuildTemplate.js').GuildTemplate;
|
|
174
|
+
exports.Integration = require('./structures/Integration.js').Integration;
|
|
175
|
+
exports.IntegrationApplication = require('./structures/IntegrationApplication.js').IntegrationApplication;
|
|
176
|
+
exports.InteractionCallback = require('./structures/InteractionCallback.js').InteractionCallback;
|
|
177
|
+
exports.InteractionCallbackResource =
|
|
178
|
+
require('./structures/InteractionCallbackResource.js').InteractionCallbackResource;
|
|
179
|
+
exports.InteractionCallbackResponse =
|
|
180
|
+
require('./structures/InteractionCallbackResponse.js').InteractionCallbackResponse;
|
|
181
|
+
exports.InteractionCollector = require('./structures/InteractionCollector.js').InteractionCollector;
|
|
182
|
+
exports.InteractionWebhook = require('./structures/InteractionWebhook.js').InteractionWebhook;
|
|
183
|
+
exports.InviteGuild = require('./structures/InviteGuild.js').InviteGuild;
|
|
184
|
+
exports.LabelComponent = require('./structures/LabelComponent.js').LabelComponent;
|
|
185
|
+
exports.MediaChannel = require('./structures/MediaChannel.js').MediaChannel;
|
|
186
|
+
exports.MediaGalleryComponent = require('./structures/MediaGalleryComponent.js').MediaGalleryComponent;
|
|
187
|
+
exports.MediaGalleryItem = require('./structures/MediaGalleryItem.js').MediaGalleryItem;
|
|
188
|
+
exports.MentionableSelectMenuComponent =
|
|
189
|
+
require('./structures/MentionableSelectMenuComponent.js').MentionableSelectMenuComponent;
|
|
190
|
+
exports.MentionableSelectMenuInteraction =
|
|
191
|
+
require('./structures/MentionableSelectMenuInteraction.js').MentionableSelectMenuInteraction;
|
|
192
|
+
exports.MentionableSelectMenuInteraction =
|
|
193
|
+
require('./structures/MentionableSelectMenuInteraction.js').MentionableSelectMenuInteraction;
|
|
194
|
+
exports.Message = require('./structures/Message.js').Message;
|
|
195
|
+
exports.MessageCollector = require('./structures/MessageCollector.js').MessageCollector;
|
|
196
|
+
exports.MessageComponentInteraction =
|
|
197
|
+
require('./structures/MessageComponentInteraction.js').MessageComponentInteraction;
|
|
198
|
+
exports.MessageContextMenuCommandInteraction =
|
|
199
|
+
require('./structures/MessageContextMenuCommandInteraction.js').MessageContextMenuCommandInteraction;
|
|
200
|
+
exports.MessageMentions = require('./structures/MessageMentions.js').MessageMentions;
|
|
201
|
+
exports.MessagePayload = require('./structures/MessagePayload.js').MessagePayload;
|
|
202
|
+
exports.MessageReaction = require('./structures/MessageReaction.js').MessageReaction;
|
|
203
|
+
exports.ModalComponentResolver = require('./structures/ModalComponentResolver.js').ModalComponentResolver;
|
|
204
|
+
exports.ModalSubmitInteraction = require('./structures/ModalSubmitInteraction.js').ModalSubmitInteraction;
|
|
205
|
+
exports.OAuth2Guild = require('./structures/OAuth2Guild.js').OAuth2Guild;
|
|
206
|
+
exports.PartialGroupDMChannel = require('./structures/PartialGroupDMChannel.js').PartialGroupDMChannel;
|
|
207
|
+
exports.PermissionOverwrites = require('./structures/PermissionOverwrites.js').PermissionOverwrites;
|
|
208
|
+
exports.Poll = require('./structures/Poll.js').Poll;
|
|
209
|
+
exports.PollAnswer = require('./structures/PollAnswer.js').PollAnswer;
|
|
210
|
+
exports.PrimaryEntryPointCommandInteraction =
|
|
211
|
+
require('./structures/PrimaryEntryPointCommandInteraction.js').PrimaryEntryPointCommandInteraction;
|
|
212
|
+
exports.Presence = require('./structures/Presence.js').Presence;
|
|
213
|
+
exports.ReactionCollector = require('./structures/ReactionCollector.js').ReactionCollector;
|
|
214
|
+
exports.ReactionEmoji = require('./structures/ReactionEmoji.js').ReactionEmoji;
|
|
215
|
+
exports.RichPresenceAssets = require('./structures/Presence.js').RichPresenceAssets;
|
|
216
|
+
exports.Role = require('./structures/Role.js').Role;
|
|
217
|
+
exports.RoleSelectMenuComponent = require('./structures/RoleSelectMenuComponent.js').RoleSelectMenuComponent;
|
|
218
|
+
exports.RoleSelectMenuInteraction = require('./structures/RoleSelectMenuInteraction.js').RoleSelectMenuInteraction;
|
|
219
|
+
exports.SectionComponent = require('./structures/SectionComponent.js').SectionComponent;
|
|
220
|
+
exports.SeparatorComponent = require('./structures/SeparatorComponent.js').SeparatorComponent;
|
|
221
|
+
exports.SKU = require('./structures/SKU.js').SKU;
|
|
222
|
+
exports.SoundboardSound = require('./structures/SoundboardSound.js').SoundboardSound;
|
|
223
|
+
exports.StageChannel = require('./structures/StageChannel.js').StageChannel;
|
|
224
|
+
exports.StageInstance = require('./structures/StageInstance.js').StageInstance;
|
|
225
|
+
exports.Sticker = require('./structures/Sticker.js').Sticker;
|
|
226
|
+
exports.StickerPack = require('./structures/StickerPack.js').StickerPack;
|
|
227
|
+
exports.StringSelectMenuComponent = require('./structures/StringSelectMenuComponent.js').StringSelectMenuComponent;
|
|
228
|
+
exports.StringSelectMenuInteraction =
|
|
229
|
+
require('./structures/StringSelectMenuInteraction.js').StringSelectMenuInteraction;
|
|
230
|
+
exports.Subscription = require('./structures/Subscription.js').Subscription;
|
|
231
|
+
exports.Team = require('./structures/Team.js').Team;
|
|
232
|
+
exports.TeamMember = require('./structures/TeamMember.js').TeamMember;
|
|
233
|
+
exports.TextChannel = require('./structures/TextChannel.js').TextChannel;
|
|
234
|
+
exports.TextDisplayComponent = require('./structures/TextDisplayComponent.js').TextDisplayComponent;
|
|
235
|
+
exports.TextInputComponent = require('./structures/TextInputComponent.js').TextInputComponent;
|
|
236
|
+
exports.ThreadChannel = require('./structures/ThreadChannel.js').ThreadChannel;
|
|
237
|
+
exports.ThreadMember = require('./structures/ThreadMember.js').ThreadMember;
|
|
238
|
+
exports.ThreadOnlyChannel = require('./structures/ThreadOnlyChannel.js').ThreadOnlyChannel;
|
|
239
|
+
exports.ThumbnailComponent = require('./structures/ThumbnailComponent.js').ThumbnailComponent;
|
|
240
|
+
exports.Typing = require('./structures/Typing.js').Typing;
|
|
241
|
+
exports.UnfurledMediaItem = require('./structures/UnfurledMediaItem.js').UnfurledMediaItem;
|
|
242
|
+
exports.User = require('./structures/User.js').User;
|
|
243
|
+
exports.UserContextMenuCommandInteraction =
|
|
244
|
+
require('./structures/UserContextMenuCommandInteraction.js').UserContextMenuCommandInteraction;
|
|
245
|
+
exports.UserSelectMenuComponent = require('./structures/UserSelectMenuComponent.js').UserSelectMenuComponent;
|
|
246
|
+
exports.UserSelectMenuInteraction = require('./structures/UserSelectMenuInteraction.js').UserSelectMenuInteraction;
|
|
247
|
+
exports.VoiceChannel = require('./structures/VoiceChannel.js').VoiceChannel;
|
|
248
|
+
exports.VoiceChannelEffect = require('./structures/VoiceChannelEffect.js').VoiceChannelEffect;
|
|
249
|
+
exports.VoiceRegion = require('./structures/VoiceRegion.js').VoiceRegion;
|
|
250
|
+
exports.VoiceState = require('./structures/VoiceState.js').VoiceState;
|
|
251
|
+
exports.Webhook = require('./structures/Webhook.js').Webhook;
|
|
252
|
+
exports.WelcomeChannel = require('./structures/WelcomeChannel.js').WelcomeChannel;
|
|
253
|
+
exports.WelcomeScreen = require('./structures/WelcomeScreen.js').WelcomeScreen;
|
|
254
|
+
exports.Widget = require('./structures/Widget.js').Widget;
|
|
255
|
+
exports.WidgetMember = require('./structures/WidgetMember.js').WidgetMember;
|
|
256
|
+
|
|
257
|
+
// External
|
|
258
|
+
__exportStar(require('discord-api-types/v10'), exports);
|
|
259
|
+
__exportStar(require('@discordjs/rest'), exports);
|
|
260
|
+
__exportStar(require('@discordjs/util'), exports);
|
|
261
|
+
__exportStar(require('@discordjs/ws'), exports);
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { Collection } = require('@discordjs/collection');
|
|
4
|
+
const { makeURLSearchParams } = require('@discordjs/rest');
|
|
5
|
+
const { isJSONEncodable } = require('@discordjs/util');
|
|
6
|
+
const { Routes } = require('discord-api-types/v10');
|
|
7
|
+
const { DiscordjsTypeError, ErrorCodes } = require('../errors/index.js');
|
|
8
|
+
const { ApplicationCommand } = require('../structures/ApplicationCommand.js');
|
|
9
|
+
const { PermissionsBitField } = require('../util/PermissionsBitField.js');
|
|
10
|
+
const { ApplicationCommandPermissionsManager } = require('./ApplicationCommandPermissionsManager.js');
|
|
11
|
+
const { CachedManager } = require('./CachedManager.js');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Manages API methods for application commands and stores their cache.
|
|
15
|
+
*
|
|
16
|
+
* @extends {CachedManager}
|
|
17
|
+
*/
|
|
18
|
+
class ApplicationCommandManager extends CachedManager {
|
|
19
|
+
constructor(client, iterable) {
|
|
20
|
+
super(client, ApplicationCommand, iterable);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The manager for permissions of arbitrary commands on arbitrary guilds
|
|
24
|
+
*
|
|
25
|
+
* @type {ApplicationCommandPermissionsManager}
|
|
26
|
+
*/
|
|
27
|
+
this.permissions = new ApplicationCommandPermissionsManager(this);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The cache of this manager
|
|
32
|
+
*
|
|
33
|
+
* @type {Collection<Snowflake, ApplicationCommand>}
|
|
34
|
+
* @name ApplicationCommandManager#cache
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
_add(data, cache, guildId) {
|
|
38
|
+
return super._add(data, cache, { extras: [this.guild, guildId] });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The APIRouter path to the commands
|
|
43
|
+
*
|
|
44
|
+
* @param {Object} [options] The options
|
|
45
|
+
* @param {Snowflake} [options.id] The application command's id
|
|
46
|
+
* @param {Snowflake} [options.guildId] The guild's id to use in the path,
|
|
47
|
+
* ignored when using a {@link GuildApplicationCommandManager}
|
|
48
|
+
* @returns {string}
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
commandPath({ id, guildId } = {}) {
|
|
52
|
+
if (this.guild ?? guildId) {
|
|
53
|
+
if (id) {
|
|
54
|
+
return Routes.applicationGuildCommand(this.client.application.id, this.guild?.id ?? guildId, id);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return Routes.applicationGuildCommands(this.client.application.id, this.guild?.id ?? guildId);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (id) {
|
|
61
|
+
return Routes.applicationCommand(this.client.application.id, id);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return Routes.applicationCommands(this.client.application.id);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Data that resolves to give an ApplicationCommand object. This can be:
|
|
69
|
+
* - An ApplicationCommand object
|
|
70
|
+
* - A Snowflake
|
|
71
|
+
*
|
|
72
|
+
* @typedef {ApplicationCommand|Snowflake} ApplicationCommandResolvable
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Data that resolves to the data of an ApplicationCommand
|
|
77
|
+
*
|
|
78
|
+
* @typedef {ApplicationCommandData|APIApplicationCommand} ApplicationCommandDataResolvable
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Options used to fetch data from Discord
|
|
83
|
+
*
|
|
84
|
+
* @typedef {Object} BaseFetchOptions
|
|
85
|
+
* @property {boolean} [cache=true] Whether to cache the fetched data if it wasn't already
|
|
86
|
+
* @property {boolean} [force=false] Whether to skip the cache check and request the API
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Options used to fetch Application Commands from Discord
|
|
91
|
+
*
|
|
92
|
+
* @typedef {BaseFetchOptions} FetchApplicationCommandOptions
|
|
93
|
+
* @property {Snowflake} [id] The command's id to fetch
|
|
94
|
+
* @property {Snowflake} [guildId] The guild's id to fetch commands for, for when the guild is not cached
|
|
95
|
+
* @property {Locale} [locale] The locale to use when fetching this command
|
|
96
|
+
* @property {boolean} [withLocalizations] Whether to fetch all localization data
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Obtains one or multiple application commands from Discord, or the cache if it's already available.
|
|
101
|
+
*
|
|
102
|
+
* @param {Snowflake|FetchApplicationCommandOptions} [options] Options for fetching application command(s)
|
|
103
|
+
* @returns {Promise<ApplicationCommand|Collection<Snowflake, ApplicationCommand>>}
|
|
104
|
+
* @example
|
|
105
|
+
* // Fetch a single command
|
|
106
|
+
* client.application.commands.fetch('123456789012345678')
|
|
107
|
+
* .then(command => console.log(`Fetched command ${command.name}`))
|
|
108
|
+
* .catch(console.error);
|
|
109
|
+
* @example
|
|
110
|
+
* // Fetch all commands
|
|
111
|
+
* client.application.commands.fetch()
|
|
112
|
+
* .then(commands => console.log(`Fetched ${commands.size} commands`))
|
|
113
|
+
* .catch(console.error);
|
|
114
|
+
* @example
|
|
115
|
+
* // Fetch all commands in a guild
|
|
116
|
+
* guild.commands.fetch()
|
|
117
|
+
* .then(commands => console.log(`Fetched ${commands.size} commands`))
|
|
118
|
+
* .catch(console.error);
|
|
119
|
+
* @example
|
|
120
|
+
* // Fetch a single command without checking cache
|
|
121
|
+
* guild.commands.fetch({ id: '123456789012345678', force: true })
|
|
122
|
+
* .then(command => console.log(`Fetched command ${command.name}`))
|
|
123
|
+
* .catch(console.error)
|
|
124
|
+
*/
|
|
125
|
+
async fetch(options) {
|
|
126
|
+
if (!options) return this._fetchMany();
|
|
127
|
+
|
|
128
|
+
if (typeof options === 'string') return this._fetchSingle({ id: options });
|
|
129
|
+
|
|
130
|
+
const { cache, force, guildId, id, locale, withLocalizations } = options;
|
|
131
|
+
|
|
132
|
+
if (id) return this._fetchSingle({ cache, force, guildId, id });
|
|
133
|
+
|
|
134
|
+
return this._fetchMany({ cache, guildId, locale, withLocalizations });
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async _fetchSingle({ cache, force = false, guildId, id }) {
|
|
138
|
+
if (!force) {
|
|
139
|
+
const existing = this.cache.get(id);
|
|
140
|
+
if (existing) return existing;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const command = await this.client.rest.get(this.commandPath({ id, guildId }));
|
|
144
|
+
return this._add(command, cache);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async _fetchMany({ cache, guildId, locale, withLocalizations } = {}) {
|
|
148
|
+
const data = await this.client.rest.get(this.commandPath({ guildId }), {
|
|
149
|
+
headers: {
|
|
150
|
+
'X-Discord-Locale': locale,
|
|
151
|
+
},
|
|
152
|
+
query: makeURLSearchParams({ with_localizations: withLocalizations }),
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
return data.reduce((coll, command) => coll.set(command.id, this._add(command, cache, guildId)), new Collection());
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Creates an application command.
|
|
160
|
+
*
|
|
161
|
+
* @param {ApplicationCommandDataResolvable} command The command
|
|
162
|
+
* @param {Snowflake} [guildId] The guild's id to create this command in,
|
|
163
|
+
* ignored when using a {@link GuildApplicationCommandManager}
|
|
164
|
+
* @returns {Promise<ApplicationCommand>}
|
|
165
|
+
* @example
|
|
166
|
+
* // Create a new command
|
|
167
|
+
* client.application.commands.create({
|
|
168
|
+
* name: 'test',
|
|
169
|
+
* description: 'A test command',
|
|
170
|
+
* })
|
|
171
|
+
* .then(console.log)
|
|
172
|
+
* .catch(console.error);
|
|
173
|
+
*/
|
|
174
|
+
async create(command, guildId) {
|
|
175
|
+
const data = await this.client.rest.post(this.commandPath({ guildId }), {
|
|
176
|
+
body: this.constructor.transformCommand(command),
|
|
177
|
+
});
|
|
178
|
+
return this._add(data, true, guildId);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Sets all the commands for this application or guild.
|
|
183
|
+
*
|
|
184
|
+
* @param {ApplicationCommandDataResolvable[]} commands The commands
|
|
185
|
+
* @param {Snowflake} [guildId] The guild's id to create the commands in,
|
|
186
|
+
* ignored when using a {@link GuildApplicationCommandManager}
|
|
187
|
+
* @returns {Promise<Collection<Snowflake, ApplicationCommand>>}
|
|
188
|
+
* @example
|
|
189
|
+
* // Set all commands to just this one
|
|
190
|
+
* client.application.commands.set([
|
|
191
|
+
* {
|
|
192
|
+
* name: 'test',
|
|
193
|
+
* description: 'A test command',
|
|
194
|
+
* },
|
|
195
|
+
* ])
|
|
196
|
+
* .then(console.log)
|
|
197
|
+
* .catch(console.error);
|
|
198
|
+
* @example
|
|
199
|
+
* // Remove all commands
|
|
200
|
+
* guild.commands.set([])
|
|
201
|
+
* .then(console.log)
|
|
202
|
+
* .catch(console.error);
|
|
203
|
+
*/
|
|
204
|
+
async set(commands, guildId) {
|
|
205
|
+
const data = await this.client.rest.put(this.commandPath({ guildId }), {
|
|
206
|
+
body: commands.map(command => this.constructor.transformCommand(command)),
|
|
207
|
+
});
|
|
208
|
+
return data.reduce(
|
|
209
|
+
(collection, command) => collection.set(command.id, this._add(command, true, guildId)),
|
|
210
|
+
new Collection(),
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Edits an application command.
|
|
216
|
+
*
|
|
217
|
+
* @param {ApplicationCommandResolvable} command The command to edit
|
|
218
|
+
* @param {Partial<ApplicationCommandDataResolvable>} data The data to update the command with
|
|
219
|
+
* @param {Snowflake} [guildId] The guild's id where the command registered,
|
|
220
|
+
* ignored when using a {@link GuildApplicationCommandManager}
|
|
221
|
+
* @returns {Promise<ApplicationCommand>}
|
|
222
|
+
* @example
|
|
223
|
+
* // Edit an existing command
|
|
224
|
+
* client.application.commands.edit('123456789012345678', {
|
|
225
|
+
* description: 'New description',
|
|
226
|
+
* })
|
|
227
|
+
* .then(console.log)
|
|
228
|
+
* .catch(console.error);
|
|
229
|
+
*/
|
|
230
|
+
async edit(command, data, guildId) {
|
|
231
|
+
const id = this.resolveId(command);
|
|
232
|
+
if (!id) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'command', 'ApplicationCommandResolvable');
|
|
233
|
+
|
|
234
|
+
const patched = await this.client.rest.patch(this.commandPath({ id, guildId }), {
|
|
235
|
+
body: this.constructor.transformCommand(data),
|
|
236
|
+
});
|
|
237
|
+
return this._add(patched, true, guildId);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Deletes an application command.
|
|
242
|
+
*
|
|
243
|
+
* @param {ApplicationCommandResolvable} command The command to delete
|
|
244
|
+
* @param {Snowflake} [guildId] The guild's id where the command is registered,
|
|
245
|
+
* ignored when using a {@link GuildApplicationCommandManager}
|
|
246
|
+
* @returns {Promise<?ApplicationCommand>}
|
|
247
|
+
* @example
|
|
248
|
+
* // Delete a command
|
|
249
|
+
* guild.commands.delete('123456789012345678')
|
|
250
|
+
* .then(console.log)
|
|
251
|
+
* .catch(console.error);
|
|
252
|
+
*/
|
|
253
|
+
async delete(command, guildId) {
|
|
254
|
+
const id = this.resolveId(command);
|
|
255
|
+
if (!id) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'command', 'ApplicationCommandResolvable');
|
|
256
|
+
|
|
257
|
+
await this.client.rest.delete(this.commandPath({ id, guildId }));
|
|
258
|
+
|
|
259
|
+
const cached = this.cache.get(id);
|
|
260
|
+
this.cache.delete(id);
|
|
261
|
+
return cached ?? null;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Transforms an {@link ApplicationCommandData} object into something that can be used with the API.
|
|
266
|
+
*
|
|
267
|
+
* @param {ApplicationCommandDataResolvable} command The command to transform
|
|
268
|
+
* @returns {APIApplicationCommand}
|
|
269
|
+
* @private
|
|
270
|
+
*/
|
|
271
|
+
static transformCommand(command) {
|
|
272
|
+
if (isJSONEncodable(command)) return command.toJSON();
|
|
273
|
+
|
|
274
|
+
let default_member_permissions;
|
|
275
|
+
|
|
276
|
+
if ('default_member_permissions' in command) {
|
|
277
|
+
default_member_permissions = command.default_member_permissions
|
|
278
|
+
? new PermissionsBitField(BigInt(command.default_member_permissions)).bitfield.toString()
|
|
279
|
+
: command.default_member_permissions;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if ('defaultMemberPermissions' in command) {
|
|
283
|
+
default_member_permissions =
|
|
284
|
+
command.defaultMemberPermissions === null
|
|
285
|
+
? command.defaultMemberPermissions
|
|
286
|
+
: new PermissionsBitField(command.defaultMemberPermissions).bitfield.toString();
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return {
|
|
290
|
+
name: command.name,
|
|
291
|
+
name_localizations: command.nameLocalizations ?? command.name_localizations,
|
|
292
|
+
description: command.description,
|
|
293
|
+
nsfw: command.nsfw,
|
|
294
|
+
description_localizations: command.descriptionLocalizations ?? command.description_localizations,
|
|
295
|
+
type: command.type,
|
|
296
|
+
options: command.options?.map(option => ApplicationCommand.transformOption(option)),
|
|
297
|
+
default_member_permissions,
|
|
298
|
+
integration_types: command.integrationTypes ?? command.integration_types,
|
|
299
|
+
contexts: command.contexts,
|
|
300
|
+
handler: command.handler,
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
exports.ApplicationCommandManager = ApplicationCommandManager;
|