VoiceState class

const voiceState = new VoiceState(voiceState: VoiceState, addon: Addon);

constructor

The constructor of the VoiceState class requires two arguments. The first argument must be an instance of the Discord.js VoiceState class which provides the data of the voice state. The second argument must be an instance of the Zyno Bot Addons Addon class which defines the addon where the VoiceState class should be created for.

Properties

id

The id of the member where the voice state applies to.

member

An instance of the Member class and defines the member where the voice state applies to.

guild

An instance of the Zyno Bot Addons Guild class which represents the guild where the voice state of the member applies to.

guildId

The id of the guild where the voice state of the member applies to.

connected

A boolean which defines whether the member was connected to a voice channel at the time of the creation of the VoiceState class.

selfMute

A boolean which defines whether the member has muted itself or not.

selfDeaf

A boolean which defines whether the member has deafened itself or not.

selfVideo

A boolean which defines whether the member has enabled its webcam or not.

streaming

A boolean which defines whether the member is sharing its screen or not.

suppress

A boolean which defines whether the member is suppressed from speaking or not.

serverMute

A boolean which defines whether the member was muted by a moderator or not.

serverDeaf

A boolean which defines whether the member was deafened by a moderator or not.

mute

A boolean which defines whether the member was (server-)muted or not.

deaf

A boolean which defines whether the member was (server-)deafened or not.

channelId

The id of the voice channel where the member is connected with (if the member is connected to a voice channel).

channel

An instance of the VoiceChannel class or the StageChannel class which defines the voice channel the member is connected with (if the member is connected to a voice channel).

Functions

disconnect

voiceState.disconnect(reason?: string) : Promise<void>;

Disconnects the member from the voice channel in case the member is connected to a voice channel. The function returns a Promise which gets fulfilled once the member has successfully been disconnected.

setDeaf

voiceState.setDeaf(deaf?: boolean, reason?: string) : Promise<void>;

Deafens or undeafens the member. The function returns a Promise which gets fulfilled once the member has successfully been deafened or undeafend.

setMute

voiceState.setMute(mute?: boolean, reason?: string) : Promise<void>;

Mutes or unmutes the member. The function returns a Promise which gets fulfilled once the member has successfully been muted or unmuted.

setChannel

voiceState.setChannel(channel: VoiceChannel | StageChannel, reason?: string) : Promise<void>;

Changes the current voice or stage channel a member is in. The function only works when a member has already joined a voice or stage channel. The function returns a Promise which will be fulfilled once the member has been moved to a different voice or stage channel.

Last updated