Skip to content

VoiceState

classe · Source

Represents the voice state for a Guild Member.

Extends: Base

Properties

guild

guild: Guild

The guild of this voice state Source

id

id: Snowflake

The id of the member of this voice state Source

serverDeaf

nullable

serverDeaf: boolean

Whether this member is deafened server-wide Source

serverMute

nullable

serverMute: boolean

Whether this member is muted server-wide Source

selfDeaf

nullable

selfDeaf: boolean

Whether this member is self-deafened Source

selfMute

nullable

selfMute: boolean

Whether this member is self-muted Source

selfVideo

nullable

selfVideo: boolean

Whether this member's camera is enabled Source

sessionId

nullable

sessionId: string

The session id for this member's connection Source

streaming

streaming: boolean

Whether this member is streaming using "Screen Share" Source

channelId

nullable

channelId: Snowflake

The VoiceChannel or StageChannel id the member is in Source

suppress

suppress: boolean

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

requestToSpeakTimestamp

nullable

requestToSpeakTimestamp: number

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

member

readonly · nullable

member: GuildMember

The member that this voice state belongs to Source

user

readonly · nullable

user: User

The user that this voice state belongs to Source

channel

readonly · nullable

channel: VoiceChannel | StageChannel | DMChannel | GroupDMChannel

The channel that the member is connected to Source

deaf

readonly · nullable

deaf: boolean

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

mute

readonly · nullable

mute: boolean

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

client

readonly

client: Client

The client that instantiated this Source

Methods

setMute

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

Mutes/unmutes the member of this voice state. Parameters

NameTypeDescription
mute?booleanWhether or not the member should be muted Default: true.
reason?stringReason for muting or unmuting

Returns: Promise<GuildMember>Source

setDeaf

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

Deafens/undeafens the member of this voice state. Parameters

NameTypeDescription
deaf?booleanWhether or not the member should be deafened Default: true.
reason?stringReason for deafening or undeafening

Returns: Promise<GuildMember>Source

disconnect

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

Disconnects the member from the channel. Parameters

NameTypeDescription
reason?stringReason for disconnecting the member from the channel

Returns: Promise<GuildMember>Source

setChannel

setChannel(channel: GuildVoiceChannelResolvable | null, reason?: string): Promise<GuildMember>

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

NameTypeDescription
channelGuildVoiceChannelResolvable | nullChannel to move the member to, or null if you want to
disconnect them from voice.
reason?stringReason for moving member to another channel or disconnecting

Returns: Promise<GuildMember>Source

setRequestToSpeak

async

async setRequestToSpeak(request?: boolean): Promise<void>

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

NameTypeDescription
request?booleanWhether or not the client is requesting to become a speaker. Default: true.

Returns: Promise<void>

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

Source

setSuppressed

async

async setSuppressed(suppressed?: boolean): Promise<void>

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

NameTypeDescription
suppressed?booleanWhether or not the user should be suppressed. Default: true.

Returns: Promise<void>

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

Source

setStatus

setStatus(status?: string): Promise<void>

Sets the status of the voice channel Parameters

NameTypeDescription
status?stringThe message to set the channel status to Default: "".

Returns: Promise<void>

js
// Setting the status to something
guild.members.me.voice.setStatus("something")
js
// Removing the status
guild.members.me.voice.setStatus()

Source

getPreview

async

async getPreview(): Promise<string>

Get URL Image of the user's streaming video (NOT STREAMING !!!) Returns: Promise<string> — URL Image of the user's streaming video Source

postPreview

postPreview(base64Image: string): Promise<void>

Post Preview Image to the client user's streaming video Parameters

NameTypeDescription
base64ImagestringBase64 URI (data:image/jpeg;base64,data)

Returns: Promise<void>Source

fetch

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

Fetches this voice state. Parameters

NameTypeDescription
force?booleanWhether to skip the cache check and request the API Default: true.

Returns: Promise<VoiceState>Source

Unofficial software. Not affiliated with or supported by Discord.