-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return new instance in Poll.end to avoid inconsistencies #10056
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -547,7 +547,7 @@ def get_answer( | |
|
||
return self._answers.get(id) | ||
|
||
async def end(self) -> Self: | ||
async def end(self) -> Poll: | ||
"""|coro| | ||
|
||
Ends the poll. | ||
|
@@ -568,6 +568,5 @@ async def end(self) -> Self: | |
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() | ||
|
||
return self | ||
message = await self._message.end_poll() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ._message still needs to be set, plus, you can simply do self._update(message) to update the data There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I went with this way intentionally because I wasn’t sure if the update should even be in-place. I’ll change it to make sure everything is done to the current instance. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could change the _update behaviour to update the current poll vote count and such, though |
||
return message.poll |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is typed like
Self
for subclasses