mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-02-16 18:31:45 +01:00
support str and KeyboardButton for reply_markup
This commit is contained in:
parent
998040da92
commit
a327e9d6ff
1 changed files with 8 additions and 3 deletions
|
@ -73,7 +73,12 @@ class ReplyKeyboardMarkup(ReplyMarkup):
|
||||||
data = super(ReplyKeyboardMarkup, self).to_dict()
|
data = super(ReplyKeyboardMarkup, self).to_dict()
|
||||||
|
|
||||||
data['keyboard'] = []
|
data['keyboard'] = []
|
||||||
for keyboard in self.keyboard:
|
for row in self.keyboard:
|
||||||
data['keyboard'].append([x.to_dict() for x in keyboard])
|
r = []
|
||||||
|
for button in row:
|
||||||
|
if hasattr(button, 'to_dict'):
|
||||||
|
r.append(button.to_dict()) # telegram.KeyboardButton
|
||||||
|
else:
|
||||||
|
r.append(button) # str
|
||||||
|
data['keyboard'].append(r)
|
||||||
return data
|
return data
|
||||||
|
|
Loading…
Add table
Reference in a new issue