diff --git a/aiogram/types/inline_keyboard.py b/aiogram/types/inline_keyboard.py index 195c1e67..19e34442 100644 --- a/aiogram/types/inline_keyboard.py +++ b/aiogram/types/inline_keyboard.py @@ -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): """ diff --git a/aiogram/types/reply_keyboard.py b/aiogram/types/reply_keyboard.py index 17b0a353..bf18cce5 100644 --- a/aiogram/types/reply_keyboard.py +++ b/aiogram/types/reply_keyboard.py @@ -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): """