File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -941,10 +941,18 @@ def to_dict(self):
941941 return {'type' : self .type }
942942
943943
944- class InlineKeyboardMarkup (Dictionaryable , JsonSerializable ):
944+ class InlineKeyboardMarkup (Dictionaryable , JsonSerializable , JsonDeserializable ) ):
945945 max_row_keys = 8
946+
947+ @classmethod
948+ def de_json (cls , json_string ):
949+ if (json_string is None ):
950+ return None
951+ obj = cls .check_json (json_string )
952+ keyboard = [[button for button in row ] for row in obj ['inline_keyboard' ]]
953+ return cls (keyboard )
946954
947- def __init__ (self , row_width = 3 ):
955+ def __init__ (self , keyboard = [] , row_width = 3 ):
948956 """
949957 This object represents an inline keyboard that appears
950958 right next to the message it belongs to.
@@ -957,7 +965,7 @@ def __init__(self, row_width=3):
957965 row_width = self .max_row_keys
958966
959967 self .row_width = row_width
960- self .keyboard = []
968+ self .keyboard = keyboard
961969
962970 def add (self , * args , row_width = None ):
963971 """
You can’t perform that action at this time.
0 commit comments