mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
aiogram.types.reply_keyboard: implemented __iadd__ method (allows adding buttons using += operator instead of calling .add() method), __add__ (get new keyboard from 2+ other keyboards by adding them)
This commit is contained in:
parent
79c59b34f9
commit
f0c06aa9b8
1 changed files with 10 additions and 0 deletions
|
|
@ -90,6 +90,16 @@ class ReplyKeyboardMarkup(base.TelegramObject):
|
|||
self.add(button)
|
||||
return self
|
||||
|
||||
def __iadd__(self, other):
|
||||
return self.add(other)
|
||||
|
||||
def __add__(self, other):
|
||||
return ReplyKeyboardMarkup(
|
||||
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):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue