Return new instance in Poll.end to avoid inconsistencies

This commit is contained in:
Nathan Waxman-Jeng
2025-01-15 18:57:46 -05:00
committed by GitHub
parent 1537102402
commit fa1cc00a29
+3 -1
View File
@@ -359,6 +359,7 @@ class Poll:
# The message's poll contains the more up to date data.
self._expiry = message.poll.expires_at
self._finalized = message.poll._finalized
self._answers = message.poll._answers
def _update_results(self, data: PollResultPayload) -> None:
self._finalized = data['is_finalized']
@@ -568,6 +569,7 @@ class Poll:
if not self._message or not self._state: # Make type checker happy
raise ClientException('This poll has no attached message.')
self._message = await self._message.end_poll()
message = await self._message.end_poll()
self._update(message)
return self