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
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { InteractionResponseType, Routes } = require('discord-api-types/v10');
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const {
|
|
4
|
+
const BaseInteraction = require('./BaseInteraction');
|
|
5
|
+
const CommandInteractionOptionResolver = require('./CommandInteractionOptionResolver');
|
|
6
|
+
const { DiscordjsError, ErrorCodes } = require('../errors');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Represents an autocomplete interaction.
|
|
10
|
-
*
|
|
11
10
|
* @extends {BaseInteraction}
|
|
12
11
|
*/
|
|
13
12
|
class AutocompleteInteraction extends BaseInteraction {
|
|
@@ -16,49 +15,42 @@ class AutocompleteInteraction extends BaseInteraction {
|
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* The id of the channel this interaction was sent in
|
|
19
|
-
*
|
|
20
18
|
* @type {Snowflake}
|
|
21
19
|
* @name AutocompleteInteraction#channelId
|
|
22
20
|
*/
|
|
23
21
|
|
|
24
22
|
/**
|
|
25
23
|
* The invoked application command's id
|
|
26
|
-
*
|
|
27
24
|
* @type {Snowflake}
|
|
28
25
|
*/
|
|
29
26
|
this.commandId = data.data.id;
|
|
30
27
|
|
|
31
28
|
/**
|
|
32
29
|
* The invoked application command's name
|
|
33
|
-
*
|
|
34
30
|
* @type {string}
|
|
35
31
|
*/
|
|
36
32
|
this.commandName = data.data.name;
|
|
37
33
|
|
|
38
34
|
/**
|
|
39
35
|
* The invoked application command's type
|
|
40
|
-
*
|
|
41
36
|
* @type {ApplicationCommandType}
|
|
42
37
|
*/
|
|
43
38
|
this.commandType = data.data.type;
|
|
44
39
|
|
|
45
40
|
/**
|
|
46
41
|
* The id of the guild the invoked application command is registered to
|
|
47
|
-
*
|
|
48
42
|
* @type {?Snowflake}
|
|
49
43
|
*/
|
|
50
44
|
this.commandGuildId = data.data.guild_id ?? null;
|
|
51
45
|
|
|
52
46
|
/**
|
|
53
47
|
* Whether this interaction has already received a response
|
|
54
|
-
*
|
|
55
48
|
* @type {boolean}
|
|
56
49
|
*/
|
|
57
50
|
this.responded = false;
|
|
58
51
|
|
|
59
52
|
/**
|
|
60
53
|
* The options passed to the command
|
|
61
|
-
*
|
|
62
54
|
* @type {CommandInteractionOptionResolver}
|
|
63
55
|
*/
|
|
64
56
|
this.options = new CommandInteractionOptionResolver(this.client, data.data.options ?? []);
|
|
@@ -66,7 +58,6 @@ class AutocompleteInteraction extends BaseInteraction {
|
|
|
66
58
|
|
|
67
59
|
/**
|
|
68
60
|
* The invoked application command, if it was fetched before
|
|
69
|
-
*
|
|
70
61
|
* @type {?ApplicationCommand}
|
|
71
62
|
*/
|
|
72
63
|
get command() {
|
|
@@ -76,7 +67,6 @@ class AutocompleteInteraction extends BaseInteraction {
|
|
|
76
67
|
|
|
77
68
|
/**
|
|
78
69
|
* Sends results for the autocomplete of this interaction.
|
|
79
|
-
*
|
|
80
70
|
* @param {ApplicationCommandOptionChoiceData[]} options The options for the autocomplete
|
|
81
71
|
* @returns {Promise<void>}
|
|
82
72
|
* @example
|
|
@@ -109,4 +99,4 @@ class AutocompleteInteraction extends BaseInteraction {
|
|
|
109
99
|
}
|
|
110
100
|
}
|
|
111
101
|
|
|
112
|
-
exports
|
|
102
|
+
module.exports = AutocompleteInteraction;
|
package/src/structures/Base.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const { flatten } = require('../util/Util
|
|
3
|
+
const { flatten } = require('../util/Util');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Represents a data model that is identifiable by a Snowflake (i.e. Discord API data models).
|
|
7
|
-
*
|
|
8
7
|
* @abstract
|
|
9
8
|
*/
|
|
10
9
|
class Base {
|
|
11
10
|
constructor(client) {
|
|
12
11
|
/**
|
|
13
12
|
* The client that instantiated this
|
|
14
|
-
*
|
|
15
13
|
* @name Base#client
|
|
16
14
|
* @type {Client}
|
|
17
15
|
* @readonly
|
|
@@ -42,4 +40,4 @@ class Base {
|
|
|
42
40
|
}
|
|
43
41
|
}
|
|
44
42
|
|
|
45
|
-
exports
|
|
43
|
+
module.exports = Base;
|
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
const { channelLink, channelMention } = require('@discordjs/formatters');
|
|
4
4
|
const { DiscordSnowflake } = require('../util/LolkaSnowflake');
|
|
5
5
|
const { ChannelType, Routes } = require('discord-api-types/v10');
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const {
|
|
6
|
+
const Base = require('./Base');
|
|
7
|
+
const ChannelFlagsBitField = require('../util/ChannelFlagsBitField');
|
|
8
|
+
const { ThreadChannelTypes } = require('../util/Constants');
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Represents any channel on Discord.
|
|
12
|
-
*
|
|
13
12
|
* @extends {Base}
|
|
14
13
|
* @abstract
|
|
15
14
|
*/
|
|
@@ -19,7 +18,6 @@ class BaseChannel extends Base {
|
|
|
19
18
|
|
|
20
19
|
/**
|
|
21
20
|
* The type of the channel
|
|
22
|
-
*
|
|
23
21
|
* @type {ChannelType}
|
|
24
22
|
*/
|
|
25
23
|
this.type = data.type;
|
|
@@ -32,7 +30,6 @@ class BaseChannel extends Base {
|
|
|
32
30
|
/**
|
|
33
31
|
* The flags that are applied to the channel.
|
|
34
32
|
* <info>This is only `null` in a {@link PartialGroupDMChannel}. In all other cases, it is not `null`.</info>
|
|
35
|
-
*
|
|
36
33
|
* @type {?Readonly<ChannelFlagsBitField>}
|
|
37
34
|
*/
|
|
38
35
|
this.flags = new ChannelFlagsBitField(data.flags).freeze();
|
|
@@ -42,7 +39,6 @@ class BaseChannel extends Base {
|
|
|
42
39
|
|
|
43
40
|
/**
|
|
44
41
|
* The channel's id
|
|
45
|
-
*
|
|
46
42
|
* @type {Snowflake}
|
|
47
43
|
*/
|
|
48
44
|
this.id = data.id;
|
|
@@ -50,7 +46,6 @@ class BaseChannel extends Base {
|
|
|
50
46
|
|
|
51
47
|
/**
|
|
52
48
|
* The timestamp the channel was created at
|
|
53
|
-
*
|
|
54
49
|
* @type {number}
|
|
55
50
|
* @readonly
|
|
56
51
|
*/
|
|
@@ -60,7 +55,6 @@ class BaseChannel extends Base {
|
|
|
60
55
|
|
|
61
56
|
/**
|
|
62
57
|
* The time the channel was created at
|
|
63
|
-
*
|
|
64
58
|
* @type {Date}
|
|
65
59
|
* @readonly
|
|
66
60
|
*/
|
|
@@ -70,7 +64,6 @@ class BaseChannel extends Base {
|
|
|
70
64
|
|
|
71
65
|
/**
|
|
72
66
|
* The URL to the channel
|
|
73
|
-
*
|
|
74
67
|
* @type {string}
|
|
75
68
|
* @readonly
|
|
76
69
|
*/
|
|
@@ -81,7 +74,6 @@ class BaseChannel extends Base {
|
|
|
81
74
|
/**
|
|
82
75
|
* Whether this Channel is a partial
|
|
83
76
|
* <info>This is always false outside of DM channels.</info>
|
|
84
|
-
*
|
|
85
77
|
* @type {boolean}
|
|
86
78
|
* @readonly
|
|
87
79
|
*/
|
|
@@ -91,7 +83,6 @@ class BaseChannel extends Base {
|
|
|
91
83
|
|
|
92
84
|
/**
|
|
93
85
|
* When concatenated with a string, this automatically returns the channel's mention instead of the Channel object.
|
|
94
|
-
*
|
|
95
86
|
* @returns {string}
|
|
96
87
|
* @example
|
|
97
88
|
* // Logs: Hello from <#123456789012345678>!
|
|
@@ -103,7 +94,6 @@ class BaseChannel extends Base {
|
|
|
103
94
|
|
|
104
95
|
/**
|
|
105
96
|
* Deletes this channel.
|
|
106
|
-
*
|
|
107
97
|
* @returns {Promise<BaseChannel>}
|
|
108
98
|
* @example
|
|
109
99
|
* // Delete the channel
|
|
@@ -118,17 +108,15 @@ class BaseChannel extends Base {
|
|
|
118
108
|
|
|
119
109
|
/**
|
|
120
110
|
* Fetches this channel.
|
|
121
|
-
*
|
|
122
111
|
* @param {boolean} [force=true] Whether to skip the cache check and request the API
|
|
123
112
|
* @returns {Promise<BaseChannel>}
|
|
124
113
|
*/
|
|
125
|
-
|
|
114
|
+
fetch(force = true) {
|
|
126
115
|
return this.client.channels.fetch(this.id, { force });
|
|
127
116
|
}
|
|
128
117
|
|
|
129
118
|
/**
|
|
130
119
|
* Indicates whether this channel is a {@link ThreadChannel}.
|
|
131
|
-
*
|
|
132
120
|
* @returns {boolean}
|
|
133
121
|
*/
|
|
134
122
|
isThread() {
|
|
@@ -137,7 +125,6 @@ class BaseChannel extends Base {
|
|
|
137
125
|
|
|
138
126
|
/**
|
|
139
127
|
* Indicates whether this channel is {@link TextBasedChannels text-based}.
|
|
140
|
-
*
|
|
141
128
|
* @returns {boolean}
|
|
142
129
|
*/
|
|
143
130
|
isTextBased() {
|
|
@@ -146,7 +133,6 @@ class BaseChannel extends Base {
|
|
|
146
133
|
|
|
147
134
|
/**
|
|
148
135
|
* Indicates whether this channel is DM-based (either a {@link DMChannel} or a {@link PartialGroupDMChannel}).
|
|
149
|
-
*
|
|
150
136
|
* @returns {boolean}
|
|
151
137
|
*/
|
|
152
138
|
isDMBased() {
|
|
@@ -155,7 +141,6 @@ class BaseChannel extends Base {
|
|
|
155
141
|
|
|
156
142
|
/**
|
|
157
143
|
* Indicates whether this channel is {@link BaseGuildVoiceChannel voice-based}.
|
|
158
|
-
*
|
|
159
144
|
* @returns {boolean}
|
|
160
145
|
*/
|
|
161
146
|
isVoiceBased() {
|
|
@@ -164,7 +149,6 @@ class BaseChannel extends Base {
|
|
|
164
149
|
|
|
165
150
|
/**
|
|
166
151
|
* Indicates whether this channel is {@link ThreadOnlyChannel thread-only}.
|
|
167
|
-
*
|
|
168
152
|
* @returns {boolean}
|
|
169
153
|
*/
|
|
170
154
|
isThreadOnly() {
|
|
@@ -173,7 +157,6 @@ class BaseChannel extends Base {
|
|
|
173
157
|
|
|
174
158
|
/**
|
|
175
159
|
* Indicates whether this channel is sendable.
|
|
176
|
-
*
|
|
177
160
|
* @returns {boolean}
|
|
178
161
|
*/
|
|
179
162
|
isSendable() {
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
const { makeURLSearchParams } = require('@discordjs/rest');
|
|
4
4
|
const { DiscordSnowflake } = require('../util/LolkaSnowflake');
|
|
5
5
|
const { Routes, GuildFeature } = require('discord-api-types/v10');
|
|
6
|
-
const
|
|
6
|
+
const Base = require('./Base');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The base class for {@link Guild}, {@link OAuth2Guild} and {@link InviteGuild}.
|
|
10
|
-
*
|
|
11
10
|
* @extends {Base}
|
|
12
11
|
* @abstract
|
|
13
12
|
*/
|
|
@@ -17,28 +16,24 @@ class BaseGuild extends Base {
|
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* The guild's id
|
|
20
|
-
*
|
|
21
19
|
* @type {Snowflake}
|
|
22
20
|
*/
|
|
23
21
|
this.id = data.id;
|
|
24
22
|
|
|
25
23
|
/**
|
|
26
24
|
* The name of this guild
|
|
27
|
-
*
|
|
28
25
|
* @type {string}
|
|
29
26
|
*/
|
|
30
27
|
this.name = data.name;
|
|
31
28
|
|
|
32
29
|
/**
|
|
33
30
|
* The icon hash of this guild
|
|
34
|
-
*
|
|
35
31
|
* @type {?string}
|
|
36
32
|
*/
|
|
37
33
|
this.icon = data.icon;
|
|
38
34
|
|
|
39
35
|
/**
|
|
40
36
|
* An array of features available to this guild
|
|
41
|
-
*
|
|
42
37
|
* @type {GuildFeature[]}
|
|
43
38
|
*/
|
|
44
39
|
this.features = data.features;
|
|
@@ -46,7 +41,6 @@ class BaseGuild extends Base {
|
|
|
46
41
|
|
|
47
42
|
/**
|
|
48
43
|
* The timestamp this guild was created at
|
|
49
|
-
*
|
|
50
44
|
* @type {number}
|
|
51
45
|
* @readonly
|
|
52
46
|
*/
|
|
@@ -56,7 +50,6 @@ class BaseGuild extends Base {
|
|
|
56
50
|
|
|
57
51
|
/**
|
|
58
52
|
* The time this guild was created at
|
|
59
|
-
*
|
|
60
53
|
* @type {Date}
|
|
61
54
|
* @readonly
|
|
62
55
|
*/
|
|
@@ -66,22 +59,18 @@ class BaseGuild extends Base {
|
|
|
66
59
|
|
|
67
60
|
/**
|
|
68
61
|
* The acronym that shows up in place of a guild icon
|
|
69
|
-
*
|
|
70
62
|
* @type {string}
|
|
71
63
|
* @readonly
|
|
72
64
|
*/
|
|
73
65
|
get nameAcronym() {
|
|
74
|
-
/* eslint-disable unicorn/prefer-string-replace-all */
|
|
75
66
|
return this.name
|
|
76
67
|
.replace(/'s /g, ' ')
|
|
77
|
-
.replace(/\w+/g,
|
|
68
|
+
.replace(/\w+/g, e => e[0])
|
|
78
69
|
.replace(/\s/g, '');
|
|
79
|
-
/* eslint-enable unicorn/prefer-string-replace-all */
|
|
80
70
|
}
|
|
81
71
|
|
|
82
72
|
/**
|
|
83
73
|
* Whether this guild is partnered
|
|
84
|
-
*
|
|
85
74
|
* @type {boolean}
|
|
86
75
|
* @readonly
|
|
87
76
|
*/
|
|
@@ -91,7 +80,6 @@ class BaseGuild extends Base {
|
|
|
91
80
|
|
|
92
81
|
/**
|
|
93
82
|
* Whether this guild is verified
|
|
94
|
-
*
|
|
95
83
|
* @type {boolean}
|
|
96
84
|
* @readonly
|
|
97
85
|
*/
|
|
@@ -101,17 +89,18 @@ class BaseGuild extends Base {
|
|
|
101
89
|
|
|
102
90
|
/**
|
|
103
91
|
* The URL to this guild's icon.
|
|
104
|
-
*
|
|
105
92
|
* @param {ImageURLOptions} [options={}] Options for the image URL
|
|
106
93
|
* @returns {?string}
|
|
107
94
|
*/
|
|
108
95
|
iconURL(options = {}) {
|
|
109
|
-
return
|
|
96
|
+
return (
|
|
97
|
+
this.icon &&
|
|
98
|
+
(/^https?:\/\//.test(this.icon) ? this.icon : this.client.rest.cdn.icon(this.id, this.icon, options))
|
|
99
|
+
);
|
|
110
100
|
}
|
|
111
101
|
|
|
112
102
|
/**
|
|
113
103
|
* Fetches this guild.
|
|
114
|
-
*
|
|
115
104
|
* @returns {Promise<Guild>}
|
|
116
105
|
*/
|
|
117
106
|
async fetch() {
|
|
@@ -123,7 +112,6 @@ class BaseGuild extends Base {
|
|
|
123
112
|
|
|
124
113
|
/**
|
|
125
114
|
* When concatenated with a string, this automatically returns the guild's name instead of the Guild object.
|
|
126
|
-
*
|
|
127
115
|
* @returns {string}
|
|
128
116
|
*/
|
|
129
117
|
toString() {
|
|
@@ -131,4 +119,4 @@ class BaseGuild extends Base {
|
|
|
131
119
|
}
|
|
132
120
|
}
|
|
133
121
|
|
|
134
|
-
exports
|
|
122
|
+
module.exports = BaseGuild;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const { Emoji } = require('./Emoji
|
|
3
|
+
const { Emoji } = require('./Emoji');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Parent class for {@link GuildEmoji} and {@link GuildPreviewEmoji}.
|
|
7
|
-
*
|
|
8
7
|
* @extends {Emoji}
|
|
9
8
|
* @abstract
|
|
10
9
|
*/
|
|
@@ -14,7 +13,6 @@ class BaseGuildEmoji extends Emoji {
|
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* The guild this emoji is a part of
|
|
17
|
-
*
|
|
18
16
|
* @type {Guild|GuildPreview}
|
|
19
17
|
*/
|
|
20
18
|
this.guild = guild;
|
|
@@ -32,7 +30,6 @@ class BaseGuildEmoji extends Emoji {
|
|
|
32
30
|
if ('require_colons' in data) {
|
|
33
31
|
/**
|
|
34
32
|
* Whether or not this emoji requires colons surrounding it
|
|
35
|
-
*
|
|
36
33
|
* @type {?boolean}
|
|
37
34
|
*/
|
|
38
35
|
this.requiresColons = data.require_colons;
|
|
@@ -41,7 +38,6 @@ class BaseGuildEmoji extends Emoji {
|
|
|
41
38
|
if ('managed' in data) {
|
|
42
39
|
/**
|
|
43
40
|
* Whether this emoji is managed by an external service
|
|
44
|
-
*
|
|
45
41
|
* @type {?boolean}
|
|
46
42
|
*/
|
|
47
43
|
this.managed = data.managed;
|
|
@@ -50,7 +46,6 @@ class BaseGuildEmoji extends Emoji {
|
|
|
50
46
|
if ('available' in data) {
|
|
51
47
|
/**
|
|
52
48
|
* Whether this emoji is available
|
|
53
|
-
*
|
|
54
49
|
* @type {?boolean}
|
|
55
50
|
*/
|
|
56
51
|
this.available = data.available;
|
|
@@ -60,17 +55,25 @@ class BaseGuildEmoji extends Emoji {
|
|
|
60
55
|
|
|
61
56
|
/**
|
|
62
57
|
* Returns a URL for the emoji.
|
|
63
|
-
*
|
|
64
58
|
* @method imageURL
|
|
65
59
|
* @memberof BaseGuildEmoji
|
|
66
60
|
* @instance
|
|
67
|
-
* @param {EmojiURLOptions} [options
|
|
61
|
+
* @param {EmojiURLOptions} [options] Options for the emoji URL
|
|
68
62
|
* @returns {string}
|
|
69
63
|
*/
|
|
70
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Returns a URL for the emoji.
|
|
67
|
+
* @name url
|
|
68
|
+
* @memberof BaseGuildEmoji
|
|
69
|
+
* @instance
|
|
70
|
+
* @type {string}
|
|
71
|
+
* @readonly
|
|
72
|
+
* @deprecated Use {@link BaseGuildEmoji#imageURL} instead.
|
|
73
|
+
*/
|
|
74
|
+
|
|
71
75
|
/**
|
|
72
76
|
* The emoji's name
|
|
73
|
-
*
|
|
74
77
|
* @name name
|
|
75
78
|
* @memberof BaseGuildEmoji
|
|
76
79
|
* @instance
|
|
@@ -80,7 +83,6 @@ class BaseGuildEmoji extends Emoji {
|
|
|
80
83
|
|
|
81
84
|
/**
|
|
82
85
|
* Whether or not the emoji is animated
|
|
83
|
-
*
|
|
84
86
|
* @name animated
|
|
85
87
|
* @memberof BaseGuildEmoji
|
|
86
88
|
* @instance
|
|
@@ -90,7 +92,6 @@ class BaseGuildEmoji extends Emoji {
|
|
|
90
92
|
|
|
91
93
|
/**
|
|
92
94
|
* The time the emoji was created at.
|
|
93
|
-
*
|
|
94
95
|
* @name createdAt
|
|
95
96
|
* @memberof BaseGuildEmoji
|
|
96
97
|
* @instance
|
|
@@ -100,7 +101,6 @@ class BaseGuildEmoji extends Emoji {
|
|
|
100
101
|
|
|
101
102
|
/**
|
|
102
103
|
* The timestamp the emoji was created at.
|
|
103
|
-
*
|
|
104
104
|
* @name createdTimestamp
|
|
105
105
|
* @memberof BaseGuildEmoji
|
|
106
106
|
* @instance
|
|
@@ -108,4 +108,4 @@ class BaseGuildEmoji extends Emoji {
|
|
|
108
108
|
* @readonly
|
|
109
109
|
*/
|
|
110
110
|
|
|
111
|
-
exports
|
|
111
|
+
module.exports = BaseGuildEmoji;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
3
|
+
const GuildChannel = require('./GuildChannel');
|
|
4
|
+
const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
|
5
|
+
const GuildMessageManager = require('../managers/GuildMessageManager');
|
|
6
|
+
const GuildTextThreadManager = require('../managers/GuildTextThreadManager');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Represents a text-based guild channel on Discord.
|
|
10
|
-
*
|
|
11
10
|
* @extends {GuildChannel}
|
|
12
11
|
* @implements {TextBasedChannel}
|
|
13
12
|
*/
|
|
@@ -17,21 +16,18 @@ class BaseGuildTextChannel extends GuildChannel {
|
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* A manager of the messages sent to this channel
|
|
20
|
-
*
|
|
21
19
|
* @type {GuildMessageManager}
|
|
22
20
|
*/
|
|
23
21
|
this.messages = new GuildMessageManager(this);
|
|
24
22
|
|
|
25
23
|
/**
|
|
26
24
|
* A manager of the threads belonging to this channel
|
|
27
|
-
*
|
|
28
25
|
* @type {GuildTextThreadManager}
|
|
29
26
|
*/
|
|
30
27
|
this.threads = new GuildTextThreadManager(this);
|
|
31
28
|
|
|
32
29
|
/**
|
|
33
30
|
* If the guild considers this channel NSFW
|
|
34
|
-
*
|
|
35
31
|
* @type {boolean}
|
|
36
32
|
*/
|
|
37
33
|
this.nsfw = Boolean(data.nsfw);
|
|
@@ -45,7 +41,6 @@ class BaseGuildTextChannel extends GuildChannel {
|
|
|
45
41
|
if ('topic' in data) {
|
|
46
42
|
/**
|
|
47
43
|
* The topic of the text channel
|
|
48
|
-
*
|
|
49
44
|
* @type {?string}
|
|
50
45
|
*/
|
|
51
46
|
this.topic = data.topic;
|
|
@@ -58,7 +53,6 @@ class BaseGuildTextChannel extends GuildChannel {
|
|
|
58
53
|
if ('last_message_id' in data) {
|
|
59
54
|
/**
|
|
60
55
|
* The last message id sent in the channel, if one was sent
|
|
61
|
-
*
|
|
62
56
|
* @type {?Snowflake}
|
|
63
57
|
*/
|
|
64
58
|
this.lastMessageId = data.last_message_id;
|
|
@@ -67,7 +61,6 @@ class BaseGuildTextChannel extends GuildChannel {
|
|
|
67
61
|
if ('last_pin_timestamp' in data) {
|
|
68
62
|
/**
|
|
69
63
|
* The timestamp when the last pinned message was pinned, if there was one
|
|
70
|
-
*
|
|
71
64
|
* @type {?number}
|
|
72
65
|
*/
|
|
73
66
|
this.lastPinTimestamp = data.last_pin_timestamp ? Date.parse(data.last_pin_timestamp) : null;
|
|
@@ -76,7 +69,6 @@ class BaseGuildTextChannel extends GuildChannel {
|
|
|
76
69
|
if ('default_auto_archive_duration' in data) {
|
|
77
70
|
/**
|
|
78
71
|
* The default auto archive duration for newly created threads in this channel
|
|
79
|
-
*
|
|
80
72
|
* @type {?ThreadAutoArchiveDuration}
|
|
81
73
|
*/
|
|
82
74
|
this.defaultAutoArchiveDuration = data.default_auto_archive_duration;
|
|
@@ -85,7 +77,6 @@ class BaseGuildTextChannel extends GuildChannel {
|
|
|
85
77
|
if ('default_thread_rate_limit_per_user' in data) {
|
|
86
78
|
/**
|
|
87
79
|
* The initial rate limit per user (slowmode) to set on newly created threads in a channel.
|
|
88
|
-
*
|
|
89
80
|
* @type {?number}
|
|
90
81
|
*/
|
|
91
82
|
this.defaultThreadRateLimitPerUser = data.default_thread_rate_limit_per_user;
|
|
@@ -100,30 +91,27 @@ class BaseGuildTextChannel extends GuildChannel {
|
|
|
100
91
|
|
|
101
92
|
/**
|
|
102
93
|
* Sets the default auto archive duration for all newly created threads in this channel.
|
|
103
|
-
*
|
|
104
94
|
* @param {ThreadAutoArchiveDuration} defaultAutoArchiveDuration The new default auto archive duration
|
|
105
95
|
* @param {string} [reason] Reason for changing the channel's default auto archive duration
|
|
106
96
|
* @returns {Promise<TextChannel>}
|
|
107
97
|
*/
|
|
108
|
-
|
|
98
|
+
setDefaultAutoArchiveDuration(defaultAutoArchiveDuration, reason) {
|
|
109
99
|
return this.edit({ defaultAutoArchiveDuration, reason });
|
|
110
100
|
}
|
|
111
101
|
|
|
112
102
|
/**
|
|
113
103
|
* Sets the type of this channel.
|
|
114
|
-
* <info>Only conversion between {@link TextChannel} and {@link
|
|
115
|
-
*
|
|
104
|
+
* <info>Only conversion between {@link TextChannel} and {@link NewsChannel} is supported.</info>
|
|
116
105
|
* @param {ChannelType.GuildText|ChannelType.GuildAnnouncement} type The new channel type
|
|
117
106
|
* @param {string} [reason] Reason for changing the channel's type
|
|
118
107
|
* @returns {Promise<GuildChannel>}
|
|
119
108
|
*/
|
|
120
|
-
|
|
109
|
+
setType(type, reason) {
|
|
121
110
|
return this.edit({ type, reason });
|
|
122
111
|
}
|
|
123
112
|
|
|
124
113
|
/**
|
|
125
114
|
* Sets a new topic for the guild channel.
|
|
126
|
-
*
|
|
127
115
|
* @param {?string} topic The new topic for the guild channel
|
|
128
116
|
* @param {string} [reason] Reason for changing the guild channel's topic
|
|
129
117
|
* @returns {Promise<GuildChannel>}
|
|
@@ -133,22 +121,20 @@ class BaseGuildTextChannel extends GuildChannel {
|
|
|
133
121
|
* .then(newChannel => console.log(`Channel's new topic is ${newChannel.topic}`))
|
|
134
122
|
* .catch(console.error);
|
|
135
123
|
*/
|
|
136
|
-
|
|
124
|
+
setTopic(topic, reason) {
|
|
137
125
|
return this.edit({ topic, reason });
|
|
138
126
|
}
|
|
139
127
|
|
|
140
128
|
/**
|
|
141
129
|
* Data that can be resolved to an Application. This can be:
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
130
|
+
* * An Application
|
|
131
|
+
* * An Activity with associated Application
|
|
132
|
+
* * A Snowflake
|
|
146
133
|
* @typedef {Application|Snowflake} ApplicationResolvable
|
|
147
134
|
*/
|
|
148
135
|
|
|
149
136
|
/**
|
|
150
137
|
* Options used to create an invite to a guild channel.
|
|
151
|
-
*
|
|
152
138
|
* @typedef {Object} InviteCreateOptions
|
|
153
139
|
* @property {boolean} [temporary] Whether members that joined via the invite should be automatically
|
|
154
140
|
* kicked after 24 hours if they have not yet received a role
|
|
@@ -166,7 +152,6 @@ class BaseGuildTextChannel extends GuildChannel {
|
|
|
166
152
|
|
|
167
153
|
/**
|
|
168
154
|
* Creates an invite to this guild channel.
|
|
169
|
-
*
|
|
170
155
|
* @param {InviteCreateOptions} [options={}] The options for creating the invite
|
|
171
156
|
* @returns {Promise<Invite>}
|
|
172
157
|
* @example
|
|
@@ -175,51 +160,37 @@ class BaseGuildTextChannel extends GuildChannel {
|
|
|
175
160
|
* .then(invite => console.log(`Created an invite with a code of ${invite.code}`))
|
|
176
161
|
* .catch(console.error);
|
|
177
162
|
*/
|
|
178
|
-
|
|
163
|
+
createInvite(options) {
|
|
179
164
|
return this.guild.invites.create(this.id, options);
|
|
180
165
|
}
|
|
181
166
|
|
|
182
167
|
/**
|
|
183
168
|
* Fetches a collection of invites to this guild channel.
|
|
184
169
|
* Resolves with a collection mapping invites by their codes.
|
|
185
|
-
*
|
|
186
170
|
* @param {boolean} [cache=true] Whether or not to cache the fetched invites
|
|
187
171
|
* @returns {Promise<Collection<string, Invite>>}
|
|
188
172
|
*/
|
|
189
|
-
|
|
173
|
+
fetchInvites(cache = true) {
|
|
190
174
|
return this.guild.invites.fetch({ channelId: this.id, cache });
|
|
191
175
|
}
|
|
192
176
|
|
|
193
177
|
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
|
194
|
-
|
|
195
|
-
/* eslint-disable getter-return */
|
|
178
|
+
/* eslint-disable no-empty-function */
|
|
196
179
|
get lastMessage() {}
|
|
197
|
-
|
|
198
180
|
get lastPinAt() {}
|
|
199
|
-
|
|
200
181
|
send() {}
|
|
201
|
-
|
|
202
182
|
sendTyping() {}
|
|
203
|
-
|
|
204
183
|
createMessageCollector() {}
|
|
205
|
-
|
|
206
184
|
awaitMessages() {}
|
|
207
|
-
|
|
208
185
|
createMessageComponentCollector() {}
|
|
209
|
-
|
|
210
186
|
awaitMessageComponent() {}
|
|
211
|
-
|
|
212
187
|
bulkDelete() {}
|
|
213
|
-
|
|
214
188
|
fetchWebhooks() {}
|
|
215
|
-
|
|
216
189
|
createWebhook() {}
|
|
217
|
-
|
|
218
190
|
setRateLimitPerUser() {}
|
|
219
|
-
|
|
220
191
|
setNSFW() {}
|
|
221
192
|
}
|
|
222
193
|
|
|
223
|
-
TextBasedChannel.applyToClass(BaseGuildTextChannel);
|
|
194
|
+
TextBasedChannel.applyToClass(BaseGuildTextChannel, true);
|
|
224
195
|
|
|
225
|
-
exports
|
|
196
|
+
module.exports = BaseGuildTextChannel;
|