Skip to content

Commit e1af0c5

Browse files
authored
Merge pull request #34 from green-api/dev
Fixed polling example
2 parents 66aafcc + 8c895d4 commit e1af0c5

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
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:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="whatsapp-chatbot-python",
8-
version="0.8.0",
8+
version="0.9.0",
99
description=(
1010
"This library helps you easily create"
1111
" a Python chatbot with WhatsApp API."

0 commit comments

Comments
 (0)