mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
aiogram.types.inline_keyboard: added all the same behavior for InlineKeyboardMarkup as ReplyKeyboardMarkup's operators overloading
This commit is contained in:
parent
f0c06aa9b8
commit
efbef64cd3
1 changed files with 12 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
@ -82,6 +83,17 @@ class InlineKeyboardMarkup(base.TelegramObject):
|
|||
self.add(button)
|
||||
return self
|
||||
|
||||
def __iadd__(self, other):
|
||||
return self.add(other)
|
||||
|
||||
def __add__(self, other):
|
||||
return InlineKeyboardMarkup(
|
||||
inline_keyboard=self.inline_keyboard,
|
||||
row_width=self.row_width,
|
||||
conf=self.conf,
|
||||
**self.other_kwargs
|
||||
)
|
||||
|
||||
|
||||
class InlineKeyboardButton(base.TelegramObject):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue