DiscordLua
discorddiscord
v1.2.4
Install

VoiceState

Class
On 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.

class Module 1.2.4 REST Source

Properties

VoiceState.channelId

# readonly
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.

VoiceState.client

# readonly
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.

VoiceState.deaf

# mutable
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.

VoiceState.guildId

# readonly
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.

VoiceState.id

# readonly
Name
id
Type
any
Access
readonly
Description
Snowflake id of this VoiceState.
Availability
Populated from the Gateway/REST payload or constructor for this VoiceState.

VoiceState.mute

# mutable
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.

VoiceState.raw

# readonly
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.

VoiceState.requestToSpeakTimestamp

# readonly
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.

VoiceState.selfDeaf

# readonly
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.

VoiceState.selfMute

# readonly
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.

VoiceState.selfVideo

# readonly
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.

VoiceState.serverDeaf

# readonly
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.

VoiceState.serverMute

# readonly
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.

VoiceState.sessionId

# readonly
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.

VoiceState.streaming

# readonly
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.

VoiceState.suppress

# readonly
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.

VoiceState.userId

# readonly
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

lua
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

lua
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

NameTypeRequiredBehavior
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

lua
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

NameTypeRequiredBehavior
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

VoiceState — the same instance, for chaining.

Example

lua
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

lua
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

lua
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

NameTypeRequiredBehavior
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

lua
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

NameTypeRequiredBehavior
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

lua
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

NameTypeRequiredBehavior
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

lua
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

NameTypeRequiredBehavior
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

lua
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

NameTypeRequiredBehavior
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

lua
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.

ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationRoleConnectionMetadata · Attachment

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc