Skip to content

Commit

Permalink
Merge pull request #34 from green-api/dev
Browse files Browse the repository at this point in the history
Fixed polling example
  • Loading branch information
Amele9 authored Feb 7, 2024
2 parents 66aafcc + 8c895d4 commit e1af0c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions examples/poll.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def message_handler(notification: Notification) -> None:
sender_data = notification.event["senderData"]
sender_name = sender_data["senderName"]

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

stanza = response.data["idMessage"]

bot.router.poll_update_message.add_handler_with_stanza(
start_poll_handler, stanza
)


@bot.router.poll_update_message()
def start_poll_handler(notification: Notification) -> None:
votes = notification.event["messageData"]["pollMessageData"]["votes"]
for vote_data in votes:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="whatsapp-chatbot-python",
version="0.8.0",
version="0.9.0",
description=(
"This library helps you easily create"
" a Python chatbot with WhatsApp API."
Expand Down

0 comments on commit e1af0c5

Please sign in to comment.