Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion discord/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
if TYPE_CHECKING:
from types import TracebackType

from typing_extensions import Self

Check warning on line 85 in discord/client.py

View workflow job for this annotation

GitHub Actions / check 3.x

Import "typing_extensions" could not be resolved from source (reportMissingModuleSource)

from .abc import Messageable, PrivateChannel, Snowflake, SnowflakeTime
from .app_commands import Command, ContextMenu
Expand Down Expand Up @@ -2510,6 +2510,9 @@
: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.

Expand Down Expand Up @@ -2545,7 +2548,6 @@
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)
Expand Down
2 changes: 0 additions & 2 deletions discord/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -1864,12 +1864,10 @@ def get_invite(
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:
Expand Down
5 changes: 3 additions & 2 deletions discord/invite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions discord/types/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 2 additions & 1 deletion discord/types/invite.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class _InviteMetadata(TypedDict, total=False):
max_age: int
temporary: bool
created_at: str
expires_at: Optional[str]


class VanityInvite(_InviteMetadata):
Expand All @@ -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):
Expand All @@ -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
Expand Down
Loading