1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Merge pull request #977 from Badiboy/master

Previous commit bugfix
This commit is contained in:
Badiboy 2020-09-22 01:46:51 +03:00 committed by GitHub
commit 6dc8173176
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: