Python-telegram-bot: InlineKeyboardMarkup does not accepts InlineKeyboardButton

Created on 2 May 2016  路  4Comments  路  Source: python-telegram-bot/python-telegram-bot

I got my buttons working in ReplyKeyboardMarkup and i changed it into InlineKeyboardMarkup with the following code

mark_up = InlineKeyboardMarkup(
    [[InlineKeyboardButton('inline button')]]
)

And i get the following error

telegram.error.NetworkError: Error : 400 : Bad Request: Can't parse inline keyboard button: Text buttons are unallowed in the inline keyboard

Below is the documentation of the InlineKeyboardMarkup and as you can see it is refering to a list of InlineKeyboardMarkup and not InlineKeyboardButton.

"""This object represents a Telegram InlineKeyboardMarkup.
Attributes:
inline_keyboard (List[List[:class:telegram.InlineKeyboardMarkup]]):
Args:
inline_keyboard (List[List[:class:telegram.InlineKeyboardMarkup]]):
"""

documentation

Most helpful comment

From telegram api docs: "You must use exactly one of the optional fields."
So you have to pass either url, callback_data or switch_inline_query
Edit: The button would be useless if you don't pass any of those fields

All 4 comments

From telegram api docs: "You must use exactly one of the optional fields."
So you have to pass either url, callback_data or switch_inline_query
Edit: The button would be useless if you don't pass any of those fields

Reopening because I overlooked the documentation part of this issue - you're right about that

Fixed, thank you for reporting :)

why can not i edit a text and send replykeyboardmarkup but i can in InilneKeyboard???

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Poolitzer picture Poolitzer  路  5Comments

marekyggdrasil picture marekyggdrasil  路  5Comments

rahiel picture rahiel  路  5Comments

YHporkar picture YHporkar  路  3Comments

mhipo1364 picture mhipo1364  路  5Comments