mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-07-31 10:19:48 +03:00
Allows multiselection of poll option with callable
This commit is contained in:
parent
1a9b9e1020
commit
a30ec32b6f
|
@ -865,6 +865,12 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC):
|
||||||
|
|
||||||
If the button is pressed without this, `ValueError` is raised.
|
If the button is pressed without this, `ValueError` is raised.
|
||||||
|
|
||||||
|
multiselect_options (`bool`):
|
||||||
|
Allows multiselection of poll options for which the callable
|
||||||
|
`filter` or `text` returns `True`.
|
||||||
|
|
||||||
|
Defaults to `False`.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
@ -915,6 +921,8 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC):
|
||||||
return [answers[i].option]
|
return [answers[i].option]
|
||||||
if text is not None:
|
if text is not None:
|
||||||
if callable(text):
|
if callable(text):
|
||||||
|
if multiselect_options:
|
||||||
|
return [answer.option for answer in answers if text(answer.text)]
|
||||||
for answer in answers:
|
for answer in answers:
|
||||||
if text(answer.text):
|
if text(answer.text):
|
||||||
return [answer.option]
|
return [answer.option]
|
||||||
|
@ -925,6 +933,8 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC):
|
||||||
return
|
return
|
||||||
|
|
||||||
if filter is not None:
|
if filter is not None:
|
||||||
|
if multiselect_options:
|
||||||
|
return [answer.option for answer in answers if filter(answer)]
|
||||||
for answer in answers:
|
for answer in answers:
|
||||||
if filter(answer):
|
if filter(answer):
|
||||||
return [answer.option]
|
return [answer.option]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user