ClientUser
ClassOn this page
ClientUser 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
avatarDecorationData- Type
any- Access
- readonly
- Description
- Instance field
ClientUser.avatarDecorationData. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this ClientUser.
- Name
collectibles- Type
any- Access
- readonly
- Description
- Instance field
ClientUser.collectibles. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this ClientUser.
- Name
mfaEnabled- Type
any- Access
- readonly
- Description
- Instance field
ClientUser.mfaEnabled. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this ClientUser.
- Name
presence- Type
any- Access
- mutable
- Description
- Instance field
ClientUser.presence. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this ClientUser.
- Name
verified- Type
any- Access
- readonly
- Description
- Instance field
ClientUser.verified. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this ClientUser.
Methods
ClientUser:edit()
#Apply a REST update to this resource.
Signature
ClientUser:edit(options) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
options |
table |
optional | Lua option table. Field names match the corresponding DiscordLua option type when one exists. |
Returns
ClientUser — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ClientUser
object:edit({})ClientUser:setActivity()
#Set the Activity field. Builders return this ClientUser so setters can be chained.
Signature
ClientUser:setActivity(name, typeValue) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
name |
any |
required | Passed through to the implementation as written. |
typeValue |
any |
required | Passed through to the implementation as written. |
Returns
ClientUser — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ClientUser
object:setActivity(name, typeValue)ClientUser:setAFK()
#Set the AFK field. Builders return this ClientUser so setters can be chained.
Signature
ClientUser:setAFK(afk) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
afk |
any |
required | Passed through to the implementation as written. |
Returns
ClientUser — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ClientUser
object:setAFK(afk)ClientUser:setAvatar()
#Set the Avatar field. Builders return this ClientUser so setters can be chained.
Signature
ClientUser:setAvatar(avatar) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
avatar |
any |
required | Passed through to the implementation as written. |
Returns
ClientUser — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ClientUser
object:setAvatar(avatar)ClientUser:setBanner()
#Set the Banner field. Builders return this ClientUser so setters can be chained.
Signature
ClientUser:setBanner(banner) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
banner |
any |
required | Passed through to the implementation as written. |
Returns
ClientUser — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ClientUser
object:setBanner(banner)ClientUser:setPresence()
#Set the Presence field. Builders return this ClientUser so setters can be chained.
Signature
ClientUser:setPresence(presence) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
presence |
any |
required | Passed through to the implementation as written. |
Returns
ClientUser — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ClientUser
object:setPresence(presence)ClientUser:setStatus()
#Set the Status field. Builders return this ClientUser so setters can be chained.
Signature
ClientUser:setStatus(status) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
status |
any |
required | Passed through to the implementation as written. |
Returns
ClientUser — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ClientUser
object:setStatus(status)ClientUser:setUsername()
#Set the Username field. Builders return this ClientUser so setters can be chained.
Signature
ClientUser:setUsername(username) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
username |
any |
required | Passed through to the implementation as written. |
Returns
ClientUser — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ClientUser
object:setUsername(username)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