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(), from Interaction.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 use exclude_ended=True when fetching entitlements using Client.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.

id

The entitlement’s ID.

Type:

int

type

The entitlement’s type.

Type:

EntitlementType

sku_id

The ID of the associated SKU.

Type:

int

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]

application_id

The parent application’s ID.

Type:

int

deleted

Whether the entitlement was deleted.

Type:

bool

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 created_at[source]

Returns the entitlement’s creation time in UTC.

Type:

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 and ends_at.

Always returns True for test entitlements.

Return type:

bool

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:

Enumerations

EntitlementType

class disnake.EntitlementType[source]

Represents the type of an entitlement.

New in version 2.10.

application_subscription

Represents an entitlement for an application subscription.

Events