VoiceState
ClassOn this page
VoiceState is a DiscordLua class representing a Discord resource. Obtain it from a manager, an event payload, or the constructor when one is documented below.
Properties
- Name
channelId- Type
any- Access
- readonly
- Description
- Instance field
VoiceState.channelId. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this VoiceState.
- Name
client- Type
any- Access
- readonly
- Description
- Owning Client instance used for REST, cache, and event dispatch.
- Availability
- Populated from the Gateway/REST payload or constructor for this VoiceState.
- Name
deaf- Type
any- Access
- mutable
- Description
- Instance field
VoiceState.deaf. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this VoiceState.
- Name
guildId- Type
any- Access
- readonly
- Description
- Instance field
VoiceState.guildId. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this VoiceState.
- Name
id- Type
any- Access
- readonly
- Description
- Snowflake id of this VoiceState.
- Availability
- Populated from the Gateway/REST payload or constructor for this VoiceState.
- Name
mute- Type
any- Access
- mutable
- Description
- Instance field
VoiceState.mute. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this VoiceState.
- Name
raw- Type
any- Access
- readonly
- Description
- Instance field
VoiceState.raw. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this VoiceState.
- Name
requestToSpeakTimestamp- Type
any- Access
- readonly
- Description
- Instance field
VoiceState.requestToSpeakTimestamp. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this VoiceState.
- Name
selfDeaf- Type
any- Access
- readonly
- Description
- Instance field
VoiceState.selfDeaf. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this VoiceState.
- Name
selfMute- Type
any- Access
- readonly
- Description
- Instance field
VoiceState.selfMute. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this VoiceState.
- Name
selfVideo- Type
any- Access
- readonly
- Description
- Instance field
VoiceState.selfVideo. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this VoiceState.
- Name
serverDeaf- Type
any- Access
- readonly
- Description
- Instance field
VoiceState.serverDeaf. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this VoiceState.
- Name
serverMute- Type
any- Access
- readonly
- Description
- Instance field
VoiceState.serverMute. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this VoiceState.
- Name
sessionId- Type
any- Access
- readonly
- Description
- Instance field
VoiceState.sessionId. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this VoiceState.
- Name
streaming- Type
any- Access
- readonly
- Description
- Instance field
VoiceState.streaming. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this VoiceState.
- Name
suppress- Type
any- Access
- readonly
- Description
- Instance field
VoiceState.suppress. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this VoiceState.
- Name
userId- Type
any- Access
- readonly
- Description
- Instance field
VoiceState.userId. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this VoiceState.
Methods
VoiceState:channel()
#Performs channel on this VoiceState. Call it from bot code when you need that operation on the current object.
Signature
VoiceState:channel() Parameters
No parameters.
Returns
VoiceState — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a VoiceState
object:channel()VoiceState:disconnect()
#Performs disconnect on this VoiceState. Call it from bot code when you need that operation on the current object.
Signature
VoiceState:disconnect() Parameters
No parameters.
Returns
VoiceState — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a VoiceState
object:disconnect()VoiceState:edit()
#Apply a REST update to this resource.
Signature
VoiceState:edit(options, callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
options |
table |
optional | Lua option table. Field names match the corresponding DiscordLua option type when one exists. |
callback |
function |
optional | Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error. |
Returns
VoiceState — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a VoiceState
object:edit({}, function(err, result)
if err then error(err) end
end)VoiceState:fetch()
#Request a fresh copy of this resource from REST and update the cache.
Signature
VoiceState:fetch(callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
callback |
function |
optional | Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error. |
Returns
VoiceState — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a VoiceState
object:fetch(function(err, result)
if err then error(err) end
end)VoiceState:guild()
#Performs guild on this VoiceState. Call it from bot code when you need that operation on the current object.
Signature
VoiceState:guild() Parameters
No parameters.
Returns
VoiceState — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a VoiceState
object:guild()VoiceState:member()
#Performs member on this VoiceState. Call it from bot code when you need that operation on the current object.
Signature
VoiceState:member() Parameters
No parameters.
Returns
VoiceState — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a VoiceState
object:member()VoiceState:setChannel()
#Set the Channel field. Builders return this VoiceState so setters can be chained.
Signature
VoiceState:setChannel(channelId, callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
channelId |
string |
required | Snowflake id string. |
callback |
function |
optional | Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error. |
Returns
VoiceState — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a VoiceState
object:setChannel("123", function(err, result)
if err then error(err) end
end)VoiceState:setDeaf()
#Set the Deaf field. Builders return this VoiceState so setters can be chained.
Signature
VoiceState:setDeaf(deaf, callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
deaf |
any |
required | Passed through to the implementation as written. |
callback |
function |
optional | Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error. |
Returns
VoiceState — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a VoiceState
object:setDeaf(deaf, function(err, result)
if err then error(err) end
end)VoiceState:setMute()
#Set the Mute field. Builders return this VoiceState so setters can be chained.
Signature
VoiceState:setMute(mute, callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
mute |
any |
required | Passed through to the implementation as written. |
callback |
function |
optional | Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error. |
Returns
VoiceState — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a VoiceState
object:setMute(mute, function(err, result)
if err then error(err) end
end)VoiceState:setRequestToSpeak()
#Set the RequestToSpeak field. Builders return this VoiceState so setters can be chained.
Signature
VoiceState:setRequestToSpeak(request, callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
request |
any |
required | Passed through to the implementation as written. |
callback |
function |
optional | Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error. |
Returns
VoiceState — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a VoiceState
object:setRequestToSpeak(request, function(err, result)
if err then error(err) end
end)VoiceState:setSuppressed()
#Set the Suppressed field. Builders return this VoiceState so setters can be chained.
Signature
VoiceState:setSuppressed(suppressed, callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
suppressed |
any |
required | Passed through to the implementation as written. |
callback |
function |
optional | Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error. |
Returns
VoiceState — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a VoiceState
object:setSuppressed(suppressed, function(err, result)
if err then error(err) end
end)Examples
Obtain this object from a manager, wrap helper, or event payload — it is not constructed directly in typical bot code.
Related APIs
ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationRoleConnectionMetadata · Attachment
Version: discord 1.2.4 · runtime 1.0.0