Preview environment

class VoiceState

extends

Base
export class VoiceState extends Base

Represents the voice state for a Guild Member.

readonly
channel : VoiceBasedChannel | null

The channel that the member is connected to

channelId : Snowflake | null

The VoiceChannel or StageChannel id the member is in

readonly
client : Client<true>

The client that instantiated this

Inherited from: Base

readonly
deaf : boolean | null

Whether this member is either self-deafened or server-deafened

guild : Guild

The guild of this voice state

id : Snowflake

The id of the member of this voice state

readonly
member : GuildMember | null

The member that this voice state belongs to

readonly
mute : boolean | null

Whether this member is either self-muted or server-muted

requestToSpeakTimestamp : number | null

The time at which the member requested to speak. This property is specific to stage channels only.

selfDeaf : boolean | null

Whether this member is self-deafened

selfMute : boolean | null

Whether this member is self-muted

selfVideo : boolean | null

Whether this member's camera is enabled

serverDeaf : boolean | null

Whether this member is deafened server-wide

serverMute : boolean | null

Whether this member is muted server-wide

sessionId : string | null

The session id for this member's connection

streaming : boolean | null

Whether this member is streaming using "Screen Share"

suppress : boolean | null

Whether this member is suppressed from speaking. This property is specific to stage channels only.

disconnect(
reason?: string
) : Promise<GuildMember>

Disconnects the member from the channel.

edit() : Promise<this>

Edits this voice state. Currently only available when in a stage channel

fetch(
force?: boolean
) : Promise<VoiceState>

Fetches this voice state.

setChannel() : Promise<GuildMember>

Moves the member to a different channel, or disconnects them from the one they're in.

setDeaf(
deaf?: boolean
reason?: string
) : Promise<GuildMember>

Deafens/undeafens the member of this voice state.

setMute(
mute?: boolean
reason?: string
) : Promise<GuildMember>

Mutes/unmutes the member of this voice state.

setRequestToSpeak(
requestToSpeak?: boolean
) : Promise<this>

Toggles the request to speak in the channel. Only applicable for stage channels and for the client's own voice state.

Examples:
// Making the client request to speak in a stage channel (raise its hand)
guild.members.me.voice.setRequestToSpeak(true);
// Making the client cancel a request to speak
guild.members.me.voice.setRequestToSpeak(false);

setSuppressed(
suppressed?: boolean
) : Promise<this>

Suppress/unsuppress the user. Only applicable for stage channels.

Examples:
// Making the client a speaker
guild.members.me.voice.setSuppressed(false);
// Making the client an audience member
guild.members.me.voice.setSuppressed(true);
// Inviting another user to speak
voiceState.setSuppressed(false);
// Moving another user to the audience, or cancelling their invite to speak
voiceState.setSuppressed(true);

toJSON(
...props: Record<string, boolean | string>[]
) : unknown

Inherited from: Base

valueOf() : string

Inherited from: Base