Browse Source

Deprecate with_expiration param in fetch_invite

pull/10262/head
Sacul 5 days ago
committed by GitHub
parent
commit
6ec2e5329b
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      discord/client.py
  2. 2
      discord/http.py
  3. 5
      discord/invite.py
  4. 1
      discord/types/gateway.py
  5. 3
      discord/types/invite.py

4
discord/client.py

@ -2510,6 +2510,9 @@ class Client:
:attr:`.Invite.expires_at` field.
.. versionadded:: 2.0
.. deprecated:: 2.6
This parameter is deprecated and will be removed in a future version as it is no
longer needed to fill the :attr:`.Invite.expires_at` field.
scheduled_event_id: Optional[:class:`int`]
The ID of the scheduled event this invite is for.
@ -2545,7 +2548,6 @@ class Client:
data = await self.http.get_invite(
resolved.code,
with_counts=with_counts,
with_expiration=with_expiration,
guild_scheduled_event_id=scheduled_event_id,
)
return Invite.from_incomplete(state=self._connection, data=data)

2
discord/http.py

@ -1864,12 +1864,10 @@ class HTTPClient:
invite_id: str,
*,
with_counts: bool = True,
with_expiration: bool = True,
guild_scheduled_event_id: Optional[Snowflake] = None,
) -> Response[invite.Invite]:
params: Dict[str, Any] = {
'with_counts': int(with_counts),
'with_expiration': int(with_expiration),
}
if guild_scheduled_event_id:

5
discord/invite.py

@ -290,8 +290,6 @@ class Invite(Hashable):
+------------------------------------+--------------------------------------------------------------+
| :attr:`approximate_presence_count` | :meth:`Client.fetch_invite` with ``with_counts`` enabled |
+------------------------------------+--------------------------------------------------------------+
| :attr:`expires_at` | :meth:`Client.fetch_invite` with ``with_expiration`` enabled |
+------------------------------------+--------------------------------------------------------------+
If it's not in the table above then it is available by all methods.
@ -332,6 +330,9 @@ class Invite(Hashable):
:meth:`Client.fetch_invite` with ``with_expiration`` enabled, the invite will never expire.
.. versionadded:: 2.0
.. versionchanged:: 2.6
This will always be returned from all methods. ``None`` if the invite will
never expire.
channel: Optional[Union[:class:`abc.GuildChannel`, :class:`Object`, :class:`PartialInviteChannel`]]
The channel the invite is for.

1
discord/types/gateway.py

@ -145,6 +145,7 @@ class InviteCreateEvent(TypedDict):
code: str
created_at: str
max_age: int
expires_at: Optional[str]
max_uses: int
temporary: bool
uses: Literal[0]

3
discord/types/invite.py

@ -44,7 +44,6 @@ class _InviteMetadata(TypedDict, total=False):
max_age: int
temporary: bool
created_at: str
expires_at: Optional[str]
class VanityInvite(_InviteMetadata):
@ -66,6 +65,7 @@ class Invite(IncompleteInvite, total=False):
guild_scheduled_event: GuildScheduledEvent
type: InviteType
flags: NotRequired[int]
expires_at: Optional[str]
class InviteWithCounts(Invite, _GuildPreviewUnique):
@ -76,6 +76,7 @@ class GatewayInviteCreate(TypedDict):
channel_id: Snowflake
code: str
created_at: str
expires_at: Optional[str]
max_age: int
max_uses: int
temporary: bool

Loading…
Cancel
Save