Merge pull request #2 from Anatras02/patch-1
Check if added element is InlineKeyboard istance
This commit is contained in:
commit
d5f1ff4113
@ -8,8 +8,9 @@ class InlineKeyboard(InlineKeyboardMarkup):
|
|||||||
self.row_width = row_width
|
self.row_width = row_width
|
||||||
|
|
||||||
def add(self, *args):
|
def add(self, *args):
|
||||||
|
checkType = lambda element : True if type(element).__name__ == "InlineKeyboardButton" else False
|
||||||
self.inline_keyboard = [
|
self.inline_keyboard = [
|
||||||
args[i:i + self.row_width]
|
list(filter(checkType,list(args[i:i + self.row_width])))
|
||||||
for i in range(0, len(args), self.row_width)
|
for i in range(0, len(args), self.row_width)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user