Widget
ClassOn 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.
Properties
- 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
- 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.
- Name
id- Type
any- Access
- readonly
- Description
- Snowflake id of this Widget.
- Availability
- Populated from the Gateway/REST payload or constructor for this Widget.
- 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.
- 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
- Name
name- Type
any- Access
- readonly
- Description
- Display name of this Widget.
- Availability
- Populated from the Gateway/REST payload or constructor for this Widget.
- 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.
- 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
| Name | Type | Required | Behavior |
|---|---|---|---|
callback |
function |
optional | Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error. |
Returns
Widget — the same instance, for chaining.
Example
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
| Name | Type | Required | Behavior |
|---|---|---|---|
style |
any |
optional | Passed through to the implementation as written. |
Returns
Widget — the same instance, for chaining.
Example
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.
Related APIs
ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationRoleConnectionMetadata · Attachment
Version: discord 1.2.4 · runtime 1.0.0