1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Add PollAnswer type;

Add poll_answer_handler
This commit is contained in:
oleg 2020-05-12 10:42:17 +05:00
parent 03b02561a5
commit 592dcbfedf
2 changed files with 9 additions and 0 deletions

View File

@ -117,6 +117,7 @@ class Update(JsonDeserializable):
self.shipping_query = shipping_query
self.pre_checkout_query = pre_checkout_query
self.poll = poll
self.poll_answer = poll_answer
class WebhookInfo(JsonDeserializable):

View File

@ -190,6 +190,14 @@ def test_json_poll_answer():
assert poll_answer.options_ids == [1]
def test_json_poll_answer():
json_string = r'{"poll_id": "qwerty963852741","user": {"id": 111,"is_bot": false,"first_name": "Tele","last_name": "Bot","username": "Telebot","language_code": "ru"},"option_ids": [1, 2]}'
msg = types.PollAnswer.de_json(json_string)
assert isinstance(msg.user, types.User)
assert msg.poll_id == 'qwerty963852741'
assert len(msg.option_ids) == 2
def test_KeyboardButtonPollType():
markup = types.ReplyKeyboardMarkup()
markup.add(types.KeyboardButton('send me a poll', request_poll=types.KeyboardButtonPollType(type='quiz')))