From a29bc142724a8be29ac10450b7bde1eb16a659e8 Mon Sep 17 00:00:00 2001 From: YoggieS <61660055+yoggys@users.noreply.github.com> Date: Fri, 22 Mar 2024 10:14:52 +0100 Subject: [PATCH] fix: type-hinting in ScheduledEvent.subscribers (#2400) --- CHANGELOG.md | 2 ++ discord/iterators.py | 6 +++--- discord/scheduled_events.py | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b467fec9e2..bd19979e74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2390](https://github.com/Pycord-Development/pycord/pull/2390)) - Fixed `NameError` in some instances of `Interaction`. ([#2402](https://github.com/Pycord-Development/pycord/pull/2402)) +- Fixed the type-hinting of `ScheduledEvent.subscribers` to reflect actual behavior. + ([#2400](https://github.com/Pycord-Development/pycord/pull/2400)) ### Changed diff --git a/discord/iterators.py b/discord/iterators.py index de442aa0fb..ef7ef9be85 100644 --- a/discord/iterators.py +++ b/discord/iterators.py @@ -852,10 +852,10 @@ class ScheduledEventSubscribersIterator(_AsyncIterator[Union["User", "Member"]]) def __init__( self, event: ScheduledEvent, - limit: int, + limit: int | None, with_member: bool = False, - before: datetime.datetime | int = None, - after: datetime.datetime | int = None, + before: datetime.datetime | int | None = None, + after: datetime.datetime | int | None = None, ): if isinstance(before, datetime.datetime): before = Object(id=time_snowflake(before, high=False)) diff --git a/discord/scheduled_events.py b/discord/scheduled_events.py index cda13f48b9..4ba16bcdec 100644 --- a/discord/scheduled_events.py +++ b/discord/scheduled_events.py @@ -482,11 +482,11 @@ async def cancel(self, *, reason: str | None = None) -> None: def subscribers( self, *, - limit: int = 100, + limit: int | None = 100, as_member: bool = False, before: Snowflake | datetime.datetime | None = None, after: Snowflake | datetime.datetime | None = None, - ) -> AsyncIterator: + ) -> ScheduledEventSubscribersIterator: """Returns an :class:`AsyncIterator` representing the users or members subscribed to the event. The ``after`` and ``before`` parameters must represent member