Skip to content

[BUG] InlineKeyboardButton with switch_inline_query='' doesn't work #1594

@davidchoo12

Description

@davidchoo12

Steps to reproduce

  1. Send a message with a inline keyboard button with switch_inline_query=''
inline_btn = InlineKeyboardButton('inline button', switch_inline_query='')
print(inline_btn)
markup = InlineKeyboardMarkup([[inline_btn]])
update.message.reply_text('message with inline button', reply_markup=markup)
  1. Output of the print statement:
    {'text': 'inline button'}
    along with error message: "Can't parse inline keyboard button: text buttons are unallowed in the inline keyboard"

Expected behaviour

The message should appear with the button as documented: "Can be empty, in which case just the bot’s username will be inserted."

Actual behaviour

Message and button doesn't appear and error is thrown

Configuration

Operating System:
Windows 10

Version of Python, python-telegram-bot & dependencies:

$ python -m telegram
python-telegram-bot 12.2.0
certifi 2019.09.11
future 0.18.1
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)]

Logs

{'text': 'inline button'}
WARNING - Update "..." caused error "Can't parse inline keyboard button: text buttons are unallowed in the inline keyboard"

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions