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
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { BaseChannel } = require('./BaseChannel.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents a channel that displays a directory of guilds.
|
|
7
|
+
*
|
|
8
|
+
* @extends {BaseChannel}
|
|
9
|
+
*/
|
|
10
|
+
class DirectoryChannel extends BaseChannel {
|
|
11
|
+
constructor(guild, data, client) {
|
|
12
|
+
super(client, data);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The guild the channel is in
|
|
16
|
+
*
|
|
17
|
+
* @type {InviteGuild}
|
|
18
|
+
*/
|
|
19
|
+
this.guild = guild;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The id of the guild the channel is in
|
|
23
|
+
*
|
|
24
|
+
* @type {Snowflake}
|
|
25
|
+
*/
|
|
26
|
+
this.guildId = guild.id;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
_patch(data) {
|
|
30
|
+
super._patch(data);
|
|
31
|
+
/**
|
|
32
|
+
* The channel's name
|
|
33
|
+
*
|
|
34
|
+
* @type {string}
|
|
35
|
+
*/
|
|
36
|
+
this.name = data.name;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
exports.DirectoryChannel = DirectoryChannel;
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { embedLength } = require('@discordjs/util');
|
|
4
|
+
const isEqual = require('fast-deep-equal');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents an embed.
|
|
8
|
+
*/
|
|
9
|
+
class Embed {
|
|
10
|
+
constructor(data) {
|
|
11
|
+
/**
|
|
12
|
+
* The API embed data.
|
|
13
|
+
*
|
|
14
|
+
* @type {APIEmbed}
|
|
15
|
+
* @readonly
|
|
16
|
+
*/
|
|
17
|
+
this.data = { ...data };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* An array of fields of this embed.
|
|
22
|
+
*
|
|
23
|
+
* @type {Array<APIEmbedField>}
|
|
24
|
+
* @readonly
|
|
25
|
+
*/
|
|
26
|
+
get fields() {
|
|
27
|
+
return this.data.fields ?? [];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The title of this embed.
|
|
32
|
+
*
|
|
33
|
+
* @type {?string}
|
|
34
|
+
* @readonly
|
|
35
|
+
*/
|
|
36
|
+
get title() {
|
|
37
|
+
return this.data.title ?? null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The description of this embed.
|
|
42
|
+
*
|
|
43
|
+
* @type {?string}
|
|
44
|
+
* @readonly
|
|
45
|
+
*/
|
|
46
|
+
get description() {
|
|
47
|
+
return this.data.description ?? null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The URL of this embed.
|
|
52
|
+
*
|
|
53
|
+
* @type {?string}
|
|
54
|
+
* @readonly
|
|
55
|
+
*/
|
|
56
|
+
get url() {
|
|
57
|
+
return this.data.url ?? null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The color of this embed.
|
|
62
|
+
*
|
|
63
|
+
* @type {?number}
|
|
64
|
+
* @readonly
|
|
65
|
+
*/
|
|
66
|
+
get color() {
|
|
67
|
+
return this.data.color ?? null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The timestamp of this embed. This is in an ISO 8601 format.
|
|
72
|
+
*
|
|
73
|
+
* @type {?string}
|
|
74
|
+
* @readonly
|
|
75
|
+
*/
|
|
76
|
+
get timestamp() {
|
|
77
|
+
return this.data.timestamp ?? null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @typedef {Object} EmbedAssetData
|
|
82
|
+
* @property {?string} url The URL of the image
|
|
83
|
+
* @property {?string} proxyURL The proxy URL of the image
|
|
84
|
+
* @property {?number} height The height of the image
|
|
85
|
+
* @property {?number} width The width of the image
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The thumbnail of this embed.
|
|
90
|
+
*
|
|
91
|
+
* @type {?EmbedAssetData}
|
|
92
|
+
* @readonly
|
|
93
|
+
*/
|
|
94
|
+
get thumbnail() {
|
|
95
|
+
if (!this.data.thumbnail) return null;
|
|
96
|
+
return {
|
|
97
|
+
url: this.data.thumbnail.url,
|
|
98
|
+
proxyURL: this.data.thumbnail.proxy_url,
|
|
99
|
+
height: this.data.thumbnail.height,
|
|
100
|
+
width: this.data.thumbnail.width,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The image of this embed.
|
|
106
|
+
*
|
|
107
|
+
* @type {?EmbedAssetData}
|
|
108
|
+
* @readonly
|
|
109
|
+
*/
|
|
110
|
+
get image() {
|
|
111
|
+
if (!this.data.image) return null;
|
|
112
|
+
return {
|
|
113
|
+
url: this.data.image.url,
|
|
114
|
+
proxyURL: this.data.image.proxy_url,
|
|
115
|
+
height: this.data.image.height,
|
|
116
|
+
width: this.data.image.width,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* The video of this embed.
|
|
122
|
+
*
|
|
123
|
+
* @type {?EmbedAssetData}
|
|
124
|
+
* @readonly
|
|
125
|
+
*/
|
|
126
|
+
get video() {
|
|
127
|
+
if (!this.data.video) return null;
|
|
128
|
+
return {
|
|
129
|
+
url: this.data.video.url,
|
|
130
|
+
proxyURL: this.data.video.proxy_url,
|
|
131
|
+
height: this.data.video.height,
|
|
132
|
+
width: this.data.video.width,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @typedef {Object} EmbedAuthorData
|
|
138
|
+
* @property {string} name The name of the author
|
|
139
|
+
* @property {?string} url The URL of the author
|
|
140
|
+
* @property {?string} iconURL The icon URL of the author
|
|
141
|
+
* @property {?string} proxyIconURL The proxy icon URL of the author
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The author of this embed.
|
|
146
|
+
*
|
|
147
|
+
* @type {?EmbedAuthorData}
|
|
148
|
+
* @readonly
|
|
149
|
+
*/
|
|
150
|
+
get author() {
|
|
151
|
+
if (!this.data.author) return null;
|
|
152
|
+
return {
|
|
153
|
+
name: this.data.author.name,
|
|
154
|
+
url: this.data.author.url,
|
|
155
|
+
iconURL: this.data.author.icon_url,
|
|
156
|
+
proxyIconURL: this.data.author.proxy_icon_url,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* The provider of this embed.
|
|
162
|
+
*
|
|
163
|
+
* @type {?APIEmbedProvider}
|
|
164
|
+
* @readonly
|
|
165
|
+
*/
|
|
166
|
+
get provider() {
|
|
167
|
+
return this.data.provider ?? null;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @typedef {Object} EmbedFooterData
|
|
172
|
+
* @property {string} text The text of the footer
|
|
173
|
+
* @property {?string} iconURL The URL of the icon
|
|
174
|
+
* @property {?string} proxyIconURL The proxy URL of the icon
|
|
175
|
+
*/
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* The footer of this embed.
|
|
179
|
+
*
|
|
180
|
+
* @type {?EmbedFooterData}
|
|
181
|
+
* @readonly
|
|
182
|
+
*/
|
|
183
|
+
get footer() {
|
|
184
|
+
if (!this.data.footer) return null;
|
|
185
|
+
return {
|
|
186
|
+
text: this.data.footer.text,
|
|
187
|
+
iconURL: this.data.footer.icon_url,
|
|
188
|
+
proxyIconURL: this.data.footer.proxy_icon_url,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The accumulated length for the embed title, description, fields, footer text, and author name.
|
|
194
|
+
*
|
|
195
|
+
* @type {number}
|
|
196
|
+
* @readonly
|
|
197
|
+
*/
|
|
198
|
+
get length() {
|
|
199
|
+
return embedLength(this.data);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* The hex color of this embed.
|
|
204
|
+
*
|
|
205
|
+
* @type {?string}
|
|
206
|
+
* @readonly
|
|
207
|
+
*/
|
|
208
|
+
get hexColor() {
|
|
209
|
+
return typeof this.data.color === 'number'
|
|
210
|
+
? `#${this.data.color.toString(16).padStart(6, '0')}`
|
|
211
|
+
: (this.data.color ?? null);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Returns the API-compatible JSON for this embed.
|
|
216
|
+
*
|
|
217
|
+
* @returns {APIEmbed}
|
|
218
|
+
*/
|
|
219
|
+
toJSON() {
|
|
220
|
+
return { ...this.data };
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Whether the given embeds are equal.
|
|
225
|
+
*
|
|
226
|
+
* @param {Embed|APIEmbed} other The embed to compare against
|
|
227
|
+
* @returns {boolean}
|
|
228
|
+
*/
|
|
229
|
+
equals(other) {
|
|
230
|
+
if (other instanceof Embed) {
|
|
231
|
+
return isEqual(this.data, other.data);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return (
|
|
235
|
+
this.author?.iconURL === other.author?.icon_url &&
|
|
236
|
+
this.author?.name === other.author?.name &&
|
|
237
|
+
this.author?.url === other.author?.url &&
|
|
238
|
+
this.color === (other.color ?? null) &&
|
|
239
|
+
this.description === (other.description ?? null) &&
|
|
240
|
+
this.footer?.iconURL === other.footer?.icon_url &&
|
|
241
|
+
this.footer?.text === other.footer?.text &&
|
|
242
|
+
this.image?.url === other.image?.url &&
|
|
243
|
+
this.thumbnail?.url === other.thumbnail?.url &&
|
|
244
|
+
(this.timestamp && Date.parse(this.timestamp)) === (other.timestamp ? Date.parse(other.timestamp) : null) &&
|
|
245
|
+
this.title === (other.title ?? null) &&
|
|
246
|
+
this.url === (other.url ?? null) &&
|
|
247
|
+
this.video?.url === other.video?.url &&
|
|
248
|
+
isEqual(this.fields, other.fields?.map(field => ({ ...field, inline: field.inline ?? false })) ?? []) &&
|
|
249
|
+
isEqual(this.provider, other.provider ?? null)
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
exports.Embed = Embed;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { formatEmoji } = require('@discordjs/formatters');
|
|
4
|
+
const { DiscordSnowflake } = require('../util/LolkaSnowflake');
|
|
5
|
+
const { Base } = require('./Base.js');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Represents an emoji, see {@link ApplicationEmoji}, {@link GuildEmoji} and {@link ReactionEmoji}.
|
|
9
|
+
*
|
|
10
|
+
* @extends {Base}
|
|
11
|
+
*/
|
|
12
|
+
class Emoji extends Base {
|
|
13
|
+
constructor(client, emoji) {
|
|
14
|
+
super(client);
|
|
15
|
+
/**
|
|
16
|
+
* Whether or not the emoji is animated
|
|
17
|
+
*
|
|
18
|
+
* @type {?boolean}
|
|
19
|
+
*/
|
|
20
|
+
this.animated = emoji.animated ?? null;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The emoji's name
|
|
24
|
+
*
|
|
25
|
+
* @type {?string}
|
|
26
|
+
*/
|
|
27
|
+
this.name = emoji.name ?? null;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The emoji's id
|
|
31
|
+
*
|
|
32
|
+
* @type {?Snowflake}
|
|
33
|
+
*/
|
|
34
|
+
this.id = emoji.id ?? null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The identifier of this emoji, used for message reactions
|
|
39
|
+
*
|
|
40
|
+
* @type {string}
|
|
41
|
+
* @readonly
|
|
42
|
+
*/
|
|
43
|
+
get identifier() {
|
|
44
|
+
if (this.id) return `${this.animated ? 'a:' : ''}${this.name}:${this.id}`;
|
|
45
|
+
return encodeURIComponent(this.name);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Returns a URL for the emoji or `null` if this is not a custom emoji.
|
|
50
|
+
*
|
|
51
|
+
* @param {EmojiURLOptions} [options={}] Options for the emoji URL
|
|
52
|
+
* @returns {?string}
|
|
53
|
+
*/
|
|
54
|
+
imageURL(options = {}) {
|
|
55
|
+
if (!this.id) return null;
|
|
56
|
+
|
|
57
|
+
// Return a dynamic extension depending on whether the emoji is animated.
|
|
58
|
+
const resolvedOptions = { extension: options.extension, size: options.size };
|
|
59
|
+
|
|
60
|
+
if (!options.extension || options.extension === 'webp') {
|
|
61
|
+
resolvedOptions.animated = options.animated ?? (this.animated || undefined);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return this.client.rest.cdn.emoji(this.id, resolvedOptions);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The timestamp the emoji was created at, or null if unicode
|
|
69
|
+
*
|
|
70
|
+
* @type {?number}
|
|
71
|
+
* @readonly
|
|
72
|
+
*/
|
|
73
|
+
get createdTimestamp() {
|
|
74
|
+
return this.id && DiscordSnowflake.timestampFrom(this.id);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The time the emoji was created at, or null if unicode
|
|
79
|
+
*
|
|
80
|
+
* @type {?Date}
|
|
81
|
+
* @readonly
|
|
82
|
+
*/
|
|
83
|
+
get createdAt() {
|
|
84
|
+
return this.id && new Date(this.createdTimestamp);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* When concatenated with a string, this automatically returns the text required to form a graphical emoji on Discord
|
|
89
|
+
* instead of the Emoji object.
|
|
90
|
+
*
|
|
91
|
+
* @returns {string}
|
|
92
|
+
* @example
|
|
93
|
+
* // Send a custom emoji from a guild:
|
|
94
|
+
* const emoji = guild.emojis.cache.first();
|
|
95
|
+
* msg.channel.send(`Hello! ${emoji}`);
|
|
96
|
+
* @example
|
|
97
|
+
* // Send the emoji used in a reaction to the channel the reaction is part of
|
|
98
|
+
* reaction.message.channel.send(`The emoji used was: ${reaction.emoji}`);
|
|
99
|
+
*/
|
|
100
|
+
toString() {
|
|
101
|
+
return this.id ? formatEmoji({ animated: this.animated, id: this.id, name: this.name }) : this.name;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
toJSON() {
|
|
105
|
+
const json = super.toJSON({
|
|
106
|
+
guild: 'guildId',
|
|
107
|
+
createdTimestamp: true,
|
|
108
|
+
identifier: true,
|
|
109
|
+
});
|
|
110
|
+
json.imageURL = this.imageURL();
|
|
111
|
+
return json;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
exports.Emoji = Emoji;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { Base } = require('./Base.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents an Entitlement
|
|
7
|
+
*
|
|
8
|
+
* @extends {Base}
|
|
9
|
+
*/
|
|
10
|
+
class Entitlement extends Base {
|
|
11
|
+
constructor(client, data) {
|
|
12
|
+
super(client);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The id of the entitlement
|
|
16
|
+
*
|
|
17
|
+
* @type {Snowflake}
|
|
18
|
+
*/
|
|
19
|
+
this.id = data.id;
|
|
20
|
+
|
|
21
|
+
this._patch(data);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_patch(data) {
|
|
25
|
+
if ('sku_id' in data) {
|
|
26
|
+
/**
|
|
27
|
+
* The id of the associated SKU
|
|
28
|
+
*
|
|
29
|
+
* @type {Snowflake}
|
|
30
|
+
*/
|
|
31
|
+
this.skuId = data.sku_id;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if ('user_id' in data) {
|
|
35
|
+
/**
|
|
36
|
+
* The id of the user that is granted access to this entitlement's SKU
|
|
37
|
+
*
|
|
38
|
+
* @type {Snowflake}
|
|
39
|
+
*/
|
|
40
|
+
this.userId = data.user_id;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if ('guild_id' in data) {
|
|
44
|
+
/**
|
|
45
|
+
* The id of the guild that is granted access to this entitlement's SKU
|
|
46
|
+
*
|
|
47
|
+
* @type {?Snowflake}
|
|
48
|
+
*/
|
|
49
|
+
this.guildId = data.guild_id;
|
|
50
|
+
} else {
|
|
51
|
+
this.guildId ??= null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if ('application_id' in data) {
|
|
55
|
+
/**
|
|
56
|
+
* The id of the parent application
|
|
57
|
+
*
|
|
58
|
+
* @type {Snowflake}
|
|
59
|
+
*/
|
|
60
|
+
this.applicationId = data.application_id;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if ('type' in data) {
|
|
64
|
+
/**
|
|
65
|
+
* The type of this entitlement
|
|
66
|
+
*
|
|
67
|
+
* @type {EntitlementType}
|
|
68
|
+
*/
|
|
69
|
+
this.type = data.type;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if ('deleted' in data) {
|
|
73
|
+
/**
|
|
74
|
+
* Whether this entitlement was deleted
|
|
75
|
+
*
|
|
76
|
+
* @type {boolean}
|
|
77
|
+
*/
|
|
78
|
+
this.deleted = data.deleted;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if ('starts_at' in data) {
|
|
82
|
+
/**
|
|
83
|
+
* The timestamp at which this entitlement is valid
|
|
84
|
+
*
|
|
85
|
+
* @type {?number}
|
|
86
|
+
*/
|
|
87
|
+
this.startsTimestamp = data.starts_at ? Date.parse(data.starts_at) : null;
|
|
88
|
+
} else {
|
|
89
|
+
this.startsTimestamp ??= null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if ('ends_at' in data) {
|
|
93
|
+
/**
|
|
94
|
+
* The timestamp at which this entitlement is no longer valid
|
|
95
|
+
*
|
|
96
|
+
* @type {?number}
|
|
97
|
+
*/
|
|
98
|
+
this.endsTimestamp = data.ends_at ? Date.parse(data.ends_at) : null;
|
|
99
|
+
} else {
|
|
100
|
+
this.endsTimestamp ??= null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if ('consumed' in data) {
|
|
104
|
+
/**
|
|
105
|
+
* Whether this entitlement has been consumed
|
|
106
|
+
*
|
|
107
|
+
* @type {boolean}
|
|
108
|
+
*/
|
|
109
|
+
this.consumed = data.consumed;
|
|
110
|
+
} else {
|
|
111
|
+
this.consumed ??= false;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The guild that is granted access to this entitlement's SKU
|
|
117
|
+
*
|
|
118
|
+
* @type {?Guild}
|
|
119
|
+
*/
|
|
120
|
+
get guild() {
|
|
121
|
+
if (!this.guildId) return null;
|
|
122
|
+
return this.client.guilds.cache.get(this.guildId) ?? null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* The start date at which this entitlement is valid
|
|
127
|
+
*
|
|
128
|
+
* @type {?Date}
|
|
129
|
+
*/
|
|
130
|
+
get startsAt() {
|
|
131
|
+
return this.startsTimestamp && new Date(this.startsTimestamp);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The end date at which this entitlement is no longer valid
|
|
136
|
+
*
|
|
137
|
+
* @type {?Date}
|
|
138
|
+
*/
|
|
139
|
+
get endsAt() {
|
|
140
|
+
return this.endsTimestamp && new Date(this.endsTimestamp);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Indicates whether this entitlement is active
|
|
145
|
+
*
|
|
146
|
+
* @returns {boolean}
|
|
147
|
+
*/
|
|
148
|
+
isActive() {
|
|
149
|
+
return !this.deleted && (!this.endsTimestamp || this.endsTimestamp > Date.now());
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Indicates whether this entitlement is a test entitlement
|
|
154
|
+
*
|
|
155
|
+
* @returns {boolean}
|
|
156
|
+
*/
|
|
157
|
+
isTest() {
|
|
158
|
+
return this.startsTimestamp === null;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Indicates whether this entitlement is a user subscription
|
|
163
|
+
*
|
|
164
|
+
* @returns {boolean}
|
|
165
|
+
*/
|
|
166
|
+
isUserSubscription() {
|
|
167
|
+
return this.guildId === null;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Indicates whether this entitlement is a guild subscription
|
|
172
|
+
*
|
|
173
|
+
* @returns {boolean}
|
|
174
|
+
*/
|
|
175
|
+
isGuildSubscription() {
|
|
176
|
+
return this.guildId !== null;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Fetches the user that is granted access to this entitlement's SKU
|
|
181
|
+
*
|
|
182
|
+
* @returns {Promise<User>}
|
|
183
|
+
*/
|
|
184
|
+
async fetchUser() {
|
|
185
|
+
return this.client.users.fetch(this.userId);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Marks this entitlement as consumed
|
|
190
|
+
* <info>Only available for One-Time Purchase consumable SKUs.</info>
|
|
191
|
+
*
|
|
192
|
+
* @returns {Promise<void>}
|
|
193
|
+
*/
|
|
194
|
+
async consume() {
|
|
195
|
+
await this.client.application.entitlements.consume(this.id);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
exports.Entitlement = Entitlement;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { Component } = require('./Component.js');
|
|
4
|
+
const { UnfurledMediaItem } = require('./UnfurledMediaItem.js');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a file component
|
|
8
|
+
*
|
|
9
|
+
* @extends {Component}
|
|
10
|
+
*/
|
|
11
|
+
class FileComponent extends Component {
|
|
12
|
+
constructor({ file, ...data }) {
|
|
13
|
+
super(data);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The media associated with this file
|
|
17
|
+
*
|
|
18
|
+
* @type {UnfurledMediaItem}
|
|
19
|
+
* @readonly
|
|
20
|
+
*/
|
|
21
|
+
this.file = new UnfurledMediaItem(file);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Whether this thumbnail is spoilered
|
|
26
|
+
*
|
|
27
|
+
* @type {boolean}
|
|
28
|
+
* @readonly
|
|
29
|
+
*/
|
|
30
|
+
get spoiler() {
|
|
31
|
+
return this.data.spoiler ?? false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Returns the API-compatible JSON for this component
|
|
36
|
+
*
|
|
37
|
+
* @returns {APIFileComponent}
|
|
38
|
+
*/
|
|
39
|
+
toJSON() {
|
|
40
|
+
return { ...this.data, file: this.file.toJSON() };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
exports.FileComponent = FileComponent;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { ThreadOnlyChannel } = require('./ThreadOnlyChannel.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents a forum channel.
|
|
7
|
+
*
|
|
8
|
+
* @extends {ThreadOnlyChannel}
|
|
9
|
+
*/
|
|
10
|
+
class ForumChannel extends ThreadOnlyChannel {
|
|
11
|
+
_patch(data) {
|
|
12
|
+
super._patch(data);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The default layout type used to display posts
|
|
16
|
+
*
|
|
17
|
+
* @type {ForumLayoutType}
|
|
18
|
+
*/
|
|
19
|
+
this.defaultForumLayout = data.default_forum_layout;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Sets the default forum layout type used to display posts
|
|
24
|
+
*
|
|
25
|
+
* @param {ForumLayoutType} defaultForumLayout The default forum layout type to set on this channel
|
|
26
|
+
* @param {string} [reason] Reason for changing the default forum layout
|
|
27
|
+
* @returns {Promise<ForumChannel>}
|
|
28
|
+
*/
|
|
29
|
+
async setDefaultForumLayout(defaultForumLayout, reason) {
|
|
30
|
+
return this.edit({ defaultForumLayout, reason });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
exports.ForumChannel = ForumChannel;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { BaseInvite } = require('./BaseInvite.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A channel invite leading to a group direct message channel.
|
|
7
|
+
*
|
|
8
|
+
* @extends {BaseInvite}
|
|
9
|
+
*/
|
|
10
|
+
class GroupDMInvite extends BaseInvite {
|
|
11
|
+
/**
|
|
12
|
+
* The approximate total number of members of in the group direct message channel.
|
|
13
|
+
* <info>This is only available when the invite was fetched through {@link Client#fetchInvite}.</info>
|
|
14
|
+
*
|
|
15
|
+
* @name GroupDMInvite#approximateMemberCount
|
|
16
|
+
* @type {?number}
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
_patch(data) {
|
|
20
|
+
super._patch(data);
|
|
21
|
+
|
|
22
|
+
if ('channel' in data) {
|
|
23
|
+
/**
|
|
24
|
+
* The channel this invite is for.
|
|
25
|
+
*
|
|
26
|
+
* @type {?PartialGroupDMChannel}
|
|
27
|
+
*/
|
|
28
|
+
this.channel =
|
|
29
|
+
this.client.channels._add(data.channel, null, { cache: false }) ??
|
|
30
|
+
this.client.channels.cache.get(this.channelId);
|
|
31
|
+
|
|
32
|
+
this.channelId ??= data.channel.id;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
exports.GroupDMInvite = GroupDMInvite;
|