@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,119 @@
|
|
|
1
|
+
import { PermissionFlagsBits, Routes } from 'discord-api-types/v10';
|
|
2
|
+
import { BaseGuildVoiceChannel } from './BaseGuildVoiceChannel.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents a guild voice channel on Discord.
|
|
6
|
+
*
|
|
7
|
+
* @extends {BaseGuildVoiceChannel}
|
|
8
|
+
*/
|
|
9
|
+
export class VoiceChannel extends BaseGuildVoiceChannel {
|
|
10
|
+
/**
|
|
11
|
+
* Whether the channel is joinable by the client user
|
|
12
|
+
*
|
|
13
|
+
* @type {boolean}
|
|
14
|
+
* @readonly
|
|
15
|
+
*/
|
|
16
|
+
get joinable() {
|
|
17
|
+
if (!super.joinable) return false;
|
|
18
|
+
return !this.full || this.permissionsFor(this.client.user).has(PermissionFlagsBits.MoveMembers, false);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Checks if the client has permission to send audio to the voice channel
|
|
23
|
+
*
|
|
24
|
+
* @type {boolean}
|
|
25
|
+
* @readonly
|
|
26
|
+
*/
|
|
27
|
+
get speakable() {
|
|
28
|
+
const permissions = this.permissionsFor(this.client.user);
|
|
29
|
+
if (!permissions) return false;
|
|
30
|
+
// This flag allows speaking even if timed out
|
|
31
|
+
if (permissions.has(PermissionFlagsBits.Administrator, false)) return true;
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
this.guild.members.me.communicationDisabledUntilTimestamp < Date.now() &&
|
|
35
|
+
permissions.has(PermissionFlagsBits.Speak, false)
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @typedef {Object} SendSoundboardSoundOptions
|
|
41
|
+
* @property {string} soundId The id of the soundboard sound to send
|
|
42
|
+
* @property {string} [guildId] The id of the guild the soundboard sound is a part of
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Send a soundboard sound to a voice channel the user is connected to.
|
|
47
|
+
*
|
|
48
|
+
* @param {SoundboardSound|SendSoundboardSoundOptions} sound The sound to send
|
|
49
|
+
* @returns {Promise<void>}
|
|
50
|
+
*/
|
|
51
|
+
async sendSoundboardSound(sound) {
|
|
52
|
+
await this.client.rest.post(Routes.sendSoundboardSound(this.id), {
|
|
53
|
+
body: {
|
|
54
|
+
sound_id: sound.soundId,
|
|
55
|
+
source_guild_id: sound.guildId ?? undefined,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Sets the bitrate of the channel.
|
|
63
|
+
*
|
|
64
|
+
* @method setBitrate
|
|
65
|
+
* @memberof VoiceChannel
|
|
66
|
+
* @instance
|
|
67
|
+
* @param {number} bitrate The new bitrate
|
|
68
|
+
* @param {string} [reason] Reason for changing the channel's bitrate
|
|
69
|
+
* @returns {Promise<VoiceChannel>}
|
|
70
|
+
* @example
|
|
71
|
+
* // Set the bitrate of a voice channel
|
|
72
|
+
* voiceChannel.setBitrate(48_000)
|
|
73
|
+
* .then(channel => console.log(`Set bitrate to ${channel.bitrate}bps for ${channel.name}`))
|
|
74
|
+
* .catch(console.error);
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Sets the RTC region of the channel.
|
|
79
|
+
*
|
|
80
|
+
* @method setRTCRegion
|
|
81
|
+
* @memberof VoiceChannel
|
|
82
|
+
* @instance
|
|
83
|
+
* @param {?string} rtcRegion The new region of the channel. Set to `null` to remove a specific region for the channel
|
|
84
|
+
* @param {string} [reason] The reason for modifying this region.
|
|
85
|
+
* @returns {Promise<VoiceChannel>}
|
|
86
|
+
* @example
|
|
87
|
+
* // Set the RTC region to sydney
|
|
88
|
+
* voiceChannel.setRTCRegion('sydney');
|
|
89
|
+
* @example
|
|
90
|
+
* // Remove a fixed region for this channel - let Discord decide automatically
|
|
91
|
+
* voiceChannel.setRTCRegion(null, 'We want to let Discord decide.');
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Sets the user limit of the channel.
|
|
96
|
+
*
|
|
97
|
+
* @method setUserLimit
|
|
98
|
+
* @memberof VoiceChannel
|
|
99
|
+
* @instance
|
|
100
|
+
* @param {number} userLimit The new user limit
|
|
101
|
+
* @param {string} [reason] Reason for changing the user limit
|
|
102
|
+
* @returns {Promise<VoiceChannel>}
|
|
103
|
+
* @example
|
|
104
|
+
* // Set the user limit of a voice channel
|
|
105
|
+
* voiceChannel.setUserLimit(42)
|
|
106
|
+
* .then(channel => console.log(`Set user limit to ${channel.userLimit} for ${channel.name}`))
|
|
107
|
+
* .catch(console.error);
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Sets the camera video quality mode of the channel.
|
|
112
|
+
*
|
|
113
|
+
* @method setVideoQualityMode
|
|
114
|
+
* @memberof VoiceChannel
|
|
115
|
+
* @instance
|
|
116
|
+
* @param {VideoQualityMode} videoQualityMode The new camera video quality mode.
|
|
117
|
+
* @param {string} [reason] Reason for changing the camera video quality mode.
|
|
118
|
+
* @returns {Promise<VoiceChannel>}
|
|
119
|
+
*/
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Emoji } from './Emoji.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents an effect used in a {@link VoiceChannel}.
|
|
5
|
+
*/
|
|
6
|
+
export class VoiceChannelEffect {
|
|
7
|
+
public guild: any;
|
|
8
|
+
public channelId: any;
|
|
9
|
+
public userId: any;
|
|
10
|
+
public emoji: any;
|
|
11
|
+
public animationType: any;
|
|
12
|
+
public animationId: any;
|
|
13
|
+
public soundId: any;
|
|
14
|
+
public soundVolume: any;
|
|
15
|
+
constructor(data, guild) {
|
|
16
|
+
/**
|
|
17
|
+
* The guild where the effect was sent from.
|
|
18
|
+
*
|
|
19
|
+
* @type {Guild}
|
|
20
|
+
*/
|
|
21
|
+
this.guild = guild;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The id of the channel the effect was sent in.
|
|
25
|
+
*
|
|
26
|
+
* @type {Snowflake}
|
|
27
|
+
*/
|
|
28
|
+
this.channelId = data.channel_id;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The id of the user that sent the effect.
|
|
32
|
+
*
|
|
33
|
+
* @type {Snowflake}
|
|
34
|
+
*/
|
|
35
|
+
this.userId = data.user_id;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The emoji of the effect.
|
|
39
|
+
*
|
|
40
|
+
* @type {?Emoji}
|
|
41
|
+
*/
|
|
42
|
+
this.emoji = data.emoji ? new Emoji(guild.client, data.emoji) : null;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The animation type of the effect.
|
|
46
|
+
*
|
|
47
|
+
* @type {?VoiceChannelEffectSendAnimationType}
|
|
48
|
+
*/
|
|
49
|
+
this.animationType = data.animation_type ?? null;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The animation id of the effect.
|
|
53
|
+
*
|
|
54
|
+
* @type {?number}
|
|
55
|
+
*/
|
|
56
|
+
this.animationId = data.animation_id ?? null;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The id of the soundboard sound for soundboard effects.
|
|
60
|
+
*
|
|
61
|
+
* @type {?(Snowflake|number)}
|
|
62
|
+
*/
|
|
63
|
+
this.soundId = data.sound_id ?? null;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The volume of the soundboard sound [0-1] for soundboard effects.
|
|
67
|
+
*
|
|
68
|
+
* @type {?number}
|
|
69
|
+
*/
|
|
70
|
+
this.soundVolume = data.sound_volume ?? null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The channel the effect was sent in.
|
|
75
|
+
*
|
|
76
|
+
* @type {?VoiceChannel}
|
|
77
|
+
* @readonly
|
|
78
|
+
*/
|
|
79
|
+
get channel() {
|
|
80
|
+
return this.guild.channels.cache.get(this.channelId) ?? null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The soundboard sound for soundboard effects.
|
|
85
|
+
*
|
|
86
|
+
* @type {?SoundboardSound}
|
|
87
|
+
* @readonly
|
|
88
|
+
*/
|
|
89
|
+
get soundboardSound() {
|
|
90
|
+
return this.guild.soundboardSounds.cache.get(this.soundId) ?? null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { flatten } from '../util/Util.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents a Discord voice region for guilds.
|
|
5
|
+
*/
|
|
6
|
+
export class VoiceRegion {
|
|
7
|
+
public id: any;
|
|
8
|
+
public name: any;
|
|
9
|
+
public deprecated: any;
|
|
10
|
+
public optimal: any;
|
|
11
|
+
public custom: any;
|
|
12
|
+
constructor(data) {
|
|
13
|
+
/**
|
|
14
|
+
* The region's id
|
|
15
|
+
*
|
|
16
|
+
* @type {string}
|
|
17
|
+
*/
|
|
18
|
+
this.id = data.id;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Name of the region
|
|
22
|
+
*
|
|
23
|
+
* @type {string}
|
|
24
|
+
*/
|
|
25
|
+
this.name = data.name;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Whether the region is deprecated
|
|
29
|
+
*
|
|
30
|
+
* @type {boolean}
|
|
31
|
+
*/
|
|
32
|
+
this.deprecated = data.deprecated;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Whether the region is optimal
|
|
36
|
+
*
|
|
37
|
+
* @type {boolean}
|
|
38
|
+
*/
|
|
39
|
+
this.optimal = data.optimal;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Whether the region is custom
|
|
43
|
+
*
|
|
44
|
+
* @type {boolean}
|
|
45
|
+
*/
|
|
46
|
+
this.custom = data.custom;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
toJSON() {
|
|
50
|
+
return flatten(this);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import { ChannelType, Routes } from 'discord-api-types/v10';
|
|
2
|
+
import { DiscordjsError, DiscordjsTypeError, ErrorCodes } from '../errors/index.js';
|
|
3
|
+
import { Base } from './Base.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents the voice state for a Guild Member.
|
|
7
|
+
*
|
|
8
|
+
* @extends {Base}
|
|
9
|
+
*/
|
|
10
|
+
export class VoiceState extends Base {
|
|
11
|
+
public guild: any;
|
|
12
|
+
public id: any;
|
|
13
|
+
public serverDeaf: any;
|
|
14
|
+
public serverMute: any;
|
|
15
|
+
public selfDeaf: any;
|
|
16
|
+
public selfMute: any;
|
|
17
|
+
public selfVideo: any;
|
|
18
|
+
public sessionId: any;
|
|
19
|
+
public streaming: any;
|
|
20
|
+
public channelId: any;
|
|
21
|
+
public suppress: any;
|
|
22
|
+
public requestToSpeakTimestamp: any;
|
|
23
|
+
constructor(guild, data) {
|
|
24
|
+
super(guild.client);
|
|
25
|
+
/**
|
|
26
|
+
* The guild of this voice state
|
|
27
|
+
*
|
|
28
|
+
* @type {Guild}
|
|
29
|
+
*/
|
|
30
|
+
this.guild = guild;
|
|
31
|
+
/**
|
|
32
|
+
* The id of the member of this voice state
|
|
33
|
+
*
|
|
34
|
+
* @type {Snowflake}
|
|
35
|
+
*/
|
|
36
|
+
this.id = data.user_id;
|
|
37
|
+
this._patch(data);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
_patch(data) {
|
|
41
|
+
if ('deaf' in data) {
|
|
42
|
+
/**
|
|
43
|
+
* Whether this member is deafened server-wide
|
|
44
|
+
*
|
|
45
|
+
* @type {?boolean}
|
|
46
|
+
*/
|
|
47
|
+
this.serverDeaf = data.deaf;
|
|
48
|
+
} else {
|
|
49
|
+
this.serverDeaf ??= null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if ('mute' in data) {
|
|
53
|
+
/**
|
|
54
|
+
* Whether this member is muted server-wide
|
|
55
|
+
*
|
|
56
|
+
* @type {?boolean}
|
|
57
|
+
*/
|
|
58
|
+
this.serverMute = data.mute;
|
|
59
|
+
} else {
|
|
60
|
+
this.serverMute ??= null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if ('self_deaf' in data) {
|
|
64
|
+
/**
|
|
65
|
+
* Whether this member is self-deafened
|
|
66
|
+
*
|
|
67
|
+
* @type {?boolean}
|
|
68
|
+
*/
|
|
69
|
+
this.selfDeaf = data.self_deaf;
|
|
70
|
+
} else {
|
|
71
|
+
this.selfDeaf ??= null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if ('self_mute' in data) {
|
|
75
|
+
/**
|
|
76
|
+
* Whether this member is self-muted
|
|
77
|
+
*
|
|
78
|
+
* @type {?boolean}
|
|
79
|
+
*/
|
|
80
|
+
this.selfMute = data.self_mute;
|
|
81
|
+
} else {
|
|
82
|
+
this.selfMute ??= null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if ('self_video' in data) {
|
|
86
|
+
/**
|
|
87
|
+
* Whether this member's camera is enabled
|
|
88
|
+
*
|
|
89
|
+
* @type {?boolean}
|
|
90
|
+
*/
|
|
91
|
+
this.selfVideo = data.self_video;
|
|
92
|
+
} else {
|
|
93
|
+
this.selfVideo ??= null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if ('session_id' in data) {
|
|
97
|
+
/**
|
|
98
|
+
* The session id for this member's connection
|
|
99
|
+
*
|
|
100
|
+
* @type {?string}
|
|
101
|
+
*/
|
|
102
|
+
this.sessionId = data.session_id;
|
|
103
|
+
} else {
|
|
104
|
+
this.sessionId ??= null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// The self_stream is property is omitted if false, check for another property
|
|
108
|
+
// here to avoid incorrectly clearing this when partial data is specified
|
|
109
|
+
if ('self_video' in data) {
|
|
110
|
+
/**
|
|
111
|
+
* Whether this member is streaming using "Screen Share"
|
|
112
|
+
*
|
|
113
|
+
* @type {?boolean}
|
|
114
|
+
*/
|
|
115
|
+
this.streaming = data.self_stream ?? false;
|
|
116
|
+
} else {
|
|
117
|
+
this.streaming ??= null;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if ('channel_id' in data) {
|
|
121
|
+
/**
|
|
122
|
+
* The {@link VoiceChannel} or {@link StageChannel} id the member is in
|
|
123
|
+
*
|
|
124
|
+
* @type {?Snowflake}
|
|
125
|
+
*/
|
|
126
|
+
this.channelId = data.channel_id;
|
|
127
|
+
} else {
|
|
128
|
+
this.channelId ??= null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if ('suppress' in data) {
|
|
132
|
+
/**
|
|
133
|
+
* Whether this member is suppressed from speaking. This property is specific to stage channels only.
|
|
134
|
+
*
|
|
135
|
+
* @type {?boolean}
|
|
136
|
+
*/
|
|
137
|
+
this.suppress = data.suppress;
|
|
138
|
+
} else {
|
|
139
|
+
this.suppress ??= null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if ('request_to_speak_timestamp' in data) {
|
|
143
|
+
/**
|
|
144
|
+
* The time at which the member requested to speak. This property is specific to stage channels only.
|
|
145
|
+
*
|
|
146
|
+
* @type {?number}
|
|
147
|
+
*/
|
|
148
|
+
this.requestToSpeakTimestamp = data.request_to_speak_timestamp && Date.parse(data.request_to_speak_timestamp);
|
|
149
|
+
} else {
|
|
150
|
+
this.requestToSpeakTimestamp ??= null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return this;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The member that this voice state belongs to
|
|
158
|
+
*
|
|
159
|
+
* @type {?GuildMember}
|
|
160
|
+
* @readonly
|
|
161
|
+
*/
|
|
162
|
+
get member() {
|
|
163
|
+
return this.guild.members.cache.get(this.id) ?? null;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The channel that the member is connected to
|
|
168
|
+
*
|
|
169
|
+
* @type {?(VoiceChannel|StageChannel)}
|
|
170
|
+
* @readonly
|
|
171
|
+
*/
|
|
172
|
+
get channel() {
|
|
173
|
+
return this.guild.channels.cache.get(this.channelId) ?? null;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Whether this member is either self-deafened or server-deafened
|
|
178
|
+
*
|
|
179
|
+
* @type {?boolean}
|
|
180
|
+
* @readonly
|
|
181
|
+
*/
|
|
182
|
+
get deaf() {
|
|
183
|
+
return this.serverDeaf || this.selfDeaf;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Whether this member is either self-muted or server-muted
|
|
188
|
+
*
|
|
189
|
+
* @type {?boolean}
|
|
190
|
+
* @readonly
|
|
191
|
+
*/
|
|
192
|
+
get mute() {
|
|
193
|
+
return this.serverMute || this.selfMute;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Mutes/unmutes the member of this voice state.
|
|
198
|
+
*
|
|
199
|
+
* @param {boolean} [mute=true] Whether or not the member should be muted
|
|
200
|
+
* @param {string} [reason] Reason for muting or unmuting
|
|
201
|
+
* @returns {Promise<GuildMember>}
|
|
202
|
+
*/
|
|
203
|
+
async setMute(mute = true, reason = undefined) {
|
|
204
|
+
return this.guild.members.edit(this.id, { mute, reason });
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Deafens/undeafens the member of this voice state.
|
|
209
|
+
*
|
|
210
|
+
* @param {boolean} [deaf=true] Whether or not the member should be deafened
|
|
211
|
+
* @param {string} [reason] Reason for deafening or undeafening
|
|
212
|
+
* @returns {Promise<GuildMember>}
|
|
213
|
+
*/
|
|
214
|
+
async setDeaf(deaf = true, reason = undefined) {
|
|
215
|
+
return this.guild.members.edit(this.id, { deaf, reason });
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Disconnects the member from the channel.
|
|
220
|
+
*
|
|
221
|
+
* @param {string} [reason] Reason for disconnecting the member from the channel
|
|
222
|
+
* @returns {Promise<GuildMember>}
|
|
223
|
+
*/
|
|
224
|
+
async disconnect(reason) {
|
|
225
|
+
return this.setChannel(null, reason);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Moves the member to a different channel, or disconnects them from the one they're in.
|
|
230
|
+
*
|
|
231
|
+
* @param {?GuildVoiceChannelResolvable} channel Channel to move the member to, or `null` if you want to
|
|
232
|
+
* disconnect them from voice.
|
|
233
|
+
* @param {string} [reason] Reason for moving member to another channel or disconnecting
|
|
234
|
+
* @returns {Promise<GuildMember>}
|
|
235
|
+
*/
|
|
236
|
+
async setChannel(channel, reason) {
|
|
237
|
+
return this.guild.members.edit(this.id, { channel, reason });
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Data to edit the logged in user's own voice state with, when in a stage channel
|
|
242
|
+
*
|
|
243
|
+
* @typedef {Object} VoiceStateEditOptions
|
|
244
|
+
* @property {boolean} [requestToSpeak] Whether or not the client is requesting to become a speaker.
|
|
245
|
+
* <info>Only available to the logged in user's own voice state.</info>
|
|
246
|
+
* @property {boolean} [suppressed] Whether or not the user should be suppressed.
|
|
247
|
+
*/
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Edits this voice state. Currently only available when in a stage channel
|
|
251
|
+
*
|
|
252
|
+
* @param {VoiceStateEditOptions} options The options to provide
|
|
253
|
+
* @returns {Promise<VoiceState>}
|
|
254
|
+
*/
|
|
255
|
+
async edit(options) {
|
|
256
|
+
if (this.channel?.type !== ChannelType.GuildStageVoice) throw new DiscordjsError(ErrorCodes.VoiceNotStageChannel);
|
|
257
|
+
|
|
258
|
+
const target = this.client.user.id === this.id ? '@me' : this.id;
|
|
259
|
+
|
|
260
|
+
if (target !== '@me' && options.requestToSpeak !== undefined) {
|
|
261
|
+
throw new DiscordjsError(ErrorCodes.VoiceStateNotOwn);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (!['boolean', 'undefined'].includes(typeof options.requestToSpeak)) {
|
|
265
|
+
throw new DiscordjsTypeError(ErrorCodes.VoiceStateInvalidType, 'requestToSpeak');
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (!['boolean', 'undefined'].includes(typeof options.suppressed)) {
|
|
269
|
+
throw new DiscordjsTypeError(ErrorCodes.VoiceStateInvalidType, 'suppressed');
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
await this.client.rest.patch(Routes.guildVoiceState(this.guild.id, target), {
|
|
273
|
+
body: {
|
|
274
|
+
channel_id: this.channelId,
|
|
275
|
+
request_to_speak_timestamp: options.requestToSpeak
|
|
276
|
+
? new Date().toISOString()
|
|
277
|
+
: options.requestToSpeak === false
|
|
278
|
+
? null
|
|
279
|
+
: undefined,
|
|
280
|
+
suppress: options.suppressed,
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
return this;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Fetches this voice state.
|
|
288
|
+
*
|
|
289
|
+
* @param {boolean} [force=true] Whether to skip the cache check and request the API
|
|
290
|
+
* @returns {Promise<VoiceState>}
|
|
291
|
+
*/
|
|
292
|
+
async fetch(force = true) {
|
|
293
|
+
return this.guild.voiceStates.fetch(this.id, { force });
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Toggles the request to speak in the channel.
|
|
298
|
+
* Only applicable for stage channels and for the client's own voice state.
|
|
299
|
+
*
|
|
300
|
+
* @param {boolean} [requestToSpeak=true] Whether or not the client is requesting to become a speaker.
|
|
301
|
+
* @example
|
|
302
|
+
* // Making the client request to speak in a stage channel (raise its hand)
|
|
303
|
+
* guild.members.me.voice.setRequestToSpeak(true);
|
|
304
|
+
* @example
|
|
305
|
+
* // Making the client cancel a request to speak
|
|
306
|
+
* guild.members.me.voice.setRequestToSpeak(false);
|
|
307
|
+
* @returns {Promise<VoiceState>}
|
|
308
|
+
*/
|
|
309
|
+
async setRequestToSpeak(requestToSpeak = true) {
|
|
310
|
+
return this.edit({ requestToSpeak });
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Suppress/unsuppress the user. Only applicable for stage channels.
|
|
315
|
+
*
|
|
316
|
+
* @param {boolean} [suppressed=true] Whether or not the user should be suppressed.
|
|
317
|
+
* @example
|
|
318
|
+
* // Making the client a speaker
|
|
319
|
+
* guild.members.me.voice.setSuppressed(false);
|
|
320
|
+
* @example
|
|
321
|
+
* // Making the client an audience member
|
|
322
|
+
* guild.members.me.voice.setSuppressed(true);
|
|
323
|
+
* @example
|
|
324
|
+
* // Inviting another user to speak
|
|
325
|
+
* voiceState.setSuppressed(false);
|
|
326
|
+
* @example
|
|
327
|
+
* // Moving another user to the audience, or cancelling their invite to speak
|
|
328
|
+
* voiceState.setSuppressed(true);
|
|
329
|
+
* @returns {Promise<VoiceState>}
|
|
330
|
+
*/
|
|
331
|
+
async setSuppressed(suppressed = true) {
|
|
332
|
+
return this.edit({ suppressed });
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
toJSON() {
|
|
336
|
+
return super.toJSON({
|
|
337
|
+
id: true,
|
|
338
|
+
serverDeaf: true,
|
|
339
|
+
serverMute: true,
|
|
340
|
+
selfDeaf: true,
|
|
341
|
+
selfMute: true,
|
|
342
|
+
sessionId: true,
|
|
343
|
+
channelId: 'channel',
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
}
|