Skip to content
Open
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions discord/poll.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Comment thread
Paillat-dev marked this conversation as resolved.
dict_["results"] = self.results.to_dict()
if self._expiry:
dict_["expiry"] = self._expiry
return dict_
Expand Down
Loading