@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,44 @@
|
|
|
1
|
+
import { createComponent } from '../util/Components.js';
|
|
2
|
+
import { Component } from './Component.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents a section component
|
|
6
|
+
*
|
|
7
|
+
* @extends {Component}
|
|
8
|
+
*/
|
|
9
|
+
export class SectionComponent extends Component {
|
|
10
|
+
public components: any;
|
|
11
|
+
public accessory: any;
|
|
12
|
+
constructor({ accessory, components, ...data }) {
|
|
13
|
+
super(data);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The components in this section
|
|
17
|
+
*
|
|
18
|
+
* @type {Component[]}
|
|
19
|
+
* @readonly
|
|
20
|
+
*/
|
|
21
|
+
this.components = components.map(component => createComponent(component));
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The accessory component of this section
|
|
25
|
+
*
|
|
26
|
+
* @type {Component}
|
|
27
|
+
* @readonly
|
|
28
|
+
*/
|
|
29
|
+
this.accessory = createComponent(accessory);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Returns the API-compatible JSON for this component
|
|
34
|
+
*
|
|
35
|
+
* @returns {APISectionComponent}
|
|
36
|
+
*/
|
|
37
|
+
toJSON() {
|
|
38
|
+
return {
|
|
39
|
+
...this.data,
|
|
40
|
+
accessory: this.accessory.toJSON(),
|
|
41
|
+
components: this.components.map(component => component.toJSON()),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SeparatorSpacingSize } from 'discord-api-types/v10';
|
|
2
|
+
import { Component } from './Component.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents a separator component
|
|
6
|
+
*
|
|
7
|
+
* @extends {Component}
|
|
8
|
+
*/
|
|
9
|
+
export class SeparatorComponent extends Component {
|
|
10
|
+
/**
|
|
11
|
+
* The spacing of this separator
|
|
12
|
+
*
|
|
13
|
+
* @type {SeparatorSpacingSize}
|
|
14
|
+
* @readonly
|
|
15
|
+
*/
|
|
16
|
+
get spacing() {
|
|
17
|
+
return this.data.spacing ?? SeparatorSpacingSize.Small;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Whether this separator is a divider
|
|
22
|
+
*
|
|
23
|
+
* @type {boolean}
|
|
24
|
+
* @readonly
|
|
25
|
+
*/
|
|
26
|
+
get divider() {
|
|
27
|
+
return this.data.divider ?? true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
|
|
2
|
+
import { DiscordSnowflake } from '@sapphire/snowflake';
|
|
3
|
+
import { DiscordjsError, ErrorCodes } from '../errors/index.js';
|
|
4
|
+
import { Base } from './Base.js';
|
|
5
|
+
import { Emoji } from './Emoji.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Represents a soundboard sound.
|
|
9
|
+
*
|
|
10
|
+
* @extends {Base}
|
|
11
|
+
*/
|
|
12
|
+
export class SoundboardSound extends Base {
|
|
13
|
+
public soundId: string;
|
|
14
|
+
public available: boolean | null = null;
|
|
15
|
+
public name: string | null = null;
|
|
16
|
+
public volume: number | null = null;
|
|
17
|
+
public _emoji: any = null;
|
|
18
|
+
public guildId: string | null = null;
|
|
19
|
+
public user: any = null;
|
|
20
|
+
|
|
21
|
+
constructor(client: any, data: any) {
|
|
22
|
+
super(client);
|
|
23
|
+
this.soundId = data.sound_id;
|
|
24
|
+
this._patch(data);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
override _patch(data: any) {
|
|
28
|
+
if ('available' in data) {
|
|
29
|
+
this.available = data.available;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if ('name' in data) {
|
|
33
|
+
this.name = data.name;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if ('volume' in data) {
|
|
37
|
+
this.volume = data.volume;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if ('emoji_id' in data) {
|
|
41
|
+
this._emoji = {
|
|
42
|
+
id: data.emoji_id,
|
|
43
|
+
name: data.emoji_name,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if ('guild_id' in data) {
|
|
48
|
+
this.guildId = data.guild_id;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if ('user' in data) {
|
|
52
|
+
this.user = (this.client as any).users._add(data.user);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The timestamp this soundboard sound was created at
|
|
58
|
+
*
|
|
59
|
+
* @type {number}
|
|
60
|
+
* @readonly
|
|
61
|
+
*/
|
|
62
|
+
get createdTimestamp() {
|
|
63
|
+
return DiscordSnowflake.timestampFrom(this.soundId);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The time this soundboard sound was created at
|
|
68
|
+
*
|
|
69
|
+
* @type {Date}
|
|
70
|
+
* @readonly
|
|
71
|
+
*/
|
|
72
|
+
get createdAt() {
|
|
73
|
+
return new Date(this.createdTimestamp);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The emoji of this soundboard sound
|
|
78
|
+
*
|
|
79
|
+
* @type {?Emoji}
|
|
80
|
+
* @readonly
|
|
81
|
+
*/
|
|
82
|
+
get emoji() {
|
|
83
|
+
if (!this._emoji) return null;
|
|
84
|
+
|
|
85
|
+
return this.guild?.emojis.cache.get(this._emoji.id) ?? new Emoji(this.client, this._emoji);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The guild this soundboard sound is part of
|
|
90
|
+
*
|
|
91
|
+
* @type {?Guild}
|
|
92
|
+
* @readonly
|
|
93
|
+
*/
|
|
94
|
+
get guild() {
|
|
95
|
+
return this.client.guilds.resolve(this.guildId);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* A link to this soundboard sound
|
|
100
|
+
*
|
|
101
|
+
* @type {string}
|
|
102
|
+
* @readonly
|
|
103
|
+
*/
|
|
104
|
+
get url() {
|
|
105
|
+
return this.client.rest.cdn.soundboardSound(this.soundId);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Edits this soundboard sound.
|
|
110
|
+
*
|
|
111
|
+
* @param {GuildSoundboardSoundEditOptions} options The options to provide
|
|
112
|
+
* @returns {Promise<SoundboardSound>}
|
|
113
|
+
* @example
|
|
114
|
+
* // Update the name of a soundboard sound
|
|
115
|
+
* soundboardSound.edit({ name: 'new name' })
|
|
116
|
+
* .then(sound => console.log(`Updated the name of the soundboard sound to ${sound.name}`))
|
|
117
|
+
* .catch(console.error);
|
|
118
|
+
*/
|
|
119
|
+
async edit(options) {
|
|
120
|
+
if (!this.guildId) throw new DiscordjsError(ErrorCodes.NotGuildSoundboardSound, 'edited');
|
|
121
|
+
|
|
122
|
+
return this.guild.soundboardSounds.edit(this, options);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Deletes this soundboard sound.
|
|
127
|
+
*
|
|
128
|
+
* @param {string} [reason] Reason for deleting this soundboard sound
|
|
129
|
+
* @returns {Promise<SoundboardSound>}
|
|
130
|
+
* @example
|
|
131
|
+
* // Delete a soundboard sound
|
|
132
|
+
* soundboardSound.delete()
|
|
133
|
+
* .then(sound => console.log(`Deleted soundboard sound ${sound.name}`))
|
|
134
|
+
* .catch(console.error);
|
|
135
|
+
*/
|
|
136
|
+
async delete(reason) {
|
|
137
|
+
if (!this.guildId) throw new DiscordjsError(ErrorCodes.NotGuildSoundboardSound, 'deleted');
|
|
138
|
+
|
|
139
|
+
await this.guild.soundboardSounds.delete(this, reason);
|
|
140
|
+
|
|
141
|
+
return this;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Whether this soundboard sound is the same as another one.
|
|
146
|
+
*
|
|
147
|
+
* @param {SoundboardSound|APISoundboardSound} other The soundboard sound to compare it to
|
|
148
|
+
* @returns {boolean}
|
|
149
|
+
*/
|
|
150
|
+
equals(other: any) {
|
|
151
|
+
if (other instanceof SoundboardSound) {
|
|
152
|
+
return (
|
|
153
|
+
this.soundId === other.soundId &&
|
|
154
|
+
this.available === other.available &&
|
|
155
|
+
this.name === other.name &&
|
|
156
|
+
this.volume === other.volume &&
|
|
157
|
+
this._emoji?.id === other._emoji?.id &&
|
|
158
|
+
this._emoji?.name === other._emoji?.name &&
|
|
159
|
+
this.guildId === other.guildId &&
|
|
160
|
+
this.user?.id === other.user?.id
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
this.soundId === other.sound_id &&
|
|
166
|
+
this.available === other.available &&
|
|
167
|
+
this.name === other.name &&
|
|
168
|
+
this.volume === other.volume &&
|
|
169
|
+
(this._emoji?.id ?? null) === other.emoji_id &&
|
|
170
|
+
(this._emoji?.name ?? null) === other.emoji_name &&
|
|
171
|
+
this.guildId === other.guild_id &&
|
|
172
|
+
this.user?.id === other.user?.id
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { BaseGuildVoiceChannel } from './BaseGuildVoiceChannel.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents a guild stage channel on Discord.
|
|
5
|
+
*
|
|
6
|
+
* @extends {BaseGuildVoiceChannel}
|
|
7
|
+
*/
|
|
8
|
+
export class StageChannel extends BaseGuildVoiceChannel {
|
|
9
|
+
public topic: any;
|
|
10
|
+
_patch(data) {
|
|
11
|
+
super._patch(data);
|
|
12
|
+
|
|
13
|
+
if ('topic' in data) {
|
|
14
|
+
/**
|
|
15
|
+
* The topic of the stage channel
|
|
16
|
+
*
|
|
17
|
+
* @type {?string}
|
|
18
|
+
*/
|
|
19
|
+
this.topic = data.topic;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The stage instance of this stage channel, if it exists
|
|
25
|
+
*
|
|
26
|
+
* @type {?StageInstance}
|
|
27
|
+
* @readonly
|
|
28
|
+
*/
|
|
29
|
+
get stageInstance() {
|
|
30
|
+
return this.guild.stageInstances.cache.find(stageInstance => stageInstance.channelId === this.id) ?? null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Creates a stage instance associated with this stage channel.
|
|
35
|
+
*
|
|
36
|
+
* @param {StageInstanceCreateOptions} options The options to create the stage instance
|
|
37
|
+
* @returns {Promise<StageInstance>}
|
|
38
|
+
*/
|
|
39
|
+
async createStageInstance(options) {
|
|
40
|
+
return this.guild.stageInstances.create(this.id, options);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Sets a new topic for the guild channel.
|
|
45
|
+
*
|
|
46
|
+
* @param {?string} topic The new topic for the guild channel
|
|
47
|
+
* @param {string} [reason] Reason for changing the guild channel's topic
|
|
48
|
+
* @returns {Promise<StageChannel>}
|
|
49
|
+
* @example
|
|
50
|
+
* // Set a new channel topic
|
|
51
|
+
* stageChannel.setTopic('needs more rate limiting')
|
|
52
|
+
* .then(channel => console.log(`Channel's new topic is ${channel.topic}`))
|
|
53
|
+
* .catch(console.error);
|
|
54
|
+
*/
|
|
55
|
+
async setTopic(topic, reason) {
|
|
56
|
+
return this.edit({ topic, reason });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Sets the bitrate of the channel.
|
|
62
|
+
*
|
|
63
|
+
* @method setBitrate
|
|
64
|
+
* @memberof StageChannel
|
|
65
|
+
* @instance
|
|
66
|
+
* @param {number} bitrate The new bitrate
|
|
67
|
+
* @param {string} [reason] Reason for changing the channel's bitrate
|
|
68
|
+
* @returns {Promise<StageChannel>}
|
|
69
|
+
* @example
|
|
70
|
+
* // Set the bitrate of a voice channel
|
|
71
|
+
* stageChannel.setBitrate(48_000)
|
|
72
|
+
* .then(channel => console.log(`Set bitrate to ${channel.bitrate}bps for ${channel.name}`))
|
|
73
|
+
* .catch(console.error);
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Sets the RTC region of the channel.
|
|
78
|
+
*
|
|
79
|
+
* @method setRTCRegion
|
|
80
|
+
* @memberof StageChannel
|
|
81
|
+
* @instance
|
|
82
|
+
* @param {?string} rtcRegion The new region of the channel. Set to `null` to remove a specific region for the channel
|
|
83
|
+
* @param {string} [reason] The reason for modifying this region.
|
|
84
|
+
* @returns {Promise<StageChannel>}
|
|
85
|
+
* @example
|
|
86
|
+
* // Set the RTC region to sydney
|
|
87
|
+
* stageChannel.setRTCRegion('sydney');
|
|
88
|
+
* @example
|
|
89
|
+
* // Remove a fixed region for this channel - let Discord decide automatically
|
|
90
|
+
* stageChannel.setRTCRegion(null, 'We want to let Discord decide.');
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Sets the user limit of the channel.
|
|
95
|
+
*
|
|
96
|
+
* @method setUserLimit
|
|
97
|
+
* @memberof StageChannel
|
|
98
|
+
* @instance
|
|
99
|
+
* @param {number} userLimit The new user limit
|
|
100
|
+
* @param {string} [reason] Reason for changing the user limit
|
|
101
|
+
* @returns {Promise<StageChannel>}
|
|
102
|
+
* @example
|
|
103
|
+
* // Set the user limit of a voice channel
|
|
104
|
+
* stageChannel.setUserLimit(42)
|
|
105
|
+
* .then(channel => console.log(`Set user limit to ${channel.userLimit} for ${channel.name}`))
|
|
106
|
+
* .catch(console.error);
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Sets the camera video quality mode of the channel.
|
|
111
|
+
*
|
|
112
|
+
* @method setVideoQualityMode
|
|
113
|
+
* @memberof StageChannel
|
|
114
|
+
* @instance
|
|
115
|
+
* @param {VideoQualityMode} videoQualityMode The new camera video quality mode.
|
|
116
|
+
* @param {string} [reason] Reason for changing the camera video quality mode.
|
|
117
|
+
* @returns {Promise<StageChannel>}
|
|
118
|
+
*/
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { DiscordSnowflake } from '@sapphire/snowflake';
|
|
2
|
+
import { Base } from './Base.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents a stage instance.
|
|
6
|
+
*
|
|
7
|
+
* @extends {Base}
|
|
8
|
+
*/
|
|
9
|
+
export class StageInstance extends Base {
|
|
10
|
+
public client: any;
|
|
11
|
+
public id: any;
|
|
12
|
+
public guildId: any;
|
|
13
|
+
public channelId: any;
|
|
14
|
+
public topic: any;
|
|
15
|
+
public privacyLevel: any;
|
|
16
|
+
public guildScheduledEventId: any;
|
|
17
|
+
constructor(client, data) {
|
|
18
|
+
super(client);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The stage instance's id
|
|
22
|
+
*
|
|
23
|
+
* @type {Snowflake}
|
|
24
|
+
*/
|
|
25
|
+
this.id = data.id;
|
|
26
|
+
|
|
27
|
+
this._patch(data);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
_patch(data) {
|
|
31
|
+
if ('guild_id' in data) {
|
|
32
|
+
/**
|
|
33
|
+
* The id of the guild associated with the stage channel
|
|
34
|
+
*
|
|
35
|
+
* @type {Snowflake}
|
|
36
|
+
*/
|
|
37
|
+
this.guildId = data.guild_id;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if ('channel_id' in data) {
|
|
41
|
+
/**
|
|
42
|
+
* The id of the channel associated with the stage channel
|
|
43
|
+
*
|
|
44
|
+
* @type {Snowflake}
|
|
45
|
+
*/
|
|
46
|
+
this.channelId = data.channel_id;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if ('topic' in data) {
|
|
50
|
+
/**
|
|
51
|
+
* The topic of the stage instance
|
|
52
|
+
*
|
|
53
|
+
* @type {string}
|
|
54
|
+
*/
|
|
55
|
+
this.topic = data.topic;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if ('privacy_level' in data) {
|
|
59
|
+
/**
|
|
60
|
+
* The privacy level of the stage instance
|
|
61
|
+
*
|
|
62
|
+
* @type {StageInstancePrivacyLevel}
|
|
63
|
+
*/
|
|
64
|
+
this.privacyLevel = data.privacy_level;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if ('guild_scheduled_event_id' in data) {
|
|
68
|
+
/**
|
|
69
|
+
* The associated guild scheduled event id of this stage instance
|
|
70
|
+
*
|
|
71
|
+
* @type {?Snowflake}
|
|
72
|
+
*/
|
|
73
|
+
this.guildScheduledEventId = data.guild_scheduled_event_id;
|
|
74
|
+
} else {
|
|
75
|
+
this.guildScheduledEventId ??= null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The stage channel associated with this stage instance
|
|
81
|
+
*
|
|
82
|
+
* @type {?StageChannel}
|
|
83
|
+
* @readonly
|
|
84
|
+
*/
|
|
85
|
+
get channel() {
|
|
86
|
+
return this.client.channels.resolve(this.channelId);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The guild this stage instance belongs to
|
|
91
|
+
*
|
|
92
|
+
* @type {?Guild}
|
|
93
|
+
* @readonly
|
|
94
|
+
*/
|
|
95
|
+
get guild() {
|
|
96
|
+
return this.client.guilds.resolve(this.guildId);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The associated guild scheduled event of this stage instance
|
|
101
|
+
*
|
|
102
|
+
* @type {?GuildScheduledEvent}
|
|
103
|
+
* @readonly
|
|
104
|
+
*/
|
|
105
|
+
get guildScheduledEvent() {
|
|
106
|
+
return this.guild?.scheduledEvents.resolve(this.guildScheduledEventId) ?? null;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Edits this stage instance.
|
|
111
|
+
*
|
|
112
|
+
* @param {StageInstanceEditOptions} options The options to edit the stage instance
|
|
113
|
+
* @returns {Promise<StageInstance>}
|
|
114
|
+
* @example
|
|
115
|
+
* // Edit a stage instance
|
|
116
|
+
* stageInstance.edit({ topic: 'new topic' })
|
|
117
|
+
* .then(stageInstance => console.log(stageInstance))
|
|
118
|
+
* .catch(console.error)
|
|
119
|
+
*/
|
|
120
|
+
async edit(options) {
|
|
121
|
+
return this.guild.stageInstances.edit(this.channelId, options);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Deletes this stage instance.
|
|
126
|
+
*
|
|
127
|
+
* @returns {Promise<StageInstance>}
|
|
128
|
+
* @example
|
|
129
|
+
* // Delete a stage instance
|
|
130
|
+
* stageInstance.delete()
|
|
131
|
+
* .then(stageInstance => console.log(stageInstance))
|
|
132
|
+
* .catch(console.error);
|
|
133
|
+
*/
|
|
134
|
+
async delete() {
|
|
135
|
+
await this.guild.stageInstances.delete(this.channelId);
|
|
136
|
+
return this._clone();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Sets the topic of this stage instance.
|
|
141
|
+
*
|
|
142
|
+
* @param {string} topic The topic for the stage instance
|
|
143
|
+
* @returns {Promise<StageInstance>}
|
|
144
|
+
* @example
|
|
145
|
+
* // Set topic of a stage instance
|
|
146
|
+
* stageInstance.setTopic('new topic')
|
|
147
|
+
* .then(stageInstance => console.log(`Set the topic to: ${stageInstance.topic}`))
|
|
148
|
+
* .catch(console.error);
|
|
149
|
+
*/
|
|
150
|
+
async setTopic(topic) {
|
|
151
|
+
return this.guild.stageInstances.edit(this.channelId, { topic });
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The timestamp this stage instances was created at
|
|
156
|
+
*
|
|
157
|
+
* @type {number}
|
|
158
|
+
* @readonly
|
|
159
|
+
*/
|
|
160
|
+
get createdTimestamp() {
|
|
161
|
+
return DiscordSnowflake.timestampFrom(this.id);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* The time this stage instance was created at
|
|
166
|
+
*
|
|
167
|
+
* @type {Date}
|
|
168
|
+
* @readonly
|
|
169
|
+
*/
|
|
170
|
+
get createdAt() {
|
|
171
|
+
return new Date(this.createdTimestamp);
|
|
172
|
+
}
|
|
173
|
+
}
|