mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
commit
6dc8173176
@ -951,7 +951,7 @@ class InlineKeyboardMarkup(Dictionaryable, JsonSerializable, JsonDeserializable)
|
||||
keyboard = [[InlineKeyboardButton.de_json(button) for button in row] for row in obj['inline_keyboard']]
|
||||
return cls(keyboard)
|
||||
|
||||
def __init__(self, keyboard=[] ,row_width=3):
|
||||
def __init__(self, keyboard=None ,row_width=3):
|
||||
"""
|
||||
This object represents an inline keyboard that appears
|
||||
right next to the message it belongs to.
|
||||
@ -964,13 +964,13 @@ class InlineKeyboardMarkup(Dictionaryable, JsonSerializable, JsonDeserializable)
|
||||
row_width = self.max_row_keys
|
||||
|
||||
self.row_width = row_width
|
||||
self.keyboard = keyboard
|
||||
self.keyboard = keyboard if keyboard else []
|
||||
|
||||
def add(self, *args, row_width=None):
|
||||
"""
|
||||
This method adds buttons to the keyboard without exceeding row_width.
|
||||
|
||||
E.g. InlineKeyboardMarkup#add("A", "B", "C") yields the json result:
|
||||
E.g. InlineKeyboardMarkup.add("A", "B", "C") yields the json result:
|
||||
{keyboard: [["A"], ["B"], ["C"]]}
|
||||
when row_width is set to 1.
|
||||
When row_width is set to 2, the result:
|
||||
|
Loading…
Reference in New Issue
Block a user