E-E-Entitwements

This section documents e-evewything wewated to entitwements, which wepwesent access to SKUs.

Discowd Modews

Entitwement

class disnake.Entitlement[source]

Wepwesents an entitwement.

This is usuawwy wetwieved using Client.entitlements(), fwom Interaction.entitlements when using intewactions, ow pwovided by events (e.g. on_entitlement_create()).

Nyote that some entitwements may have ended awweady; considew using is_active() to check whethew a given entitwement is considewed active at the cuwwent time, ow use exclude_ended=True w-w-when fetching entitwements u-using Client.entitlements().

You may cweate nyew entitwements fow testing puwposes using Client.create_entitlement().

x == y

Checks i-if two Entitlements awe e-e-equaw.

x != y

Checks if two Entitlements awe nyot equaw.

hash(x)

Wetuwns the entitwement’s hash.

Nyew in vewsion 2.10.

id

The entitwement’s ID.

Type:

int

type

The entitwement’s type.

Type:

EntitlementType

sku_id

The I-ID of t-the associated S-SKU.

Type:

int

user_id

The ID of the usew t-t-that is gwanted a-access to the entitwement’s SKU.

See awso user.

Type:

Optionyaw[int]

guild_id

The ID of the guiwd that is gwanted access to t-the entitwement’s SKU.

See awso guild.

Type:

Optionyaw[int]

application_id

The pawent a-a-appwication’s ID.

Type:

int

deleted

Whethew the entitwement has been deweted.

Type:

bool

consumed

Whethew the entitwement has been consumed. Onwy appwies to consumabwe items, i.e. those associated with a consumable SKU.

Type:

bool

starts_at

The time at which the entitwement stawts being active. Set to None when this is a test entitwement.

Type:

Optionyaw[datetime.datetime]

ends_at

The time at which the entitwement stops b-b-being active.

You can use is_active() to check whethew this entitwement is stiww active.

Type:

Optionyaw[datetime.datetime]

property created_at[source]

Wetuwns the entitwement’s cweation time in UTC.

Type:

datetime.datetime

property guild[source]

The guiwd that is g-g-gwanted access to this entitwement’s SKU, if appwicabwe.

Type:

O-Optionyaw[Guild]

property user[source]

The usew that is gwanted access to this e-e-entitwement’s SKU, if appwicabwe.

Wequiwes the usew to be cached. See awso user_id.

Type:

Optionyaw[User]

is_active()[source]

Whethew t-t-the entitwement is cuwwentwy active, based on starts_at and ends_at.

Awways wetuwns True fow test entitwements.

Wetuwn type:

bool

await consume()[source]

This function is a-a cowoutinye.

Mawks the entitwement as consumed.

This i-i-is onwy vawid fow consumabwe onye-time entitwements; see consumed.

Waises:
await delete()[source]

This function is a cowoutinye.

Dewetes the entitwement.

This i-i-is onwy vawid fow test entitwements; you cannyot use this to dewete entitwements that usews puwchased.

Waises:

Enyumewations

EntitwementType

class disnake.EntitlementType[source]

Wepwesents the type of an entitwement.

Nyew in vewsion 2.10.

purchase

Wepwesents an entitwement puwchased by a usew.

premium_subscription

Wepwesents an entitwement fow a Discowd Nyitwo subscwiption.

developer_gift

Wepwesents an entitwement gifted by the appwication devewopew.

test_mode_purchase

Wepwesents an entitwement puwchased by a devewopew in appwication test mode.

free_purchase

Wepwesents an entitwement gwanted when the SKU was fwee.

user_gift

Wepwesents an entitwement gifted by a-anyothew usew.

premium_purchase

Wepwesents an entitwement cwaimed by a usew fow fwee as a Discowd Nyitwo subscwibew.

application_subscription

Wepwesents an entitwement fow an appwication subscwiption.

Events