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.entitlements
when 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=True
when fetching entitlements usingClient.entitlements()
.You may create new entitlements for testing purposes using
Client.create_entitlement()
.- x == y
Checks if two
Entitlement
s are equal.
- x != y
Checks if two
Entitlement
s are not equal.
- hash(x)
Returns the entitlement’s hash.
New in version 2.10.
- type¶
The entitlement’s type.
- Type:
- user_id¶
The ID of the user that is granted access to the entitlement’s SKU.
See also
user
.- Type:
Optional[
int
]
- guild_id¶
The ID of the guild that is granted access to the entitlement’s SKU.
See also
guild
.- Type:
Optional[
int
]
- starts_at¶
The time at which the entitlement starts being active. Set to
None
when this is a test entitlement.- Type:
Optional[
datetime.datetime
]
- ends_at¶
The time at which the entitlement stops being active. Set to
None
when this is a test entitlement.You can use
is_active()
to check whether this entitlement is still active.- Type:
Optional[
datetime.datetime
]
- property guild[source]¶
The guild that is granted access to this entitlement’s SKU, if applicable.
- Type:
Optional[
Guild
]
- 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
.- Type:
Optional[
User
]
- is_active()[source]¶
Whether the entitlement is currently active, based on
starts_at
andends_at
.Always returns
True
for test entitlements.- Return type:
- 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.