DiscordLua
discorddiscord
v1.2.4
Install

Widget

Class
On this page

Widget 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

Widget.channels

# readonly
Name
channels
Type
Collection
Access
readonly
Description
Instance field Widget.channels. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Widget.
Related
Collection

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

Widget.id

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

Widget.instantInvite

# readonly
Name
instantInvite
Type
any
Access
readonly
Description
Instance field Widget.instantInvite. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Widget.

Widget.members

# readonly
Name
members
Type
Collection
Access
readonly
Description
Instance field Widget.members. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Widget.
Related
Collection

Widget.name

# readonly
Name
name
Type
any
Access
readonly
Description
Display name of this Widget.
Availability
Populated from the Gateway/REST payload or constructor for this Widget.

Widget.presenceCount

# readonly
Name
presenceCount
Type
any
Access
readonly
Description
Instance field Widget.presenceCount. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Widget.

Widget.raw

# readonly
Name
raw
Type
any
Access
readonly
Description
Instance field Widget.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 Widget.

Methods

Widget:fetch()

#

Request a fresh copy of this resource from REST and update the cache.

Signature

Widget:fetch(callback)

Parameters

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

Returns

Widget — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Widget
object:fetch(function(err, result)
    if err then error(err) end
end)

Widget:imageURL()

#

Performs image url on this Widget. Call it from bot code when you need that operation on the current object.

Signature

Widget:imageURL(style)

Parameters

NameTypeRequiredBehavior
style any optional Passed through to the implementation as written.

Returns

Widget — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Widget
object:imageURL(style)

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