VoiceState
classe · Source
Represents the voice state for a Guild Member.
Extends: Base
Properties
guild
The guild of this voice state Source
id
The id of the member of this voice state Source
serverDeaf
Whether this member is deafened server-wide Source
serverMute
Whether this member is muted server-wide Source
selfDeaf
Whether this member is self-deafened Source
selfMute
Whether this member is self-muted Source
selfVideo
Whether this member's camera is enabled Source
sessionId
The session id for this member's connection Source
streaming
Whether this member is streaming using "Screen Share" Source
channelId
The VoiceChannel or StageChannel id the member is in Source
suppress
Whether this member is suppressed from speaking. This property is specific to stage channels only. Source
requestToSpeakTimestamp
The time at which the member requested to speak. This property is specific to stage channels only. Source
member
The member that this voice state belongs to Source
user
The user that this voice state belongs to Source
channel
The channel that the member is connected to Source
deaf
Whether this member is either self-deafened or server-deafened Source
mute
Whether this member is either self-muted or server-muted Source
client
The client that instantiated this Source
Methods
setMute
Mutes/unmutes the member of this voice state. Parameters
| Name | Type | Description |
|---|---|---|
mute? | boolean | Whether or not the member should be muted Default: true. |
reason? | string | Reason for muting or unmuting |
Returns: Promise<GuildMember>Source
setDeaf
Deafens/undeafens the member of this voice state. Parameters
| Name | Type | Description |
|---|---|---|
deaf? | boolean | Whether or not the member should be deafened Default: true. |
reason? | string | Reason for deafening or undeafening |
Returns: Promise<GuildMember>Source
disconnect
Disconnects the member from the channel. Parameters
| Name | Type | Description |
|---|---|---|
reason? | string | Reason for disconnecting the member from the channel |
Returns: Promise<GuildMember>Source
setChannel
Moves the member to a different channel, or disconnects them from the one they're in. Parameters
| Name | Type | Description |
|---|---|---|
channel | GuildVoiceChannelResolvable | null | Channel to move the member to, or null if you want todisconnect them from voice. |
reason? | string | Reason for moving member to another channel or disconnecting |
Returns: Promise<GuildMember>Source
setRequestToSpeak
Toggles the request to speak in the channel. Only applicable for stage channels and for the client's own voice state. Parameters
| Name | Type | Description |
|---|---|---|
request? | boolean | Whether or not the client is requesting to become a speaker. Default: true. |
Returns: Promise<void>
// 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
Suppress/unsuppress the user. Only applicable for stage channels. Parameters
| Name | Type | Description |
|---|---|---|
suppressed? | boolean | Whether or not the user should be suppressed. Default: true. |
Returns: Promise<void>
// 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);setStatus
Sets the status of the voice channel Parameters
| Name | Type | Description |
|---|---|---|
status? | string | The message to set the channel status to Default: "". |
Returns: Promise<void>
// Setting the status to something
guild.members.me.voice.setStatus("something")// Removing the status
guild.members.me.voice.setStatus()getPreview
Get URL Image of the user's streaming video (NOT STREAMING !!!) Returns: Promise<string> — URL Image of the user's streaming video Source
postPreview
Post Preview Image to the client user's streaming video Parameters
| Name | Type | Description |
|---|---|---|
base64Image | string | Base64 URI (data:image/jpeg;base64,data) |
Returns: Promise<void>Source
fetch
Fetches this voice state. Parameters
| Name | Type | Description |
|---|---|---|
force? | boolean | Whether to skip the cache check and request the API Default: true. |
Returns: Promise<VoiceState>Source