From bbf257d659c02174585029b6052d2b833c12aefb Mon Sep 17 00:00:00 2001 From: Paillat-dev Date: Wed, 10 Jun 2026 17:17:25 +0200 Subject: [PATCH 1/3] fix: Fix `Poll.to_dict` and add better types --- discord/poll.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/discord/poll.py b/discord/poll.py index a6878275b6..8773e39cbe 100644 --- a/discord/poll.py +++ b/discord/poll.py @@ -355,9 +355,9 @@ def __init__( self.duration: int | None = duration self.allow_multiselect: bool = allow_multiselect self.layout_type: PollLayoutType = layout_type - self.results = None - self._expiry = None - self._message = None + self.results: PollResults | None = None + self._expiry: str | None = None + self._message: Message | PartialMessage | None = None @cached_property def expiry(self) -> datetime.datetime | None: @@ -372,8 +372,8 @@ def to_dict(self) -> PollPayload: "allow_multiselect": self.allow_multiselect, "layout_type": self.layout_type.value, } - if self.results: - dict_["results"] = [r.to_dict() for r in self.results] + if self.results is not None: + dict_["results"] = self.results.to_dict() if self._expiry: dict_["expiry"] = self._expiry return dict_ From 720a45650f38f93c5a23fea595f91c21c04236e8 Mon Sep 17 00:00:00 2001 From: Paillat-dev Date: Wed, 10 Jun 2026 17:29:20 +0200 Subject: [PATCH 2/3] docs: CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5173e5795c..3c63e882b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#3231](https://github.com/Pycord-Development/pycord/pull/3231)) - Allow `ForumTag` to be created without an emoji. ([#3245](https://github.com/Pycord-Development/pycord/pull/3245)) +- Fix `TypeError` in `Poll.to_dict` for closed polls. + ([#3261](https://github.com/Pycord-Development/pycord/pull/3261)) ### Deprecated From e48a928b0c29ac11621804c934c1690d121fb995 Mon Sep 17 00:00:00 2001 From: Paillat Date: Fri, 19 Jun 2026 18:55:13 +0200 Subject: [PATCH 3/3] Update CHANGELOG.md Co-authored-by: JustaSqu1d <89910983+JustaSqu1d@users.noreply.github.com> Signed-off-by: Paillat --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da87f4e22c..23707bb91d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ These changes are available on the `master` branch, but have not yet been releas ([#3231](https://github.com/Pycord-Development/pycord/pull/3231)) - Allow `ForumTag` to be created without an emoji. ([#3245](https://github.com/Pycord-Development/pycord/pull/3245)) -- Fix `TypeError` in `Poll.to_dict` for closed polls. +- Fix a type error in `Poll.to_dict()` for closed polls. ([#3261](https://github.com/Pycord-Development/pycord/pull/3261)) - Fix a bug where `TextChannel.archived_threads` would ignore any limit parameter smaller than 50 and use 50 instead.