Entitlements¶
This section documents everything related to entitlements, which represent access to SKUs.
Discord Models¶
Entitlement¶
- class disnake.Entitlement[source]¶
Represents an entitlement.
This is usually retrieved using
Client.entitlements(), fromInteraction.entitlementswhen using interactions, or provided by events (e.g.on_entitlement_create()).Note that some entitlements may have ended already; consider using
is_active()to check whether a given entitlement is considered active at the current time, or useexclude_ended=Truewhen fetching entitlements usingClient.entitlements().You may create new entitlements for testing purposes using
Client.create_entitlement().- x == y
Checks if two
Entitlements are equal.
- x != y
Checks if two
Entitlements are not equal.
- hash(x)
Returns the entitlement’s hash.
New in version 2.10.
- type¶
The entitlement’s type.
- Type:
- consumed¶
Whether the entitlement has been consumed. Only applies to consumable items, i.e. those associated with a
consumableSKU.- Type:
- starts_at¶
The time at which the entitlement starts being active. Set to
Nonewhen this is a test entitlement.- Type:
- ends_at¶
The time at which the entitlement stops being active.
You can use
is_active()to check whether this entitlement is still active.- Type:
- property user[source]¶
The user that is granted access to this entitlement’s SKU, if applicable.
Requires the user to be cached. See also
user_id.
- is_active()[source]¶
Whether the entitlement is currently active, based on
starts_atandends_at.Always returns
Truefor test entitlements.- Return type:
- await consume()[source]¶
This function is a coroutine.
Marks the entitlement as consumed.
This is only valid for consumable one-time entitlements; see
consumed.- Raises:
NotFound – The entitlement does not exist.
HTTPException – Consuming the entitlement failed.
- await delete()[source]¶
This function is a coroutine.
Deletes the entitlement.
This is only valid for test entitlements; you cannot use this to delete entitlements that users purchased.
- Raises:
NotFound – The entitlement does not exist.
HTTPException – Deleting the entitlement failed.
Enumerations¶
EntitlementType¶
- class disnake.EntitlementType[source]¶
Represents the type of an entitlement.
New in version 2.10.
- purchase¶
Represents an entitlement purchased by a user.
Represents an entitlement for a Discord Nitro subscription.
- developer_gift¶
Represents an entitlement gifted by the application developer.
- test_mode_purchase¶
Represents an entitlement purchased by a developer in application test mode.
- free_purchase¶
Represents an entitlement granted when the SKU was free.
- user_gift¶
Represents an entitlement gifted by another user.
Represents an entitlement claimed by a user for free as a Discord Nitro subscriber.
- application_subscription¶
Represents an entitlement for an application subscription.