@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,470 @@
|
|
|
1
|
+
import { Collection } from '@ovencord/collection';
|
|
2
|
+
import { Routes } from 'discord-api-types/v10';
|
|
3
|
+
import { ApplicationCommandManager } from '../managers/ApplicationCommandManager.js';
|
|
4
|
+
import { ApplicationEmojiManager } from '../managers/ApplicationEmojiManager.js';
|
|
5
|
+
import { EntitlementManager } from '../managers/EntitlementManager.js';
|
|
6
|
+
import { SubscriptionManager } from '../managers/SubscriptionManager.js';
|
|
7
|
+
import { ApplicationFlagsBitField } from '../util/ApplicationFlagsBitField.js';
|
|
8
|
+
import { resolveImage } from '../util/DataResolver.js';
|
|
9
|
+
import { PermissionsBitField } from '../util/PermissionsBitField.js';
|
|
10
|
+
import { ApplicationRoleConnectionMetadata } from './ApplicationRoleConnectionMetadata.js';
|
|
11
|
+
import { SKU } from './SKU.js';
|
|
12
|
+
import { Team } from './Team.js';
|
|
13
|
+
import { Application } from './interfaces/Application.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {Object} ClientApplicationInstallParams
|
|
17
|
+
* @property {OAuth2Scopes[]} scopes Scopes that will be set upon adding this application
|
|
18
|
+
* @property {Readonly<PermissionsBitField>} permissions Permissions that will be requested for the integrated role
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Represents a client application.
|
|
23
|
+
*
|
|
24
|
+
* @extends {Application}
|
|
25
|
+
*/
|
|
26
|
+
export class ClientApplication extends Application {
|
|
27
|
+
public client: any;
|
|
28
|
+
public commands: any;
|
|
29
|
+
public emojis: any;
|
|
30
|
+
public entitlements: any;
|
|
31
|
+
public subscriptions: any;
|
|
32
|
+
public tags: any;
|
|
33
|
+
public installParams: any;
|
|
34
|
+
public integrationTypesConfig: any;
|
|
35
|
+
public customInstallURL: any;
|
|
36
|
+
public flags: any;
|
|
37
|
+
public approximateGuildCount: any;
|
|
38
|
+
public approximateUserInstallCount: any;
|
|
39
|
+
public approximateUserAuthorizationCount: any;
|
|
40
|
+
public guildId: any;
|
|
41
|
+
public botRequireCodeGrant: any;
|
|
42
|
+
public bot: any;
|
|
43
|
+
public botPublic: any;
|
|
44
|
+
public interactionsEndpointURL: any;
|
|
45
|
+
public roleConnectionsVerificationURL: any;
|
|
46
|
+
public eventWebhooksURL: any;
|
|
47
|
+
public eventWebhooksStatus: any;
|
|
48
|
+
public eventWebhooksTypes: any;
|
|
49
|
+
public owner: any;
|
|
50
|
+
constructor(client, data) {
|
|
51
|
+
super(client, data);
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The application command manager for this application
|
|
55
|
+
*
|
|
56
|
+
* @type {ApplicationCommandManager}
|
|
57
|
+
*/
|
|
58
|
+
this.commands = new ApplicationCommandManager(this.client);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The application emoji manager for this application
|
|
62
|
+
*
|
|
63
|
+
* @type {ApplicationEmojiManager}
|
|
64
|
+
*/
|
|
65
|
+
this.emojis = new ApplicationEmojiManager(this);
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The entitlement manager for this application
|
|
69
|
+
*
|
|
70
|
+
* @type {EntitlementManager}
|
|
71
|
+
*/
|
|
72
|
+
this.entitlements = new EntitlementManager(this.client);
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The subscription manager for this application
|
|
76
|
+
*
|
|
77
|
+
* @type {SubscriptionManager}
|
|
78
|
+
*/
|
|
79
|
+
this.subscriptions = new SubscriptionManager(this.client);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
_patch(data) {
|
|
83
|
+
super._patch(data);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The tags this application has (max of 5)
|
|
87
|
+
*
|
|
88
|
+
* @type {string[]}
|
|
89
|
+
*/
|
|
90
|
+
this.tags = data.tags ?? [];
|
|
91
|
+
|
|
92
|
+
if ('install_params' in data) {
|
|
93
|
+
/**
|
|
94
|
+
* Settings for this application's default in-app authorization
|
|
95
|
+
*
|
|
96
|
+
* @type {?ClientApplicationInstallParams}
|
|
97
|
+
*/
|
|
98
|
+
this.installParams = {
|
|
99
|
+
scopes: data.install_params.scopes,
|
|
100
|
+
permissions: new PermissionsBitField(data.install_params.permissions).freeze(),
|
|
101
|
+
};
|
|
102
|
+
} else {
|
|
103
|
+
this.installParams ??= null;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* OAuth2 installation parameters.
|
|
108
|
+
*
|
|
109
|
+
* @typedef {Object} IntegrationTypesConfigurationParameters
|
|
110
|
+
* @property {OAuth2Scopes[]} scopes Scopes that will be set upon adding this application
|
|
111
|
+
* @property {Readonly<PermissionsBitField>} permissions Permissions that will be requested for the integrated role
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The application's supported installation context data.
|
|
116
|
+
*
|
|
117
|
+
* @typedef {Object} IntegrationTypesConfigurationContext
|
|
118
|
+
* @property {?IntegrationTypesConfigurationParameters} oauth2InstallParams
|
|
119
|
+
* Scopes and permissions regarding the installation context
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
/* eslint-disable jsdoc/valid-types */
|
|
123
|
+
/**
|
|
124
|
+
* The application's supported installation context data.
|
|
125
|
+
*
|
|
126
|
+
* @typedef {Object} IntegrationTypesConfiguration
|
|
127
|
+
* @property {IntegrationTypesConfigurationContext} [0] Scopes and permissions
|
|
128
|
+
* regarding the guild-installation context
|
|
129
|
+
* @property {IntegrationTypesConfigurationContext} [1] Scopes and permissions
|
|
130
|
+
* regarding the user-installation context
|
|
131
|
+
*/
|
|
132
|
+
/* eslint-enable jsdoc/valid-types */
|
|
133
|
+
|
|
134
|
+
if ('integration_types_config' in data) {
|
|
135
|
+
/**
|
|
136
|
+
* Default scopes and permissions for each supported installation context.
|
|
137
|
+
* The keys are stringified variants of {@link ApplicationIntegrationType}.
|
|
138
|
+
*
|
|
139
|
+
* @type {?IntegrationTypesConfiguration}
|
|
140
|
+
*/
|
|
141
|
+
this.integrationTypesConfig = Object.fromEntries(
|
|
142
|
+
Object.entries(data.integration_types_config).map(([key, config]) => {
|
|
143
|
+
let oauth2InstallParams = null;
|
|
144
|
+
if (config.oauth2_install_params) {
|
|
145
|
+
oauth2InstallParams = {
|
|
146
|
+
scopes: config.oauth2_install_params.scopes,
|
|
147
|
+
permissions: new PermissionsBitField(config.oauth2_install_params.permissions).freeze(),
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const context = {
|
|
152
|
+
oauth2InstallParams,
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
return [key, context];
|
|
156
|
+
}),
|
|
157
|
+
);
|
|
158
|
+
} else {
|
|
159
|
+
this.integrationTypesConfig ??= null;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if ('custom_install_url' in data) {
|
|
163
|
+
/**
|
|
164
|
+
* This application's custom installation URL
|
|
165
|
+
*
|
|
166
|
+
* @type {?string}
|
|
167
|
+
*/
|
|
168
|
+
this.customInstallURL = data.custom_install_url;
|
|
169
|
+
} else {
|
|
170
|
+
this.customInstallURL = null;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if ('flags' in data) {
|
|
174
|
+
/**
|
|
175
|
+
* The flags this application has
|
|
176
|
+
*
|
|
177
|
+
* @type {ApplicationFlagsBitField}
|
|
178
|
+
*/
|
|
179
|
+
this.flags = new ApplicationFlagsBitField(data.flags).freeze();
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if ('approximate_guild_count' in data) {
|
|
183
|
+
/**
|
|
184
|
+
* An approximate amount of guilds this application is in.
|
|
185
|
+
*
|
|
186
|
+
* @type {?number}
|
|
187
|
+
*/
|
|
188
|
+
this.approximateGuildCount = data.approximate_guild_count;
|
|
189
|
+
} else {
|
|
190
|
+
this.approximateGuildCount ??= null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if ('approximate_user_install_count' in data) {
|
|
194
|
+
/**
|
|
195
|
+
* An approximate amount of users that have installed this application.
|
|
196
|
+
*
|
|
197
|
+
* @type {?number}
|
|
198
|
+
*/
|
|
199
|
+
this.approximateUserInstallCount = data.approximate_user_install_count;
|
|
200
|
+
} else {
|
|
201
|
+
this.approximateUserInstallCount ??= null;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if ('approximate_user_authorization_count' in data) {
|
|
205
|
+
/**
|
|
206
|
+
* An approximate amount of users that have OAuth2 authorizations for this application.
|
|
207
|
+
*
|
|
208
|
+
* @type {?number}
|
|
209
|
+
*/
|
|
210
|
+
this.approximateUserAuthorizationCount = data.approximate_user_authorization_count;
|
|
211
|
+
} else {
|
|
212
|
+
this.approximateUserAuthorizationCount ??= null;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if ('guild_id' in data) {
|
|
216
|
+
/**
|
|
217
|
+
* The id of the guild associated with this application.
|
|
218
|
+
*
|
|
219
|
+
* @type {?Snowflake}
|
|
220
|
+
*/
|
|
221
|
+
this.guildId = data.guild_id;
|
|
222
|
+
} else {
|
|
223
|
+
this.guildId ??= null;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if ('bot_require_code_grant' in data) {
|
|
227
|
+
/**
|
|
228
|
+
* If this application's bot requires a code grant when using the OAuth2 flow
|
|
229
|
+
*
|
|
230
|
+
* @type {?boolean}
|
|
231
|
+
*/
|
|
232
|
+
this.botRequireCodeGrant = data.bot_require_code_grant;
|
|
233
|
+
} else {
|
|
234
|
+
this.botRequireCodeGrant ??= null;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if ('bot' in data) {
|
|
238
|
+
/**
|
|
239
|
+
* The bot associated with this application.
|
|
240
|
+
*
|
|
241
|
+
* @type {?User}
|
|
242
|
+
*/
|
|
243
|
+
this.bot = this.client.users._add(data.bot);
|
|
244
|
+
} else {
|
|
245
|
+
this.bot ??= null;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if ('bot_public' in data) {
|
|
249
|
+
/**
|
|
250
|
+
* If this application's bot is public
|
|
251
|
+
*
|
|
252
|
+
* @type {?boolean}
|
|
253
|
+
*/
|
|
254
|
+
this.botPublic = data.bot_public;
|
|
255
|
+
} else {
|
|
256
|
+
this.botPublic ??= null;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if ('interactions_endpoint_url' in data) {
|
|
260
|
+
/**
|
|
261
|
+
* This application's interaction endpoint URL.
|
|
262
|
+
*
|
|
263
|
+
* @type {?string}
|
|
264
|
+
*/
|
|
265
|
+
this.interactionsEndpointURL = data.interactions_endpoint_url;
|
|
266
|
+
} else {
|
|
267
|
+
this.interactionsEndpointURL ??= null;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if ('role_connections_verification_url' in data) {
|
|
271
|
+
/**
|
|
272
|
+
* This application's role connection verification entry point URL
|
|
273
|
+
*
|
|
274
|
+
* @type {?string}
|
|
275
|
+
*/
|
|
276
|
+
this.roleConnectionsVerificationURL = data.role_connections_verification_url;
|
|
277
|
+
} else {
|
|
278
|
+
this.roleConnectionsVerificationURL ??= null;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if ('event_webhooks_url' in data) {
|
|
282
|
+
/**
|
|
283
|
+
* This application's URL to receive event webhooks
|
|
284
|
+
*
|
|
285
|
+
* @type {?string}
|
|
286
|
+
*/
|
|
287
|
+
this.eventWebhooksURL = data.event_webhooks_url;
|
|
288
|
+
} else {
|
|
289
|
+
this.eventWebhooksURL ??= null;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if ('event_webhooks_status' in data) {
|
|
293
|
+
/**
|
|
294
|
+
* This application's event webhooks status
|
|
295
|
+
*
|
|
296
|
+
* @type {?ApplicationWebhookEventStatus}
|
|
297
|
+
*/
|
|
298
|
+
this.eventWebhooksStatus = data.event_webhooks_status;
|
|
299
|
+
} else {
|
|
300
|
+
this.eventWebhooksStatus ??= null;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if ('event_webhooks_types' in data) {
|
|
304
|
+
/**
|
|
305
|
+
* List of event webhooks types this application subscribes to
|
|
306
|
+
*
|
|
307
|
+
* @type {?ApplicationWebhookEventType[]}
|
|
308
|
+
*/
|
|
309
|
+
this.eventWebhooksTypes = data.event_webhooks_types;
|
|
310
|
+
} else {
|
|
311
|
+
this.eventWebhooksTypes ??= null;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* The owner of this OAuth application
|
|
316
|
+
*
|
|
317
|
+
* @type {?(User|Team)}
|
|
318
|
+
*/
|
|
319
|
+
this.owner = data.team
|
|
320
|
+
? new Team(this.client, data.team)
|
|
321
|
+
: data.owner
|
|
322
|
+
? this.client.users._add(data.owner)
|
|
323
|
+
: (this.owner ?? null);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* The guild associated with this application.
|
|
328
|
+
*
|
|
329
|
+
* @type {?Guild}
|
|
330
|
+
* @readonly
|
|
331
|
+
*/
|
|
332
|
+
get guild() {
|
|
333
|
+
return this.client.guilds.cache.get(this.guildId) ?? null;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Whether this application is partial
|
|
338
|
+
*
|
|
339
|
+
* @type {boolean}
|
|
340
|
+
* @readonly
|
|
341
|
+
*/
|
|
342
|
+
get partial() {
|
|
343
|
+
return !this.name;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Options used for editing an application.
|
|
348
|
+
*
|
|
349
|
+
* @typedef {Object} ClientApplicationEditOptions
|
|
350
|
+
* @property {string} [customInstallURL] The application's custom installation URL
|
|
351
|
+
* @property {string} [description] The application's description
|
|
352
|
+
* @property {string} [roleConnectionsVerificationURL] The application's role connection verification URL
|
|
353
|
+
* @property {ClientApplicationInstallParams} [installParams]
|
|
354
|
+
* Settings for the application's default in-app authorization
|
|
355
|
+
* @property {ApplicationFlagsResolvable} [flags] The flags for the application
|
|
356
|
+
* @property {?(BufferResolvable|Base64Resolvable)} [icon] The application's icon
|
|
357
|
+
* @property {?(BufferResolvable|Base64Resolvable)} [coverImage] The application's cover image
|
|
358
|
+
* @property {string} [interactionsEndpointURL] The application's interaction endpoint URL
|
|
359
|
+
* @property {string} [eventWebhooksURL] The application's event webhooks URL
|
|
360
|
+
* @property {ApplicationWebhookEventStatus.Enabled|ApplicationWebhookEventStatus.Disabled} [eventWebhooksStatus]
|
|
361
|
+
* The application's event webhooks status.
|
|
362
|
+
* @property {ApplicationWebhookEventType[]} [eventWebhooksTypes] The application's event webhooks types
|
|
363
|
+
* @property {string[]} [tags] The application's tags
|
|
364
|
+
*/
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Edits this application.
|
|
368
|
+
*
|
|
369
|
+
* @param {ClientApplicationEditOptions} [options] The options for editing this application
|
|
370
|
+
* @returns {Promise<ClientApplication>}
|
|
371
|
+
*/
|
|
372
|
+
async edit({
|
|
373
|
+
customInstallURL,
|
|
374
|
+
description,
|
|
375
|
+
roleConnectionsVerificationURL,
|
|
376
|
+
installParams,
|
|
377
|
+
flags,
|
|
378
|
+
icon,
|
|
379
|
+
coverImage,
|
|
380
|
+
interactionsEndpointURL,
|
|
381
|
+
eventWebhooksURL,
|
|
382
|
+
eventWebhooksStatus,
|
|
383
|
+
eventWebhooksTypes,
|
|
384
|
+
tags,
|
|
385
|
+
} = {}) {
|
|
386
|
+
const data = await this.client.rest.patch(Routes.currentApplication(), {
|
|
387
|
+
body: {
|
|
388
|
+
custom_install_url: customInstallURL,
|
|
389
|
+
description,
|
|
390
|
+
role_connections_verification_url: roleConnectionsVerificationURL,
|
|
391
|
+
install_params: installParams,
|
|
392
|
+
flags: flags === undefined ? undefined : ApplicationFlagsBitField.resolve(flags),
|
|
393
|
+
icon: icon && (await resolveImage(icon)),
|
|
394
|
+
cover_image: coverImage && (await resolveImage(coverImage)),
|
|
395
|
+
interactions_endpoint_url: interactionsEndpointURL,
|
|
396
|
+
event_webhooks_url: eventWebhooksURL,
|
|
397
|
+
event_webhooks_status: eventWebhooksStatus,
|
|
398
|
+
event_webhooks_types: eventWebhooksTypes,
|
|
399
|
+
tags,
|
|
400
|
+
},
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
this._patch(data);
|
|
404
|
+
return this;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Obtains this application from Discord.
|
|
409
|
+
*
|
|
410
|
+
* @returns {Promise<ClientApplication>}
|
|
411
|
+
*/
|
|
412
|
+
async fetch() {
|
|
413
|
+
const data = await this.client.rest.get(Routes.currentApplication());
|
|
414
|
+
this._patch(data);
|
|
415
|
+
return this;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Gets this application's role connection metadata records
|
|
420
|
+
*
|
|
421
|
+
* @returns {Promise<ApplicationRoleConnectionMetadata[]>}
|
|
422
|
+
*/
|
|
423
|
+
async fetchRoleConnectionMetadataRecords() {
|
|
424
|
+
const metadata = await this.client.rest.get(Routes.applicationRoleConnectionMetadata(this.client.user.id));
|
|
425
|
+
return metadata.map(data => new ApplicationRoleConnectionMetadata(data));
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Data for creating or editing an application role connection metadata.
|
|
430
|
+
*
|
|
431
|
+
* @typedef {Object} ApplicationRoleConnectionMetadataEditOptions
|
|
432
|
+
* @property {string} name The name of the metadata field
|
|
433
|
+
* @property {?LocalizationMap} [nameLocalizations] The name localizations for the metadata field
|
|
434
|
+
* @property {string} description The description of the metadata field
|
|
435
|
+
* @property {?LocalizationMap} [descriptionLocalizations] The description localizations for the metadata field
|
|
436
|
+
* @property {string} key The dictionary key of the metadata field
|
|
437
|
+
* @property {ApplicationRoleConnectionMetadataType} type The type of the metadata field
|
|
438
|
+
*/
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Updates this application's role connection metadata records
|
|
442
|
+
*
|
|
443
|
+
* @param {ApplicationRoleConnectionMetadataEditOptions[]} records The new role connection metadata records
|
|
444
|
+
* @returns {Promise<ApplicationRoleConnectionMetadata[]>}
|
|
445
|
+
*/
|
|
446
|
+
async editRoleConnectionMetadataRecords(records) {
|
|
447
|
+
const newRecords = await this.client.rest.put(Routes.applicationRoleConnectionMetadata(this.client.user.id), {
|
|
448
|
+
body: records.map(record => ({
|
|
449
|
+
type: record.type,
|
|
450
|
+
key: record.key,
|
|
451
|
+
name: record.name,
|
|
452
|
+
name_localizations: record.nameLocalizations,
|
|
453
|
+
description: record.description,
|
|
454
|
+
description_localizations: record.descriptionLocalizations,
|
|
455
|
+
})),
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
return newRecords.map(data => new ApplicationRoleConnectionMetadata(data));
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Gets this application's SKUs
|
|
463
|
+
*
|
|
464
|
+
* @returns {Promise<Collection<Snowflake, SKU>>}
|
|
465
|
+
*/
|
|
466
|
+
async fetchSKUs() {
|
|
467
|
+
const skus = await this.client.rest.get(Routes.skus(this.id));
|
|
468
|
+
return skus.reduce((coll, sku) => coll.set(sku.id, new SKU(this.client, sku)), new Collection());
|
|
469
|
+
}
|
|
470
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/* eslint-disable id-length */
|
|
2
|
+
|
|
3
|
+
import { GatewayOpcodes, ActivityType } from 'discord-api-types/v10';
|
|
4
|
+
import { DiscordjsTypeError, ErrorCodes } from '../errors/index.js';
|
|
5
|
+
import { Presence } from './Presence.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Represents the client's presence.
|
|
9
|
+
*
|
|
10
|
+
* @extends {Presence}
|
|
11
|
+
*/
|
|
12
|
+
export class ClientPresence extends Presence {
|
|
13
|
+
public client: any;
|
|
14
|
+
constructor(client, data = {}) {
|
|
15
|
+
super(client, Object.assign(data, { status: data.status ?? 'online', user: { id: null } }));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Sets the client's presence
|
|
20
|
+
*
|
|
21
|
+
* @param {PresenceData} presence The data to set the presence to
|
|
22
|
+
* @returns {Promise<ClientPresence>}
|
|
23
|
+
*/
|
|
24
|
+
async set(presence) {
|
|
25
|
+
const packet = this._parse(presence);
|
|
26
|
+
this._patch(packet);
|
|
27
|
+
if (presence.shardId === undefined) {
|
|
28
|
+
await this.client._broadcast({ op: GatewayOpcodes.PresenceUpdate, d: packet });
|
|
29
|
+
} else if (Array.isArray(presence.shardId)) {
|
|
30
|
+
await Promise.all(
|
|
31
|
+
presence.shardId.map(shardId => this.client.ws.send(shardId, { op: GatewayOpcodes.PresenceUpdate, d: packet })),
|
|
32
|
+
);
|
|
33
|
+
} else {
|
|
34
|
+
await this.client.ws.send(presence.shardId, { op: GatewayOpcodes.PresenceUpdate, d: packet });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Parses presence data into a packet ready to be sent to Discord
|
|
42
|
+
*
|
|
43
|
+
* @param {PresenceData} presence The data to parse
|
|
44
|
+
* @returns {GatewayPresenceUpdateData}
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
_parse({ status, since, afk, activities }) {
|
|
48
|
+
const data = {
|
|
49
|
+
activities: [],
|
|
50
|
+
afk: typeof afk === 'boolean' ? afk : false,
|
|
51
|
+
since: typeof since === 'number' && !Number.isNaN(since) ? since : null,
|
|
52
|
+
status: status ?? this.status,
|
|
53
|
+
};
|
|
54
|
+
if (activities?.length) {
|
|
55
|
+
for (const [i, activity] of activities.entries()) {
|
|
56
|
+
if (typeof activity.name !== 'string') {
|
|
57
|
+
throw new DiscordjsTypeError(ErrorCodes.InvalidType, `activities[${i}].name`, 'string');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
activity.type ??= ActivityType.Playing;
|
|
61
|
+
|
|
62
|
+
if (activity.type === ActivityType.Custom && !activity.state) {
|
|
63
|
+
activity.state = activity.name;
|
|
64
|
+
activity.name = 'Custom Status';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
data.activities.push({
|
|
68
|
+
type: activity.type,
|
|
69
|
+
name: activity.name,
|
|
70
|
+
state: activity.state,
|
|
71
|
+
url: activity.url,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
} else if (!activities && (status || afk || since) && this.activities.length) {
|
|
75
|
+
data.activities.push(
|
|
76
|
+
...this.activities.map(activity => ({
|
|
77
|
+
name: activity.name,
|
|
78
|
+
state: activity.state ?? undefined,
|
|
79
|
+
type: activity.type,
|
|
80
|
+
url: activity.url ?? undefined,
|
|
81
|
+
})),
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return data;
|
|
86
|
+
}
|
|
87
|
+
}
|