X Tutup
Skip to content

Commit 41e457f

Browse files
committed
Merge pull request python-telegram-bot#269 from python-telegram-bot/buttons
support str and KeyboardButton for reply_markup
2 parents 4ce0ab5 + a327e9d commit 41e457f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

telegram/replykeyboardmarkup.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ def to_dict(self):
7373
data = super(ReplyKeyboardMarkup, self).to_dict()
7474

7575
data['keyboard'] = []
76-
for keyboard in self.keyboard:
77-
data['keyboard'].append([x.to_dict() for x in keyboard])
78-
76+
for row in self.keyboard:
77+
r = []
78+
for button in row:
79+
if hasattr(button, 'to_dict'):
80+
r.append(button.to_dict()) # telegram.KeyboardButton
81+
else:
82+
r.append(button) # str
83+
data['keyboard'].append(r)
7984
return data

0 commit comments

Comments
 (0)
X Tutup