We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 4ce0ab5 + a327e9d commit 41e457fCopy full SHA for 41e457f
telegram/replykeyboardmarkup.py
@@ -73,7 +73,12 @@ def to_dict(self):
73
data = super(ReplyKeyboardMarkup, self).to_dict()
74
75
data['keyboard'] = []
76
- for keyboard in self.keyboard:
77
- data['keyboard'].append([x.to_dict() for x in keyboard])
78
-
+ for row in self.keyboard:
+ r = []
+ 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)
84
return data
0 commit comments