Browse Source

Add exclude_deleted parameter to Client.entitlements

pull/10082/head
DA344 3 months ago
committed by GitHub
parent
commit
eb15aa8ca4
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      discord/client.py
  2. 3
      discord/http.py

6
discord/client.py

@ -2824,6 +2824,7 @@ class Client:
user: Optional[Snowflake] = None,
guild: Optional[Snowflake] = None,
exclude_ended: bool = False,
exclude_deleted: bool = True,
) -> AsyncIterator[Entitlement]:
"""Retrieves an :term:`asynchronous iterator` of the :class:`.Entitlement` that applications has.
@ -2865,6 +2866,10 @@ class Client:
The guild to filter by.
exclude_ended: :class:`bool`
Whether to exclude ended entitlements. Defaults to ``False``.
exclude_deleted: :class:`bool`
Whether to exclude deleted entitlements. Defaults to ``True``.
.. versionadded:: 2.5
Raises
-------
@ -2901,6 +2906,7 @@ class Client:
user_id=user.id if user else None,
guild_id=guild.id if guild else None,
exclude_ended=exclude_ended,
exclude_deleted=exclude_deleted,
)
if data:

3
discord/http.py

@ -2460,6 +2460,7 @@ class HTTPClient:
limit: Optional[int] = None,
guild_id: Optional[Snowflake] = None,
exclude_ended: Optional[bool] = None,
exclude_deleted: Optional[bool] = None,
) -> Response[List[sku.Entitlement]]:
params: Dict[str, Any] = {}
@ -2477,6 +2478,8 @@ class HTTPClient:
params['guild_id'] = guild_id
if exclude_ended is not None:
params['exclude_ended'] = int(exclude_ended)
if exclude_deleted is not None:
params['exclude_deleted'] = int(exclude_deleted)
return self.request(
Route('GET', '/applications/{application_id}/entitlements', application_id=application_id), params=params

Loading…
Cancel
Save