Skip to content

hikari.monetization#

Models for monetized apps & premium features.

Entitlement #

Bases: Unique

An entitlement represents that a user or guild has access to a premium offering in your application.

application_id class-attribute instance-attribute #

application_id: Snowflake = field(eq=False, hash=False, repr=True)

ID of the parent application

created_at property #

created_at: datetime

When the object was created.

ends_at class-attribute instance-attribute #

ends_at: Optional[datetime] = field(eq=False, hash=False, repr=False)

Date at which the entitlement is no longer valid. Not present when using test entitlements.

guild_id class-attribute instance-attribute #

guild_id: Optional[Snowflake] = field(eq=False, hash=False, repr=False)

ID of the guild that is granted access to the entitlement's SKU

id class-attribute instance-attribute #

id: Snowflake = field(hash=True, repr=True)

ID of the entitlement

is_deleted class-attribute instance-attribute #

is_deleted: bool = field(eq=False, hash=False, repr=False)

Whether the entitlement has been deleted

sku_id class-attribute instance-attribute #

sku_id: Snowflake = field(eq=False, hash=False, repr=True)

ID of the SKU

starts_at class-attribute instance-attribute #

starts_at: Optional[datetime] = field(eq=False, hash=False, repr=False)

Start date at which the entitlement is valid. Not present when using test entitlements.

subscription_id class-attribute instance-attribute #

subscription_id: Optional[Snowflake] = field(eq=False, hash=False, repr=False)

The ID of the subscription that this entitlement is associated with.

Not present when using test entitlements.

type class-attribute instance-attribute #

type: Union[EntitlementType, int] = field(eq=False, hash=False, repr=True)

Type of entitlement

user_id class-attribute instance-attribute #

user_id: Optional[Snowflake] = field(eq=False, hash=False, repr=True)

ID of the user that is granted access to the entitlement's SKU

EntitlementOwnerType #

Bases: int, Enum

Represents the type of an entitlement owner.

GUILD class-attribute instance-attribute #

GUILD = 1

Entitlement is owned by a guild

USER class-attribute instance-attribute #

USER = 2

Entitlement is owned by a user

name property #

name: str

Return the name of the enum member as a str.

value property #

value

Return the value of the enum member.

EntitlementType #

Bases: int, Enum

Represents the type of an entitlement.

APPLICATION_SUBSCRIPTION class-attribute instance-attribute #

APPLICATION_SUBSCRIPTION = 8

Entitlement was purchased as an app subscription

name property #

name: str

Return the name of the enum member as a str.

value property #

value

Return the value of the enum member.

SKU #

Bases: Unique

Represents an SKU (stock-keeping unit).

SKUs on Discord represent premium offerings that can be made available to your application's users or guilds.

application_id class-attribute instance-attribute #

application_id: Snowflake = field(eq=False, hash=False, repr=True)

The ID of the parent application

created_at property #

created_at: datetime

When the object was created.

flags class-attribute instance-attribute #

flags: SKUFlags = field(eq=False, hash=False, repr=True)

The flags for the SKU

id class-attribute instance-attribute #

id: Snowflake = field(hash=True, repr=True)

The ID of the SKU

name class-attribute instance-attribute #

name: str = field(eq=False, hash=False, repr=True)

Customer-facing name of the SKU

slug class-attribute instance-attribute #

slug: str = field(eq=False, hash=False, repr=True)

Discord-generated URL slug based on the SKU's name

type class-attribute instance-attribute #

type: Union[SKUType, int] = field(eq=False, hash=False, repr=True)

The type of the SKU

SKUFlags #

Bases: Flag

Represents the flags of a SKU.

AVAILABLE class-attribute instance-attribute #

AVAILABLE = 1 << 2

SKU is available for purchase

GUILD_SUBSCRIPTION class-attribute instance-attribute #

GUILD_SUBSCRIPTION = 1 << 7

Recurring SKU that can be purchased by a user and applied to a single server.

Grants access to every user in that server.

NONE class-attribute instance-attribute #

NONE = 0

No flags set

USER_SUBSCRIPTION class-attribute instance-attribute #

USER_SUBSCRIPTION = 1 << 8

Recurring SKU purchased by a user for themselves.

Grants access to the purchasing user in every server.

name property #

name: str

Return the name of the flag combination as a str.

value property #

value: int

Return the int value of the flag.

all #

all(*flags: Self) -> bool

Check if all of the given flags are part of this value.

RETURNS DESCRIPTION
bool

True if any of the given flags are part of this value. Otherwise, return False.

any #

any(*flags: Self) -> bool

Check if any of the given flags are part of this value.

RETURNS DESCRIPTION
bool

True if any of the given flags are part of this value. Otherwise, return False.

difference #

difference(other: Union[int, Self]) -> Self

Perform a set difference with the other set.

This will return all flags in this set that are not in the other value.

Equivalent to using the subtraction - operator.

intersection #

intersection(other: Union[int, Self]) -> Self

Return a combination of flags that are set for both given values.

Equivalent to using the "AND" & operator.

invert #

invert() -> Self

Return a set of all flags not in the current set.

is_disjoint #

is_disjoint(other: Union[int, Self]) -> bool

Return whether two sets have a intersection or not.

If the two sets have an intersection, then this returns False. If no common flag values exist between them, then this returns True.

is_subset #

is_subset(other: Union[int, Self]) -> bool

Return whether another set contains this set or not.

Equivalent to using the "in" operator.

is_superset #

is_superset(other: Union[int, Self]) -> bool

Return whether this set contains another set or not.

none #

none(*flags: Self) -> bool

Check if none of the given flags are part of this value.

Note

This is essentially the opposite of hikari.internal.enums.Flag.any.

RETURNS DESCRIPTION
bool

True if none of the given flags are part of this value. Otherwise, return False.

split #

split() -> Sequence[Self]

Return a list of all defined atomic values for this flag.

Any unrecognised bits will be omitted for brevity.

The result will be a name-sorted typing.Sequence of each member

symmetric_difference #

symmetric_difference(other: Union[int, Self]) -> Self

Return a set with the symmetric differences of two flag sets.

Equivalent to using the "XOR" ^ operator.

For a ^ b, this can be considered the same as (a - b) | (b - a).

union #

union(other: Union[int, Self]) -> Self

Return a combination of all flags in this set and the other set.

Equivalent to using the "OR" ~ operator.

SKUType #

Bases: int, Enum

Represents the type of an entitlement.

SUBSCRIPTION class-attribute instance-attribute #

SUBSCRIPTION = 5

Represents a recurring subscription

SUBSCRIPTION_GROUP class-attribute instance-attribute #

SUBSCRIPTION_GROUP = 6

System-generated group for each SUBSCRIPTION SKU created

name property #

name: str

Return the name of the enum member as a str.

value property #

value

Return the value of the enum member.