@ovencord/discord.js 14.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +191 -0
- package/README.md +148 -0
- package/package.json +73 -0
- package/src/client/Client.ts +967 -0
- package/src/client/actions/Action.ts +141 -0
- package/src/client/actions/ActionsManager.ts +138 -0
- package/src/client/actions/ChannelCreate.ts +21 -0
- package/src/client/actions/ChannelDelete.ts +20 -0
- package/src/client/actions/ChannelUpdate.ts +38 -0
- package/src/client/actions/GuildChannelsPositionUpdate.ts +17 -0
- package/src/client/actions/GuildEmojiCreate.ts +17 -0
- package/src/client/actions/GuildEmojiDelete.ts +16 -0
- package/src/client/actions/GuildEmojiUpdate.ts +17 -0
- package/src/client/actions/GuildEmojisUpdate.ts +30 -0
- package/src/client/actions/GuildMemberRemove.ts +29 -0
- package/src/client/actions/GuildMemberUpdate.ts +41 -0
- package/src/client/actions/GuildRoleCreate.ts +23 -0
- package/src/client/actions/GuildRoleDelete.ts +26 -0
- package/src/client/actions/GuildRolesPositionUpdate.ts +17 -0
- package/src/client/actions/GuildScheduledEventDelete.ts +28 -0
- package/src/client/actions/GuildScheduledEventUserAdd.ts +29 -0
- package/src/client/actions/GuildScheduledEventUserRemove.ts +29 -0
- package/src/client/actions/GuildSoundboardSoundDelete.ts +26 -0
- package/src/client/actions/GuildStickerCreate.ts +17 -0
- package/src/client/actions/GuildStickerDelete.ts +16 -0
- package/src/client/actions/GuildStickerUpdate.ts +17 -0
- package/src/client/actions/GuildStickersUpdate.ts +30 -0
- package/src/client/actions/GuildUpdate.ts +30 -0
- package/src/client/actions/InteractionCreate.ts +104 -0
- package/src/client/actions/MessageCreate.ts +38 -0
- package/src/client/actions/MessageDelete.ts +29 -0
- package/src/client/actions/MessageDeleteBulk.ts +45 -0
- package/src/client/actions/MessagePollVoteAdd.ts +37 -0
- package/src/client/actions/MessagePollVoteRemove.ts +35 -0
- package/src/client/actions/MessageReactionAdd.ts +68 -0
- package/src/client/actions/MessageReactionRemove.ts +47 -0
- package/src/client/actions/MessageReactionRemoveAll.ts +30 -0
- package/src/client/actions/MessageReactionRemoveEmoji.ts +25 -0
- package/src/client/actions/MessageUpdate.ts +22 -0
- package/src/client/actions/StageInstanceCreate.ts +25 -0
- package/src/client/actions/StageInstanceDelete.ts +28 -0
- package/src/client/actions/StageInstanceUpdate.ts +27 -0
- package/src/client/actions/ThreadCreate.ts +22 -0
- package/src/client/actions/ThreadMembersUpdate.ts +45 -0
- package/src/client/actions/TypingStart.ts +26 -0
- package/src/client/actions/UserUpdate.ts +33 -0
- package/src/client/voice/ClientVoiceManager.ts +46 -0
- package/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.ts +19 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_ACTION_EXECUTION.ts +17 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_CREATE.ts +18 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_DELETE.ts +21 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_UPDATE.ts +20 -0
- package/src/client/websocket/handlers/CHANNEL_CREATE.ts +4 -0
- package/src/client/websocket/handlers/CHANNEL_DELETE.ts +4 -0
- package/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.ts +22 -0
- package/src/client/websocket/handlers/CHANNEL_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/ENTITLEMENT_CREATE.ts +14 -0
- package/src/client/websocket/handlers/ENTITLEMENT_DELETE.ts +18 -0
- package/src/client/websocket/handlers/ENTITLEMENT_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.ts +19 -0
- package/src/client/websocket/handlers/GUILD_BAN_ADD.ts +15 -0
- package/src/client/websocket/handlers/GUILD_BAN_REMOVE.ts +20 -0
- package/src/client/websocket/handlers/GUILD_CREATE.ts +34 -0
- package/src/client/websocket/handlers/GUILD_DELETE.ts +36 -0
- package/src/client/websocket/handlers/GUILD_EMOJIS_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.ts +15 -0
- package/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.ts +40 -0
- package/src/client/websocket/handlers/GUILD_MEMBER_ADD.ts +17 -0
- package/src/client/websocket/handlers/GUILD_MEMBER_REMOVE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_MEMBER_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_ROLE_CREATE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_ROLE_DELETE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_ROLE_UPDATE.ts +21 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_CREATE.ts +17 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_DELETE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_UPDATE.ts +19 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_ADD.ts +4 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_REMOVE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUNDS_UPDATE.ts +24 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_CREATE.ts +18 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_DELETE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_UPDATE.ts +20 -0
- package/src/client/websocket/handlers/GUILD_STICKERS_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/INTERACTION_CREATE.ts +4 -0
- package/src/client/websocket/handlers/INVITE_CREATE.ts +20 -0
- package/src/client/websocket/handlers/INVITE_DELETE.ts +23 -0
- package/src/client/websocket/handlers/MESSAGE_CREATE.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_DELETE.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_DELETE_BULK.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_POLL_VOTE_ADD.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_POLL_VOTE_REMOVE.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_ADD.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_ALL.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_EMOJI.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/PRESENCE_UPDATE.ts +42 -0
- package/src/client/websocket/handlers/RATE_LIMITED.ts +23 -0
- package/src/client/websocket/handlers/READY.ts +29 -0
- package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.ts +24 -0
- package/src/client/websocket/handlers/STAGE_INSTANCE_CREATE.ts +4 -0
- package/src/client/websocket/handlers/STAGE_INSTANCE_DELETE.ts +4 -0
- package/src/client/websocket/handlers/STAGE_INSTANCE_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/SUBSCRIPTION_CREATE.ts +14 -0
- package/src/client/websocket/handlers/SUBSCRIPTION_DELETE.ts +16 -0
- package/src/client/websocket/handlers/SUBSCRIPTION_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/THREAD_CREATE.ts +4 -0
- package/src/client/websocket/handlers/THREAD_DELETE.ts +17 -0
- package/src/client/websocket/handlers/THREAD_LIST_SYNC.ts +50 -0
- package/src/client/websocket/handlers/THREAD_MEMBERS_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/THREAD_MEMBER_UPDATE.ts +25 -0
- package/src/client/websocket/handlers/THREAD_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/TYPING_START.ts +4 -0
- package/src/client/websocket/handlers/USER_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.ts +16 -0
- package/src/client/websocket/handlers/VOICE_SERVER_UPDATE.ts +5 -0
- package/src/client/websocket/handlers/VOICE_STATE_UPDATE.ts +37 -0
- package/src/client/websocket/handlers/WEBHOOKS_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/index.ts +74 -0
- package/src/errors/DJSError.ts +50 -0
- package/src/errors/ErrorCodes.ts +277 -0
- package/src/errors/Messages.ts +155 -0
- package/src/errors/index.ts +6 -0
- package/src/index.ts +241 -0
- package/src/managers/ApplicationCommandManager.ts +303 -0
- package/src/managers/ApplicationCommandPermissionsManager.ts +453 -0
- package/src/managers/ApplicationEmojiManager.ts +149 -0
- package/src/managers/AutoModerationRuleManager.ts +307 -0
- package/src/managers/BaseManager.ts +13 -0
- package/src/managers/CachedManager.ts +56 -0
- package/src/managers/CategoryChannelChildManager.ts +81 -0
- package/src/managers/ChannelManager.ts +194 -0
- package/src/managers/DMMessageManager.ts +15 -0
- package/src/managers/DataManager.ts +38 -0
- package/src/managers/EntitlementManager.ts +182 -0
- package/src/managers/GuildApplicationCommandManager.ts +29 -0
- package/src/managers/GuildBanManager.ts +221 -0
- package/src/managers/GuildChannelManager.ts +552 -0
- package/src/managers/GuildEmojiManager.ts +262 -0
- package/src/managers/GuildEmojiRoleManager.ts +134 -0
- package/src/managers/GuildForumThreadManager.ts +84 -0
- package/src/managers/GuildInviteManager.ts +236 -0
- package/src/managers/GuildManager.ts +265 -0
- package/src/managers/GuildMemberManager.ts +619 -0
- package/src/managers/GuildMemberRoleManager.ts +230 -0
- package/src/managers/GuildMessageManager.ts +31 -0
- package/src/managers/GuildScheduledEventManager.ts +330 -0
- package/src/managers/GuildSoundboardSoundManager.ts +157 -0
- package/src/managers/GuildStickerManager.ts +192 -0
- package/src/managers/GuildTextThreadManager.ts +91 -0
- package/src/managers/MessageManager.ts +352 -0
- package/src/managers/PartialGroupDMMessageManager.ts +15 -0
- package/src/managers/PermissionOverwriteManager.ts +174 -0
- package/src/managers/PollAnswerVoterManager.ts +59 -0
- package/src/managers/PresenceManager.ts +60 -0
- package/src/managers/ReactionManager.ts +72 -0
- package/src/managers/ReactionUserManager.ts +82 -0
- package/src/managers/RoleManager.ts +432 -0
- package/src/managers/StageInstanceManager.ts +166 -0
- package/src/managers/SubscriptionManager.ts +83 -0
- package/src/managers/ThreadManager.ts +210 -0
- package/src/managers/ThreadMemberManager.ts +194 -0
- package/src/managers/UserManager.ts +139 -0
- package/src/managers/VoiceStateManager.ts +61 -0
- package/src/sharding/Shard.ts +513 -0
- package/src/sharding/ShardClientUtil.ts +293 -0
- package/src/sharding/ShardingManager.ts +374 -0
- package/src/structures/ActionRow.ts +31 -0
- package/src/structures/AnnouncementChannel.ts +25 -0
- package/src/structures/AnonymousGuild.ts +110 -0
- package/src/structures/ApplicationCommand.ts +675 -0
- package/src/structures/ApplicationEmoji.ts +189 -0
- package/src/structures/ApplicationRoleConnectionMetadata.ts +54 -0
- package/src/structures/Attachment.ts +189 -0
- package/src/structures/AuthorizingIntegrationOwners.ts +63 -0
- package/src/structures/AutoModerationActionExecution.ts +138 -0
- package/src/structures/AutoModerationRule.ts +325 -0
- package/src/structures/AutocompleteInteraction.ts +115 -0
- package/src/structures/Base.ts +37 -0
- package/src/structures/BaseChannel.ts +188 -0
- package/src/structures/BaseGuild.ts +134 -0
- package/src/structures/BaseGuildEmoji.ts +113 -0
- package/src/structures/BaseGuildTextChannel.ts +230 -0
- package/src/structures/BaseGuildVoiceChannel.ts +270 -0
- package/src/structures/BaseInteraction.ts +393 -0
- package/src/structures/BaseInvite.ts +192 -0
- package/src/structures/BaseSelectMenuComponent.ts +58 -0
- package/src/structures/ButtonComponent.ts +68 -0
- package/src/structures/ButtonInteraction.ts +8 -0
- package/src/structures/CategoryChannel.ts +46 -0
- package/src/structures/ChannelSelectMenuComponent.ts +18 -0
- package/src/structures/ChannelSelectMenuInteraction.ts +34 -0
- package/src/structures/ChatInputCommandInteraction.ts +43 -0
- package/src/structures/ClientApplication.ts +470 -0
- package/src/structures/ClientPresence.ts +87 -0
- package/src/structures/ClientUser.ts +219 -0
- package/src/structures/CommandInteraction.ts +193 -0
- package/src/structures/CommandInteractionOptionResolver.ts +336 -0
- package/src/structures/Component.ts +59 -0
- package/src/structures/ContainerComponent.ts +63 -0
- package/src/structures/ContextMenuCommandInteraction.ts +68 -0
- package/src/structures/DMChannel.ts +148 -0
- package/src/structures/DirectoryChannel.ts +40 -0
- package/src/structures/Embed.ts +251 -0
- package/src/structures/Emoji.ts +61 -0
- package/src/structures/Entitlement.ts +206 -0
- package/src/structures/FileComponent.ts +41 -0
- package/src/structures/ForumChannel.ts +31 -0
- package/src/structures/GroupDMInvite.ts +34 -0
- package/src/structures/Guild.ts +1605 -0
- package/src/structures/GuildAuditLogs.ts +99 -0
- package/src/structures/GuildAuditLogsEntry.ts +557 -0
- package/src/structures/GuildBan.ts +65 -0
- package/src/structures/GuildChannel.ts +515 -0
- package/src/structures/GuildEmoji.ts +159 -0
- package/src/structures/GuildInvite.ts +233 -0
- package/src/structures/GuildMember.ts +643 -0
- package/src/structures/GuildOnboarding.ts +73 -0
- package/src/structures/GuildOnboardingPrompt.ts +93 -0
- package/src/structures/GuildOnboardingPromptOption.ts +100 -0
- package/src/structures/GuildPreview.ts +218 -0
- package/src/structures/GuildPreviewEmoji.ts +28 -0
- package/src/structures/GuildScheduledEvent.ts +593 -0
- package/src/structures/GuildTemplate.ts +229 -0
- package/src/structures/Integration.ts +257 -0
- package/src/structures/IntegrationApplication.ts +84 -0
- package/src/structures/InteractionCallback.ts +86 -0
- package/src/structures/InteractionCallbackResource.ts +57 -0
- package/src/structures/InteractionCallbackResponse.ts +35 -0
- package/src/structures/InteractionCollector.ts +260 -0
- package/src/structures/InteractionWebhook.ts +65 -0
- package/src/structures/InviteGuild.ts +22 -0
- package/src/structures/LabelComponent.ts +51 -0
- package/src/structures/MediaChannel.ts +8 -0
- package/src/structures/MediaGalleryComponent.ts +31 -0
- package/src/structures/MediaGalleryItem.ts +54 -0
- package/src/structures/MentionableSelectMenuComponent.ts +8 -0
- package/src/structures/MentionableSelectMenuInteraction.ts +76 -0
- package/src/structures/Message.ts +1202 -0
- package/src/structures/MessageCollector.ts +155 -0
- package/src/structures/MessageComponentInteraction.ts +132 -0
- package/src/structures/MessageContextMenuCommandInteraction.ts +18 -0
- package/src/structures/MessageMentions.ts +327 -0
- package/src/structures/MessagePayload.ts +325 -0
- package/src/structures/MessageReaction.ts +219 -0
- package/src/structures/ModalComponentResolver.ts +237 -0
- package/src/structures/ModalSubmitInteraction.ts +260 -0
- package/src/structures/OAuth2Guild.ts +30 -0
- package/src/structures/PartialGroupDMChannel.ts +151 -0
- package/src/structures/PermissionOverwrites.ts +222 -0
- package/src/structures/Poll.ts +195 -0
- package/src/structures/PollAnswer.ts +100 -0
- package/src/structures/Presence.ts +448 -0
- package/src/structures/PrimaryEntryPointCommandInteraction.ts +8 -0
- package/src/structures/ReactionCollector.ts +245 -0
- package/src/structures/ReactionEmoji.ts +30 -0
- package/src/structures/Role.ts +543 -0
- package/src/structures/RoleSelectMenuComponent.ts +8 -0
- package/src/structures/RoleSelectMenuInteraction.ts +34 -0
- package/src/structures/SKU.ts +62 -0
- package/src/structures/SectionComponent.ts +44 -0
- package/src/structures/SeparatorComponent.ts +29 -0
- package/src/structures/SoundboardSound.ts +176 -0
- package/src/structures/StageChannel.ts +118 -0
- package/src/structures/StageInstance.ts +173 -0
- package/src/structures/Sticker.ts +300 -0
- package/src/structures/StickerPack.ts +111 -0
- package/src/structures/StringSelectMenuComponent.ts +18 -0
- package/src/structures/StringSelectMenuInteraction.ts +21 -0
- package/src/structures/Subscription.ts +138 -0
- package/src/structures/Team.ts +131 -0
- package/src/structures/TeamMember.ts +77 -0
- package/src/structures/TextChannel.ts +33 -0
- package/src/structures/TextDisplayComponent.ts +18 -0
- package/src/structures/TextInputComponent.ts +28 -0
- package/src/structures/ThreadChannel.ts +680 -0
- package/src/structures/ThreadMember.ts +125 -0
- package/src/structures/ThreadOnlyChannel.ts +276 -0
- package/src/structures/ThumbnailComponent.ts +51 -0
- package/src/structures/Typing.ts +81 -0
- package/src/structures/UnfurledMediaItem.ts +33 -0
- package/src/structures/User.ts +511 -0
- package/src/structures/UserContextMenuCommandInteraction.ts +28 -0
- package/src/structures/UserSelectMenuComponent.ts +8 -0
- package/src/structures/UserSelectMenuInteraction.ts +54 -0
- package/src/structures/VoiceChannel.ts +119 -0
- package/src/structures/VoiceChannelEffect.ts +92 -0
- package/src/structures/VoiceRegion.ts +52 -0
- package/src/structures/VoiceState.ts +346 -0
- package/src/structures/Webhook.ts +526 -0
- package/src/structures/WelcomeChannel.ts +67 -0
- package/src/structures/WelcomeScreen.ts +53 -0
- package/src/structures/Widget.ts +110 -0
- package/src/structures/WidgetMember.ts +124 -0
- package/src/structures/interfaces/Application.ts +179 -0
- package/src/structures/interfaces/Collector.ts +372 -0
- package/src/structures/interfaces/InteractionResponses.ts +384 -0
- package/src/structures/interfaces/TextBasedChannel.ts +430 -0
- package/src/util/APITypes.ts +690 -0
- package/src/util/ActivityFlagsBitField.ts +26 -0
- package/src/util/ApplicationFlagsBitField.ts +43 -0
- package/src/util/AttachmentFlagsBitField.ts +26 -0
- package/src/util/BitField.ts +178 -0
- package/src/util/ChannelFlagsBitField.ts +43 -0
- package/src/util/Channels.ts +165 -0
- package/src/util/Colors.ts +72 -0
- package/src/util/Components.ts +285 -0
- package/src/util/Constants.ts +251 -0
- package/src/util/DataResolver.ts +146 -0
- package/src/util/Enums.ts +10 -0
- package/src/util/Events.ts +178 -0
- package/src/util/GuildMemberFlagsBitField.ts +43 -0
- package/src/util/IntentsBitField.ts +35 -0
- package/src/util/InviteFlagsBitField.ts +26 -0
- package/src/util/Invites.ts +27 -0
- package/src/util/LimitedCollection.ts +73 -0
- package/src/util/MessageFlagsBitField.ts +43 -0
- package/src/util/Options.ts +215 -0
- package/src/util/Partials.ts +50 -0
- package/src/util/PermissionsBitField.ts +113 -0
- package/src/util/RoleFlagsBitField.ts +26 -0
- package/src/util/SKUFlagsBitField.ts +26 -0
- package/src/util/ShardEvents.ts +26 -0
- package/src/util/Status.ts +16 -0
- package/src/util/Sweepers.ts +532 -0
- package/src/util/Symbols.ts +1 -0
- package/src/util/SystemChannelFlagsBitField.ts +45 -0
- package/src/util/ThreadMemberFlagsBitField.ts +33 -0
- package/src/util/Transformers.ts +123 -0
- package/src/util/UserFlagsBitField.ts +33 -0
- package/src/util/Util.ts +519 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { embedLength } from '@ovencord/util';
|
|
2
|
+
import isEqual from 'fast-deep-equal';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents an embed.
|
|
6
|
+
*/
|
|
7
|
+
export class Embed {
|
|
8
|
+
public data: any;
|
|
9
|
+
constructor(data) {
|
|
10
|
+
/**
|
|
11
|
+
* The API embed data.
|
|
12
|
+
*
|
|
13
|
+
* @type {APIEmbed}
|
|
14
|
+
* @readonly
|
|
15
|
+
*/
|
|
16
|
+
this.data = { ...data };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* An array of fields of this embed.
|
|
21
|
+
*
|
|
22
|
+
* @type {Array<APIEmbedField>}
|
|
23
|
+
* @readonly
|
|
24
|
+
*/
|
|
25
|
+
get fields() {
|
|
26
|
+
return this.data.fields ?? [];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The title of this embed.
|
|
31
|
+
*
|
|
32
|
+
* @type {?string}
|
|
33
|
+
* @readonly
|
|
34
|
+
*/
|
|
35
|
+
get title() {
|
|
36
|
+
return this.data.title ?? null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The description of this embed.
|
|
41
|
+
*
|
|
42
|
+
* @type {?string}
|
|
43
|
+
* @readonly
|
|
44
|
+
*/
|
|
45
|
+
get description() {
|
|
46
|
+
return this.data.description ?? null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The URL of this embed.
|
|
51
|
+
*
|
|
52
|
+
* @type {?string}
|
|
53
|
+
* @readonly
|
|
54
|
+
*/
|
|
55
|
+
get url() {
|
|
56
|
+
return this.data.url ?? null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The color of this embed.
|
|
61
|
+
*
|
|
62
|
+
* @type {?number}
|
|
63
|
+
* @readonly
|
|
64
|
+
*/
|
|
65
|
+
get color() {
|
|
66
|
+
return this.data.color ?? null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The timestamp of this embed. This is in an ISO 8601 format.
|
|
71
|
+
*
|
|
72
|
+
* @type {?string}
|
|
73
|
+
* @readonly
|
|
74
|
+
*/
|
|
75
|
+
get timestamp() {
|
|
76
|
+
return this.data.timestamp ?? null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @typedef {Object} EmbedAssetData
|
|
81
|
+
* @property {?string} url The URL of the image
|
|
82
|
+
* @property {?string} proxyURL The proxy URL of the image
|
|
83
|
+
* @property {?number} height The height of the image
|
|
84
|
+
* @property {?number} width The width of the image
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The thumbnail of this embed.
|
|
89
|
+
*
|
|
90
|
+
* @type {?EmbedAssetData}
|
|
91
|
+
* @readonly
|
|
92
|
+
*/
|
|
93
|
+
get thumbnail() {
|
|
94
|
+
if (!this.data.thumbnail) return null;
|
|
95
|
+
return {
|
|
96
|
+
url: this.data.thumbnail.url,
|
|
97
|
+
proxyURL: this.data.thumbnail.proxy_url,
|
|
98
|
+
height: this.data.thumbnail.height,
|
|
99
|
+
width: this.data.thumbnail.width,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The image of this embed.
|
|
105
|
+
*
|
|
106
|
+
* @type {?EmbedAssetData}
|
|
107
|
+
* @readonly
|
|
108
|
+
*/
|
|
109
|
+
get image() {
|
|
110
|
+
if (!this.data.image) return null;
|
|
111
|
+
return {
|
|
112
|
+
url: this.data.image.url,
|
|
113
|
+
proxyURL: this.data.image.proxy_url,
|
|
114
|
+
height: this.data.image.height,
|
|
115
|
+
width: this.data.image.width,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The video of this embed.
|
|
121
|
+
*
|
|
122
|
+
* @type {?EmbedAssetData}
|
|
123
|
+
* @readonly
|
|
124
|
+
*/
|
|
125
|
+
get video() {
|
|
126
|
+
if (!this.data.video) return null;
|
|
127
|
+
return {
|
|
128
|
+
url: this.data.video.url,
|
|
129
|
+
proxyURL: this.data.video.proxy_url,
|
|
130
|
+
height: this.data.video.height,
|
|
131
|
+
width: this.data.video.width,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @typedef {Object} EmbedAuthorData
|
|
137
|
+
* @property {string} name The name of the author
|
|
138
|
+
* @property {?string} url The URL of the author
|
|
139
|
+
* @property {?string} iconURL The icon URL of the author
|
|
140
|
+
* @property {?string} proxyIconURL The proxy icon URL of the author
|
|
141
|
+
*/
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The author of this embed.
|
|
145
|
+
*
|
|
146
|
+
* @type {?EmbedAuthorData}
|
|
147
|
+
* @readonly
|
|
148
|
+
*/
|
|
149
|
+
get author() {
|
|
150
|
+
if (!this.data.author) return null;
|
|
151
|
+
return {
|
|
152
|
+
name: this.data.author.name,
|
|
153
|
+
url: this.data.author.url,
|
|
154
|
+
iconURL: this.data.author.icon_url,
|
|
155
|
+
proxyIconURL: this.data.author.proxy_icon_url,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The provider of this embed.
|
|
161
|
+
*
|
|
162
|
+
* @type {?APIEmbedProvider}
|
|
163
|
+
* @readonly
|
|
164
|
+
*/
|
|
165
|
+
get provider() {
|
|
166
|
+
return this.data.provider ?? null;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* @typedef {Object} EmbedFooterData
|
|
171
|
+
* @property {string} text The text of the footer
|
|
172
|
+
* @property {?string} iconURL The URL of the icon
|
|
173
|
+
* @property {?string} proxyIconURL The proxy URL of the icon
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The footer of this embed.
|
|
178
|
+
*
|
|
179
|
+
* @type {?EmbedFooterData}
|
|
180
|
+
* @readonly
|
|
181
|
+
*/
|
|
182
|
+
get footer() {
|
|
183
|
+
if (!this.data.footer) return null;
|
|
184
|
+
return {
|
|
185
|
+
text: this.data.footer.text,
|
|
186
|
+
iconURL: this.data.footer.icon_url,
|
|
187
|
+
proxyIconURL: this.data.footer.proxy_icon_url,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* The accumulated length for the embed title, description, fields, footer text, and author name.
|
|
193
|
+
*
|
|
194
|
+
* @type {number}
|
|
195
|
+
* @readonly
|
|
196
|
+
*/
|
|
197
|
+
get length() {
|
|
198
|
+
return embedLength(this.data);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* The hex color of this embed.
|
|
203
|
+
*
|
|
204
|
+
* @type {?string}
|
|
205
|
+
* @readonly
|
|
206
|
+
*/
|
|
207
|
+
get hexColor() {
|
|
208
|
+
return typeof this.data.color === 'number'
|
|
209
|
+
? `#${this.data.color.toString(16).padStart(6, '0')}`
|
|
210
|
+
: (this.data.color ?? null);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Returns the API-compatible JSON for this embed.
|
|
215
|
+
*
|
|
216
|
+
* @returns {APIEmbed}
|
|
217
|
+
*/
|
|
218
|
+
toJSON() {
|
|
219
|
+
return { ...this.data };
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Whether the given embeds are equal.
|
|
224
|
+
*
|
|
225
|
+
* @param {Embed|APIEmbed} other The embed to compare against
|
|
226
|
+
* @returns {boolean}
|
|
227
|
+
*/
|
|
228
|
+
equals(other) {
|
|
229
|
+
if (other instanceof Embed) {
|
|
230
|
+
return isEqual(this.data, other.data);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return (
|
|
234
|
+
this.author?.iconURL === other.author?.icon_url &&
|
|
235
|
+
this.author?.name === other.author?.name &&
|
|
236
|
+
this.author?.url === other.author?.url &&
|
|
237
|
+
this.color === (other.color ?? null) &&
|
|
238
|
+
this.description === (other.description ?? null) &&
|
|
239
|
+
this.footer?.iconURL === other.footer?.icon_url &&
|
|
240
|
+
this.footer?.text === other.footer?.text &&
|
|
241
|
+
this.image?.url === other.image?.url &&
|
|
242
|
+
this.thumbnail?.url === other.thumbnail?.url &&
|
|
243
|
+
(this.timestamp && Date.parse(this.timestamp)) === (other.timestamp ? Date.parse(other.timestamp) : null) &&
|
|
244
|
+
this.title === (other.title ?? null) &&
|
|
245
|
+
this.url === (other.url ?? null) &&
|
|
246
|
+
this.video?.url === other.video?.url &&
|
|
247
|
+
isEqual(this.fields, other.fields?.map(field => ({ ...field, inline: field.inline ?? false })) ?? []) &&
|
|
248
|
+
isEqual(this.provider, other.provider ?? null)
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
|
|
2
|
+
import { formatEmoji } from '@ovencord/formatters';
|
|
3
|
+
import { DiscordSnowflake } from '@sapphire/snowflake';
|
|
4
|
+
import { Base } from './Base.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents an emoji, see {@link ApplicationEmoji}, {@link GuildEmoji} and {@link ReactionEmoji}.
|
|
8
|
+
*
|
|
9
|
+
* @extends {Base}
|
|
10
|
+
*/
|
|
11
|
+
export class Emoji extends Base {
|
|
12
|
+
public animated: boolean | null;
|
|
13
|
+
public name: string | null;
|
|
14
|
+
public id: string | null;
|
|
15
|
+
|
|
16
|
+
constructor(client: any, emoji: any) {
|
|
17
|
+
super(client);
|
|
18
|
+
this.animated = emoji.animated ?? null;
|
|
19
|
+
this.name = emoji.name ?? null;
|
|
20
|
+
this.id = emoji.id ?? null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get identifier(): string {
|
|
24
|
+
if (this.id) return `${this.animated ? 'a:' : ''}${this.name}:${this.id}`;
|
|
25
|
+
return encodeURIComponent(this.name!);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
imageURL(options: any = {}): string | null {
|
|
29
|
+
if (!this.id) return null;
|
|
30
|
+
|
|
31
|
+
const resolvedOptions = { extension: options.extension, size: options.size, animated: undefined as boolean | undefined };
|
|
32
|
+
|
|
33
|
+
if (!options.extension || options.extension === 'webp') {
|
|
34
|
+
resolvedOptions.animated = options.animated ?? (this.animated || undefined);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return (this.client as any).rest.cdn.emoji(this.id, resolvedOptions);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get createdTimestamp(): number | null {
|
|
41
|
+
return this.id ? DiscordSnowflake.timestampFrom(this.id) : null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
get createdAt(): Date | null {
|
|
45
|
+
return this.id ? new Date(this.createdTimestamp!) : null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override toString(): string {
|
|
49
|
+
return this.id ? formatEmoji({ animated: this.animated as boolean, id: this.id, name: this.name as string }) : this.name!;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
override toJSON(): any {
|
|
53
|
+
const json = super.toJSON({
|
|
54
|
+
guild: 'guildId',
|
|
55
|
+
createdTimestamp: true,
|
|
56
|
+
identifier: true,
|
|
57
|
+
});
|
|
58
|
+
json.imageURL = this.imageURL();
|
|
59
|
+
return json;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { Base } from './Base.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents an Entitlement
|
|
5
|
+
*
|
|
6
|
+
* @extends {Base}
|
|
7
|
+
*/
|
|
8
|
+
export class Entitlement extends Base {
|
|
9
|
+
public client: any;
|
|
10
|
+
public id: any;
|
|
11
|
+
public skuId: any;
|
|
12
|
+
public userId: any;
|
|
13
|
+
public guildId: any;
|
|
14
|
+
public applicationId: any;
|
|
15
|
+
public type: any;
|
|
16
|
+
public deleted: any;
|
|
17
|
+
public startsTimestamp: any;
|
|
18
|
+
public endsTimestamp: any;
|
|
19
|
+
public consumed: any;
|
|
20
|
+
constructor(client, data) {
|
|
21
|
+
super(client);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The id of the entitlement
|
|
25
|
+
*
|
|
26
|
+
* @type {Snowflake}
|
|
27
|
+
*/
|
|
28
|
+
this.id = data.id;
|
|
29
|
+
|
|
30
|
+
this._patch(data);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_patch(data) {
|
|
34
|
+
if ('sku_id' in data) {
|
|
35
|
+
/**
|
|
36
|
+
* The id of the associated SKU
|
|
37
|
+
*
|
|
38
|
+
* @type {Snowflake}
|
|
39
|
+
*/
|
|
40
|
+
this.skuId = data.sku_id;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if ('user_id' in data) {
|
|
44
|
+
/**
|
|
45
|
+
* The id of the user that is granted access to this entitlement's SKU
|
|
46
|
+
*
|
|
47
|
+
* @type {Snowflake}
|
|
48
|
+
*/
|
|
49
|
+
this.userId = data.user_id;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if ('guild_id' in data) {
|
|
53
|
+
/**
|
|
54
|
+
* The id of the guild that is granted access to this entitlement's SKU
|
|
55
|
+
*
|
|
56
|
+
* @type {?Snowflake}
|
|
57
|
+
*/
|
|
58
|
+
this.guildId = data.guild_id;
|
|
59
|
+
} else {
|
|
60
|
+
this.guildId ??= null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if ('application_id' in data) {
|
|
64
|
+
/**
|
|
65
|
+
* The id of the parent application
|
|
66
|
+
*
|
|
67
|
+
* @type {Snowflake}
|
|
68
|
+
*/
|
|
69
|
+
this.applicationId = data.application_id;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if ('type' in data) {
|
|
73
|
+
/**
|
|
74
|
+
* The type of this entitlement
|
|
75
|
+
*
|
|
76
|
+
* @type {EntitlementType}
|
|
77
|
+
*/
|
|
78
|
+
this.type = data.type;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if ('deleted' in data) {
|
|
82
|
+
/**
|
|
83
|
+
* Whether this entitlement was deleted
|
|
84
|
+
*
|
|
85
|
+
* @type {boolean}
|
|
86
|
+
*/
|
|
87
|
+
this.deleted = data.deleted;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if ('starts_at' in data) {
|
|
91
|
+
/**
|
|
92
|
+
* The timestamp at which this entitlement is valid
|
|
93
|
+
*
|
|
94
|
+
* @type {?number}
|
|
95
|
+
*/
|
|
96
|
+
this.startsTimestamp = data.starts_at ? Date.parse(data.starts_at) : null;
|
|
97
|
+
} else {
|
|
98
|
+
this.startsTimestamp ??= null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if ('ends_at' in data) {
|
|
102
|
+
/**
|
|
103
|
+
* The timestamp at which this entitlement is no longer valid
|
|
104
|
+
*
|
|
105
|
+
* @type {?number}
|
|
106
|
+
*/
|
|
107
|
+
this.endsTimestamp = data.ends_at ? Date.parse(data.ends_at) : null;
|
|
108
|
+
} else {
|
|
109
|
+
this.endsTimestamp ??= null;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if ('consumed' in data) {
|
|
113
|
+
/**
|
|
114
|
+
* Whether this entitlement has been consumed
|
|
115
|
+
*
|
|
116
|
+
* @type {boolean}
|
|
117
|
+
*/
|
|
118
|
+
this.consumed = data.consumed;
|
|
119
|
+
} else {
|
|
120
|
+
this.consumed ??= false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The guild that is granted access to this entitlement's SKU
|
|
126
|
+
*
|
|
127
|
+
* @type {?Guild}
|
|
128
|
+
*/
|
|
129
|
+
get guild() {
|
|
130
|
+
if (!this.guildId) return null;
|
|
131
|
+
return this.client.guilds.cache.get(this.guildId) ?? null;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The start date at which this entitlement is valid
|
|
136
|
+
*
|
|
137
|
+
* @type {?Date}
|
|
138
|
+
*/
|
|
139
|
+
get startsAt() {
|
|
140
|
+
return this.startsTimestamp && new Date(this.startsTimestamp);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The end date at which this entitlement is no longer valid
|
|
145
|
+
*
|
|
146
|
+
* @type {?Date}
|
|
147
|
+
*/
|
|
148
|
+
get endsAt() {
|
|
149
|
+
return this.endsTimestamp && new Date(this.endsTimestamp);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Indicates whether this entitlement is active
|
|
154
|
+
*
|
|
155
|
+
* @returns {boolean}
|
|
156
|
+
*/
|
|
157
|
+
isActive() {
|
|
158
|
+
return !this.deleted && (!this.endsTimestamp || this.endsTimestamp > Date.now());
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Indicates whether this entitlement is a test entitlement
|
|
163
|
+
*
|
|
164
|
+
* @returns {boolean}
|
|
165
|
+
*/
|
|
166
|
+
isTest() {
|
|
167
|
+
return this.startsTimestamp === null;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Indicates whether this entitlement is a user subscription
|
|
172
|
+
*
|
|
173
|
+
* @returns {boolean}
|
|
174
|
+
*/
|
|
175
|
+
isUserSubscription() {
|
|
176
|
+
return this.guildId === null;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Indicates whether this entitlement is a guild subscription
|
|
181
|
+
*
|
|
182
|
+
* @returns {boolean}
|
|
183
|
+
*/
|
|
184
|
+
isGuildSubscription() {
|
|
185
|
+
return this.guildId !== null;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Fetches the user that is granted access to this entitlement's SKU
|
|
190
|
+
*
|
|
191
|
+
* @returns {Promise<User>}
|
|
192
|
+
*/
|
|
193
|
+
async fetchUser() {
|
|
194
|
+
return this.client.users.fetch(this.userId);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Marks this entitlement as consumed
|
|
199
|
+
* <info>Only available for One-Time Purchase consumable SKUs.</info>
|
|
200
|
+
*
|
|
201
|
+
* @returns {Promise<void>}
|
|
202
|
+
*/
|
|
203
|
+
async consume() {
|
|
204
|
+
await this.client.application.entitlements.consume(this.id);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Component } from './Component.js';
|
|
2
|
+
import { UnfurledMediaItem } from './UnfurledMediaItem.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents a file component
|
|
6
|
+
*
|
|
7
|
+
* @extends {Component}
|
|
8
|
+
*/
|
|
9
|
+
export class FileComponent extends Component {
|
|
10
|
+
public file: any;
|
|
11
|
+
constructor({ file, ...data }) {
|
|
12
|
+
super(data);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The media associated with this file
|
|
16
|
+
*
|
|
17
|
+
* @type {UnfurledMediaItem}
|
|
18
|
+
* @readonly
|
|
19
|
+
*/
|
|
20
|
+
this.file = new UnfurledMediaItem(file);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Whether this thumbnail is spoilered
|
|
25
|
+
*
|
|
26
|
+
* @type {boolean}
|
|
27
|
+
* @readonly
|
|
28
|
+
*/
|
|
29
|
+
get spoiler() {
|
|
30
|
+
return this.data.spoiler ?? false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Returns the API-compatible JSON for this component
|
|
35
|
+
*
|
|
36
|
+
* @returns {APIFileComponent}
|
|
37
|
+
*/
|
|
38
|
+
toJSON() {
|
|
39
|
+
return { ...this.data, file: this.file.toJSON() };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ThreadOnlyChannel } from './ThreadOnlyChannel.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents a forum channel.
|
|
5
|
+
*
|
|
6
|
+
* @extends {ThreadOnlyChannel}
|
|
7
|
+
*/
|
|
8
|
+
export class ForumChannel extends ThreadOnlyChannel {
|
|
9
|
+
public defaultForumLayout: any;
|
|
10
|
+
_patch(data) {
|
|
11
|
+
super._patch(data);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The default layout type used to display posts
|
|
15
|
+
*
|
|
16
|
+
* @type {ForumLayoutType}
|
|
17
|
+
*/
|
|
18
|
+
this.defaultForumLayout = data.default_forum_layout;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Sets the default forum layout type used to display posts
|
|
23
|
+
*
|
|
24
|
+
* @param {ForumLayoutType} defaultForumLayout The default forum layout type to set on this channel
|
|
25
|
+
* @param {string} [reason] Reason for changing the default forum layout
|
|
26
|
+
* @returns {Promise<ForumChannel>}
|
|
27
|
+
*/
|
|
28
|
+
async setDefaultForumLayout(defaultForumLayout, reason) {
|
|
29
|
+
return this.edit({ defaultForumLayout, reason });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BaseInvite } from './BaseInvite.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A channel invite leading to a group direct message channel.
|
|
5
|
+
*
|
|
6
|
+
* @extends {BaseInvite}
|
|
7
|
+
*/
|
|
8
|
+
export class GroupDMInvite extends BaseInvite {
|
|
9
|
+
public channel: any;
|
|
10
|
+
/**
|
|
11
|
+
* The approximate total number of members of in the group direct message channel.
|
|
12
|
+
* <info>This is only available when the invite was fetched through {@link Client#fetchInvite}.</info>
|
|
13
|
+
*
|
|
14
|
+
* @name GroupDMInvite#approximateMemberCount
|
|
15
|
+
* @type {?number}
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
_patch(data) {
|
|
19
|
+
super._patch(data);
|
|
20
|
+
|
|
21
|
+
if ('channel' in data) {
|
|
22
|
+
/**
|
|
23
|
+
* The channel this invite is for.
|
|
24
|
+
*
|
|
25
|
+
* @type {?PartialGroupDMChannel}
|
|
26
|
+
*/
|
|
27
|
+
this.channel =
|
|
28
|
+
this.client.channels._add(data.channel, null, { cache: false }) ??
|
|
29
|
+
this.client.channels.cache.get(this.channelId);
|
|
30
|
+
|
|
31
|
+
this.channelId ??= data.channel.id;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|