SKUs¶
This section documents everything related to SKUs, which represent items being sold on Discord, like application subscriptions. See the official docs for more info.
Discord Models¶
SKU¶
- asyncfetch_subscription
- asyncsubscriptions
- class disnake.SKU[source]¶
Represents an SKU.
This can be retrieved using
Client.skus()
.- x == y
Checks if two
SKU
s are equal.
- x != y
Checks if two
SKU
s are not equal.
- hash(x)
Returns the SKU’s hash.
- str(x)
Returns the SKU’s name.
New in version 2.10.
- await subscriptions(user, *, limit=50, before=None, after=None)[source]¶
This function is a coroutine.
Retrieves an
AsyncIterator
that enables receiving subscriptions for the SKU.All parameters, except
user
, are optional.- Parameters:
user (
abc.Snowflake
) – The user to retrieve subscriptions for.limit (Optional[
int
]) – The number of subscriptions to retrieve. IfNone
, retrieves every subscription. Note, however, that this would make it a slow operation. Defaults to50
.before (Union[
abc.Snowflake
,datetime.datetime
]) – Retrieves subscriptions created before this date or object. If a datetime is provided, it is recommended to use a UTC aware datetime. If the datetime is naive, it is assumed to be local time.after (Union[
abc.Snowflake
,datetime.datetime
]) – Retrieve subscriptions created after this date or object. If a datetime is provided, it is recommended to use a UTC aware datetime. If the datetime is naive, it is assumed to be local time.
- Raises:
HTTPException – Retrieving the subscriptions failed.
- Yields:
Subscription
– The subscriptions for the given parameters.
- await fetch_subscription(subscription_id, /)[source]¶
This function is a coroutine.
Retrieve a subscription for this SKU given its ID.
- Raises:
NotFound – The subscription does not exist.
HTTPException – Retrieving the subscription failed.
Data Classes¶
SKUFlags¶
- class disnake.SKUFlags[source]¶
Wraps up Discord SKU flags.
- x == y
Checks if two SKUFlags instances are equal.
- x != y
Checks if two SKUFlags instances are not equal.
- x <= y
Checks if an SKUFlags instance is a subset of another SKUFlags instance.
- x >= y
Checks if an SKUFlags instance is a superset of another SKUFlags instance.
- x < y
Checks if an SKUFlags instance is a strict subset of another SKUFlags instance.
- x > y
Checks if an SKUFlags instance is a strict superset of another SKUFlags instance.
- x | y, x |= y
Returns a new SKUFlags instance with all enabled flags from both x and y. (Using
|=
will update in place).
- x & y, x &= y
Returns a new SKUFlags instance with only flags enabled on both x and y. (Using
&=
will update in place).
- x ^ y, x ^= y
Returns a new SKUFlags instance with only flags enabled on one of x or y, but not both. (Using
^=
will update in place).
- ~x
Returns a new SKUFlags instance with all flags from x inverted.
- hash(x)
Returns the flag’s hash.
- iter(x)
Returns an iterator of
(name, value)
pairs. This allows it to be, for example, constructed as a dict or a list of pairs. Note that aliases are not shown.
Additionally supported are a few operations on class attributes.
- SKUFlags.y | SKUFlags.z, SKUFlags(y=True) | SKUFlags.z
Returns an SKUFlags instance with all provided flags enabled.
- ~SKUFlags.y
Returns an SKUFlags instance with all flags except
y
inverted from their default value.
New in version 2.10.
- value¶
The raw value. You should query flags via the properties rather than using this raw value.
- Type:
- guild_subscription¶
Returns
True
if the SKU is an application subscription applied to a guild.- Type:
Enumerations¶
SKUType¶
- class disnake.SKUType[source]¶
Represents the type of an SKU.
New in version 2.10.
- durable¶
Represents a durable one-time purchase.
- consumable¶
Represents a consumable one-time purchase.
- subscription¶
Represents a recurring subscription.
- subscription_group¶
Represents a system-generated group for each
subscription
SKU.