-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
⚙️ bot-apiaffected functionality: bot-apiaffected functionality: bot-api
Description
According to the docs:
This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields are mutually exclusive.
So the buttons can be types str or KeyboardButton.
But currently replykeyboardmarkup.py assumes they are of type KeyboardButton and fails with str buttons, see here . (AttributeError: 'str' object has no attribute 'to_dict')
Code to reproduce:
import telegram
def main():
bot = telegram.Bot(token=TOKEN)
update_id = None
while True:
update_id = serve(bot, update_id)
def serve(bot, update_id):
reply_markup = telegram.ReplyKeyboardMarkup([["Yes", "No"]])
for update in bot.get_updates(offset=update_id, timeout=3.):
chat_id = update.message.chat_id
update_id = update.update_id + 1
message = update.message.text.encode('utf-8')
if (message):
bot.send_message(chat_id=chat_id, text="Want to crash?", reply_markup=reply_markup)
return update_id
if __name__ == '__main__':
main()Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
⚙️ bot-apiaffected functionality: bot-apiaffected functionality: bot-api