Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/1296.breaking.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove old `with_expiration` query parameter from :meth:`Client.fetch_invite`.
8 changes: 0 additions & 8 deletions disnake/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2234,7 +2234,6 @@ async def fetch_invite(
url: Union[Invite, str],
*,
with_counts: bool = True,
with_expiration: bool = True,
guild_scheduled_event_id: Optional[int] = None,
) -> Invite:
"""|coro|
Expand All @@ -2255,12 +2254,6 @@ async def fetch_invite(
Whether to include count information in the invite. This fills the
:attr:`.Invite.approximate_member_count` and :attr:`.Invite.approximate_presence_count`
fields.
with_expiration: :class:`bool`
Whether to include the expiration date of the invite. This fills the
:attr:`.Invite.expires_at` field.

.. versionadded:: 2.0

guild_scheduled_event_id: :class:`int`
The ID of the scheduled event to include in the invite.
If not provided, defaults to the ``event`` parameter in the URL if it exists,
Expand Down Expand Up @@ -2292,7 +2285,6 @@ async def fetch_invite(
data = await self.http.get_invite(
invite_id,
with_counts=with_counts,
with_expiration=with_expiration,
guild_scheduled_event_id=guild_scheduled_event_id,
)
return Invite.from_incomplete(state=self._connection, data=data)
Expand Down
2 changes: 0 additions & 2 deletions disnake/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -1912,12 +1912,10 @@ def get_invite(
invite_id: str,
*,
with_counts: bool = True,
with_expiration: bool = True,
guild_scheduled_event_id: Optional[int] = None,
) -> Response[invite.Invite]:
params = {
"with_counts": int(with_counts),
"with_expiration": int(with_expiration),
}
if guild_scheduled_event_id:
params["guild_scheduled_event_id"] = guild_scheduled_event_id
Expand Down
5 changes: 2 additions & 3 deletions disnake/invite.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ 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 |
| :attr:`expires_at` | :meth:`Client.fetch_invite` always included |
+------------------------------------+---------------------------------------------------------------------+
| :attr:`guild_scheduled_event` | :meth:`Client.fetch_invite` with valid ``guild_scheduled_event_id`` |
| | or valid event ID in URL or invite object |
Expand Down Expand Up @@ -347,8 +347,7 @@ class Invite(Hashable):

Optional according to the :ref:`table <invite_attr_table>` above.
expires_at: Optional[:class:`datetime.datetime`]
The expiration date of the invite. If the value is ``None`` when received through
:meth:`Client.fetch_invite` with ``with_expiration`` enabled, the invite will never expire.
The expiration date of the invite. If the value is ``None`` the invite will never expire.

.. versionadded:: 2.0

Expand Down
2 changes: 1 addition & 1 deletion disnake/types/invite.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ class Invite(_InviteMetadata):
target_application: NotRequired[PartialAppInfo]
approximate_presence_count: NotRequired[int]
approximate_member_count: NotRequired[int]
expires_at: NotRequired[Optional[str]]
expires_at: Optional[str]
guild_scheduled_event: NotRequired[GuildScheduledEvent]
Loading