Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot.edit_message_text accepts any ReplyMarkup, while the Telegram Bot API only accepts InlineKeyboardMarkup #1659

Closed
pguenth opened this issue Dec 8, 2019 · 1 comment · Fixed by #1642

Comments

@pguenth
Copy link

pguenth commented Dec 8, 2019

When using bot.edit_message_text, I tried sending a ReplyKeyboard:

context.bot.edit_message_text("Login successful", chat_id = update.effective_chat.id, message_id = msg.message_id, reply_markup = gen_stdkeyboard())

where gen_stdkeyboard() returns a ReplyKeyboardMarkup object.

Executing raised following error:

  File "tg.py", line 253, in check_registered
    context.bot.edit_message_text("Login successful", chat_id = update.effective_chat.id, message_id = msg.message_id, reply_markup = gen_stdkeyboard())
  File "/usr/lib/python3.8/site-packages/telegram/bot.py", line 66, in decorator
    result = func(self, *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/telegram/bot.py", line 1750, in edit_message_text
    return self._message(url, data, timeout=timeout, reply_markup=reply_markup, **kwargs)
  File "/usr/lib/python3.8/site-packages/telegram/bot.py", line 123, in _message
    result = self._request.post(url, data, timeout=timeout)
  File "/usr/lib/python3.8/site-packages/telegram/utils/request.py", line 323, in post
    result = self._request_wrapper('POST', url,
  File "/usr/lib/python3.8/site-packages/telegram/utils/request.py", line 237, in _request_wrapper
    raise BadRequest(message)
telegram.error.BadRequest: Inline keyboard expected

I think it is an inconsistency of this module, correct me if I am wrong.

@Eldinnie
Copy link
Member

Well, it will accept anything. If you pass it an int it will raise the same error. However I do think the docs need ot be updated to be equal to the official api

@Bibo-Joshi Bibo-Joshi self-assigned this Dec 29, 2019
@Bibo-Joshi Bibo-Joshi mentioned this issue Dec 29, 2019
@Bibo-Joshi Bibo-Joshi added this to the 12.4 milestone Dec 29, 2019
@Bibo-Joshi Bibo-Joshi removed this from the 12.4 milestone Jan 26, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Aug 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants