Skip to content

VoiceState

VoiceState ⇐ Base

Represents the state of a voice connection for a user in a guild.

Kind: global class
Extends: Base

new VoiceState([data], guildId, client)

Constructs a new instance of the class.

ParamTypeDescription
[data]ObjectThe data for the voice state.
guildIdstringThe ID of the guild the voice state belongs to.
clientClientThe client instance.

voiceState.guild ⇒

Retrieves the guild associated with this guildId.

Kind: instance property of VoiceState
Returns: The guild object if found, otherwise null.

voiceState.channel ⇒ Channel | null

Retrieves the channel object associated with this instance.

Kind: instance property of VoiceState
Returns: Channel | null - The channel object, or null if it does not exist.

voiceState.user ⇒ User | null

Retrieves the user associated with this instance.

Kind: instance property of VoiceState
Returns: User | null - The user object if found, otherwise null.

voiceState.edit(options) ⇒ Promise

Edits the user’s guild member profile with the given options.

Kind: instance method of VoiceState
Returns: Promise - A promise that resolves when the edit is complete.

ParamTypeDescription
optionsObjectThe options to edit the guild member profile.

voiceState.setChannel(channel, reason) ⇒ Promise.<void>

Sets the channel for the current object and updates it with the given reason.

Kind: instance method of VoiceState
Returns: Promise.<void> - - A promise that resolves when the channel is successfully set.

ParamTypeDescription
channelChannelThe channel to set.
reasonstringThe reason for setting the channel.

voiceState.setDeaf(deaf, reason) ⇒ Promise

Sets the deaf status of the user.

Kind: instance method of VoiceState
Returns: Promise - - A promise that resolves when the deaf status is set.

ParamTypeDescription
deafbooleanWhether the user should be deafened or not.
reasonstringThe reason for setting the deaf status.

voiceState.setMute(mute, reason) ⇒ Promise

Sets the mute status and reason for an object.

Kind: instance method of VoiceState
Returns: Promise - - A promise that resolves when the mute status and reason are set.

ParamTypeDescription
mutebooleanThe mute status to set.
reasonstringThe reason for muting.

voiceState.setSuppress(suppress) ⇒ Promise.<void>

Sets the suppress property of the voice state for the user in the guild.

Kind: instance method of VoiceState
Returns: Promise.<void> - - A promise that resolves when the suppress property is set.

ParamTypeDescription
suppressbooleanThe value to set for the suppress property.

voiceState.setRequestToSpeak(requestToSpeak) ⇒ Promise.<void>

Sets the “request to speak” status for the user in the guild’s voice channel.

Kind: instance method of VoiceState
Returns: Promise.<void> - - A promise that resolves when the request to speak status is set.

ParamTypeDescription
requestToSpeakbooleanThe value indicating whether the user wants to request to speak.