Add support for poll result messages

This commit is contained in:
DA344
2025-01-19 11:09:05 +01:00
committed by GitHub
parent ff2ad34be5
commit afbbc07e98
7 changed files with 136 additions and 5 deletions

View File

@ -552,6 +552,27 @@ class ConnectionState(Generic[ClientT]):
poll._handle_vote(answer_id, added, self_voted)
return poll
def _update_poll_results(self, from_: Message, to: Union[Message, int]) -> None:
if isinstance(to, Message):
cached = self._get_message(to.id)
elif isinstance(to, int):
cached = self._get_message(to)
if cached is None:
return
to = cached
else:
return
if to.poll is None:
return
to.poll._update_results_from_message(from_)
if cached is not None and cached.poll:
cached.poll._update_results_from_message(from_)
async def chunker(
self, guild_id: int, query: str = '', limit: int = 0, presences: bool = False, *, nonce: Optional[str] = None
) -> None: