Merge pull request #2 from Anatras02/patch-1

Check if added element is InlineKeyboard istance
This commit is contained in:
PyMaster 2020-12-28 20:48:26 +03:00 committed by GitHub
commit d5f1ff4113
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,8 +8,9 @@ class InlineKeyboard(InlineKeyboardMarkup):
self.row_width = row_width
def add(self, *args):
checkType = lambda element : True if type(element).__name__ == "InlineKeyboardButton" else False
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)
]