Skip to content

Entitlement

Implementation of the Discord Entitlement class in Luau

https://discord.com/developers/docs/monetization/entitlements#entitlement-object

Properties

type

Entitlement.type  :: apiTypes.EntitlementType

The type of entitlement this object represents. Maps to Discord’s entitlement types.

id

Entitlement.id  :: apiTypes.Snowflake

The unique identifier for this entitlement.

skuId

Entitlement.skuId  :: apiTypes.Snowflake

The ID of the SKU (Stock Keeping Unit) that this entitlement grants access to.

applicationId

Entitlement.applicationId  :: apiTypes.Snowflake

The ID of the application this entitlement is for.

userId

Entitlement.userId  :: apiTypes.Snowflake?

The ID of the user this entitlement belongs to. May be null for some entitlement types.

deleted

Entitlement.deleted  :: boolean

Whether this entitlement has been deleted.

startsAt

Entitlement.startsAt  :: stdPolyfills.DateTime?

The date and time when this entitlement becomes active. May be null for permanent entitlements.

endsAt

Entitlement.endsAt  :: stdPolyfills.DateTime?

The date and time when this entitlement expires. May be null for permanent entitlements.

guildId

Entitlement.guildId  :: apiTypes.Snowflake?

The ID of the guild this entitlement is for. May be null for user-specific entitlements.

consumed

Entitlement.consumed  :: boolean?

Whether this entitlement has been consumed. Only applicable to consumable entitlements.

Methods

The Entitlement instance has no set methods!

Functions

sync

Entitlement . sync (

     self: Entitlement
     entitlementData: apiTypes.EntitlementObject
)  -> ()

Responsible for syncing data to this entitlement object. This is typically called by the API when this object is created or updated.

new

Entitlement . new (

     entitlementData: apiTypes.EntitlementObject
)  -> ()

Responsible for constructing this class.