Skip to content

editMessageText results in exception when inline_message_id parameter is used #320

@whipermr5

Description

@whipermr5

Steps to reproduce

  1. Create an inline query result containing a callback inline keyboard button, and insert it into a conversation. Activate the button via Telegram to receive a CallbackQuery.
  2. Answer the CallbackQuery. Take note of its originating inline_message_id.
  3. Attempt to run editMessageText using inline_message_id.

Expected behaviour

Success with edited message returned

Actual behaviour

AttributeError: 'bool' object has no attribute 'get'

Caused by

return Message.de_json(result)
on line 1081 of telegram/bot.py

Caused by the Telegram Bot API returning {"ok": true, "result": true} instead of the edited message when inline_message_id is used. The Message.de_json expects a Message but gets a bool instead.

Suggested change

Check that the result is not a simple boolean before attempting to Message.de_json it.

Configuration

Operating System:
OS X El Capitan

Version of Python:

$ python -V
Python 2.7.11

Version of python-telegram-bot:

$ python -c 'import telegram; print(telegram.__version__)'
4.2.0

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions