SKU
ClassOn this page
SKU 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
applicationId- Type
any- Access
- readonly
- Description
- Instance field
SKU.applicationId. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this SKU.
- 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 SKU.
- Name
flags- Type
any- Access
- readonly
- Description
- Instance field
SKU.flags. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this SKU.
- Name
id- Type
any- Access
- readonly
- Description
- Snowflake id of this SKU.
- Availability
- Populated from the Gateway/REST payload or constructor for this SKU.
- Name
name- Type
any- Access
- readonly
- Description
- Display name of this SKU.
- Availability
- Populated from the Gateway/REST payload or constructor for this SKU.
- Name
raw- Type
any- Access
- readonly
- Description
- Instance field
SKU.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 SKU.
- Name
slug- Type
any- Access
- readonly
- Description
- Instance field
SKU.slug. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this SKU.
- Name
type- Type
any- Access
- readonly
- Description
- Instance field
SKU.type. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this SKU.
Methods
SKU:isConsumable()
#Predicate that returns whether this SKU matches isConsumable. Use it to branch before calling type-specific methods.
Signature
SKU:isConsumable() Parameters
No parameters.
Returns
SKU — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SKU
object:isConsumable()SKU:isDurable()
#Predicate that returns whether this SKU matches isDurable. Use it to branch before calling type-specific methods.
Signature
SKU:isDurable() Parameters
No parameters.
Returns
SKU — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SKU
object:isDurable()SKU:isSubscription()
#Predicate that returns whether this SKU matches isSubscription. Use it to branch before calling type-specific methods.
Signature
SKU:isSubscription() Parameters
No parameters.
Returns
SKU — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SKU
object:isSubscription()SKU:toJSON()
#Serialize this SKU into a Lua table suitable for REST or debugging.
Signature
SKU:toJSON() Parameters
No parameters.
Returns
any.
Example
local discord = require("discord")
-- object is a SKU
object:toJSON()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