This commit is contained in:
floordiv 2021-12-30 10:29:28 +05:30 committed by GitHub
commit c663c1f405
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View file

@ -23,6 +23,7 @@ class InlineKeyboardMarkup(base.TelegramObject):
conf = kwargs.pop('conf', {}) or {}
conf['row_width'] = row_width
self.other_kwargs = kwargs
super(InlineKeyboardMarkup, self).__init__(**kwargs,
conf=conf,
@ -80,6 +81,17 @@ class InlineKeyboardMarkup(base.TelegramObject):
self.add(button)
return self
def __iadd__(self, other):
return self.add(other)
def __add__(self, other: self.__class__):
return self.__class__(
inline_keyboard=self.inline_keyboard + other.inline_keyboard,
row_width=self.row_width,
conf=self.conf,
**self.other_kwargs
)
class InlineKeyboardButton(base.TelegramObject):
"""

View file

@ -100,6 +100,16 @@ class ReplyKeyboardMarkup(base.TelegramObject):
self.add(button)
return self
def __iadd__(self, other):
return self.add(other)
def __add__(self, other):
return self.__class__(
keyboard=self.keyboard + other.keyboard, resize_keyboard=self.resize_keyboard,
one_time_keyboard=self.one_time_keyboard, selective=self.selective,
row_width=self.row_width
)
class KeyboardButton(base.TelegramObject):
"""