DiscordLua
discorddiscord
v1.2.4
Install

Entitlement

Class
On this page

Entitlement 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 Source

Properties

Entitlement.applicationId

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

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

Entitlement.consumed

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

Entitlement.deleted

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

Entitlement.endsAt

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

Entitlement.endsTimestamp

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

Entitlement.guildId

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

Entitlement.id

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

Entitlement.raw

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

Entitlement.skuId

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

Entitlement.startsAt

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

Entitlement.startsTimestamp

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

Entitlement.type

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

Entitlement.userId

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

Methods

Entitlement:consume()

#

Performs consume on this Entitlement. Call it from bot code when you need that operation on the current object.

Signature

Entitlement:consume(callback)

Parameters

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

Returns

Entitlement — the same instance, for chaining.

Example

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

Entitlement:fetch()

#

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

Signature

Entitlement:fetch(callback)

Parameters

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

Returns

Entitlement — the same instance, for chaining.

Example

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

Entitlement:fetchUser()

#

Fetch User from REST and update the local cache when the request succeeds.

Signature

Entitlement:fetchUser(callback)

Parameters

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

Returns

Entitlement — the same instance, for chaining.

Example

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

Entitlement:guild()

#

Performs guild on this Entitlement. Call it from bot code when you need that operation on the current object.

Signature

Entitlement:guild()

Parameters

No parameters.

Returns

Entitlement — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Entitlement
object:guild()

Entitlement:isActive()

#

Predicate that returns whether this Entitlement matches isActive. Use it to branch before calling type-specific methods.

Signature

Entitlement:isActive()

Parameters

No parameters.

Returns

Entitlement — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Entitlement
object:isActive()

Entitlement:isGuildSubscription()

#

Predicate that returns whether this Entitlement matches isGuildSubscription. Use it to branch before calling type-specific methods.

Signature

Entitlement:isGuildSubscription()

Parameters

No parameters.

Returns

Entitlement — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Entitlement
object:isGuildSubscription()

Entitlement:isTest()

#

Predicate that returns whether this Entitlement matches isTest. Use it to branch before calling type-specific methods.

Signature

Entitlement:isTest()

Parameters

No parameters.

Returns

Entitlement — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Entitlement
object:isTest()

Entitlement:isUserPurchase()

#

Predicate that returns whether this Entitlement matches isUserPurchase. Use it to branch before calling type-specific methods.

Signature

Entitlement:isUserPurchase()

Parameters

No parameters.

Returns

Entitlement — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Entitlement
object:isUserPurchase()

Entitlement:isUserSubscription()

#

Predicate that returns whether this Entitlement matches isUserSubscription. Use it to branch before calling type-specific methods.

Signature

Entitlement:isUserSubscription()

Parameters

No parameters.

Returns

Entitlement — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Entitlement
object:isUserSubscription()

Entitlement:toJSON()

#

Serialize this Entitlement into a Lua table suitable for REST or debugging.

Signature

Entitlement:toJSON()

Parameters

No parameters.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Entitlement
object:toJSON()

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