Skip to content

Commit a26a9ac

Browse files
committed
Fixed polling example
1 parent 66aafcc commit a26a9ac

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

examples/poll.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def message_handler(notification: Notification) -> None:
1010
sender_data = notification.event["senderData"]
1111
sender_name = sender_data["senderName"]
1212

13-
response = notification.answer_with_poll(
13+
notification.answer_with_poll(
1414
f"Hello, {sender_name}. Here's what I can do:\n\n",
1515
[
1616
{"optionName": "1. Report a problem"},
@@ -20,13 +20,8 @@ def message_handler(notification: Notification) -> None:
2020
]
2121
)
2222

23-
stanza = response.data["idMessage"]
24-
25-
bot.router.poll_update_message.add_handler_with_stanza(
26-
start_poll_handler, stanza
27-
)
28-
2923

24+
@bot.router.poll_update_message()
3025
def start_poll_handler(notification: Notification) -> None:
3126
votes = notification.event["messageData"]["pollMessageData"]["votes"]
3227
for vote_data in votes:

0 commit comments

Comments
 (0)