Add support for premium app integrations

Co-authored-by: Danny <1695103+Rapptz@users.noreply.github.com>
Co-authored-by: Lucas Hardt <lucas.hardt@fu-berlin.de>
Co-authored-by: Andrin S. <65789180+Puncher1@users.noreply.github.com>
This commit is contained in:
Lucas Hardt
2023-10-19 13:27:29 +02:00
committed by GitHub
parent 5d353282dc
commit 99618c823a
12 changed files with 828 additions and 4 deletions

View File

@ -496,6 +496,47 @@ Debug
:type payload: Union[:class:`bytes`, :class:`str`]
Entitlements
~~~~~~~~~~~~
.. function:: on_entitlement_create(entitlement)
Called when a user subscribes to a SKU.
.. versionadded:: 2.4
:param entitlement: The entitlement that was created.
:type entitlement: :class:`Entitlement`
.. function:: on_entitlement_update(entitlement)
Called when a user updates their subscription to a SKU. This is usually called when
the user renews or cancels their subscription.
.. versionadded:: 2.4
:param entitlement: The entitlement that was updated.
:type entitlement: :class:`Entitlement`
.. function:: on_entitlement_delete(entitlement)
Called when a users subscription to a SKU is cancelled. This is typically only called when:
- Discord issues a refund for the subscription.
- Discord removes an entitlement from a user.
.. warning::
This event won't be called if the user cancels their subscription manually, instead
:func:`on_entitlement_update` will be called with :attr:`Entitlement.ends_at` set to the end of the
current billing period.
.. versionadded:: 2.4
:param entitlement: The entitlement that was deleted.
:type entitlement: :class:`Entitlement`
Gateway
~~~~~~~~
@ -3429,6 +3470,47 @@ of :class:`enum.Enum`.
The underlying type of the ID is a channel or thread.
.. class:: SKUType
Represents the type of a SKU.
.. versionadded:: 2.4
.. attribute:: subscription
The SKU is a recurring subscription.
.. attribute:: subscription_group
The SKU is a system-generated group which is created for each :attr:`SKUType.subscription`.
.. class:: EntitlementType
Represents the type of an entitlement.
.. versionadded:: 2.4
.. attribute:: application_subscription
The entitlement was purchased as an app subscription.
.. class:: EntitlementOwnerType
Represents the type of an entitlement owner.
.. versionadded:: 2.4
.. attribute:: guild
The entitlement owner is a guild.
.. attribute:: user
The entitlement owner is a user.
.. _discord-api-audit-logs:
Audit Log Data
@ -4714,6 +4796,30 @@ ShardInfo
.. autoclass:: ShardInfo()
:members:
SKU
~~~~~~~~~~~
.. attributetable:: SKU
.. autoclass:: SKU()
:members:
SKUFlags
~~~~~~~~~~~
.. attributetable:: SKUFlags
.. autoclass:: SKUFlags()
:members:
Entitlement
~~~~~~~~~~~
.. attributetable:: Entitlement
.. autoclass:: Entitlement()
:members:
RawMessageDeleteEvent
~~~~~~~~~~~~~~~~~~~~~~~