2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-22 18:07:21 +00:00

Add the field is_persistent to the class ReplyKeyboardMarkup

This commit is contained in:
Dan 2022-12-30 15:10:53 +01:00
parent a116ea42c8
commit 50d87bf5e9

View File

@ -31,6 +31,10 @@ class ReplyKeyboardMarkup(Object):
keyboard (List of List of :obj:`~pyrogram.types.KeyboardButton`):
List of button rows, each represented by a List of KeyboardButton objects.
is_persistent (``bool``, *optional*):
Requests clients to always show the keyboard when the regular keyboard is hidden.
Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon.
resize_keyboard (``bool``, *optional*):
Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if
there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of
@ -55,6 +59,7 @@ class ReplyKeyboardMarkup(Object):
def __init__(
self,
keyboard: List[List[Union["types.KeyboardButton", str]]],
is_persistent: bool = None,
resize_keyboard: bool = None,
one_time_keyboard: bool = None,
selective: bool = None,
@ -63,13 +68,14 @@ class ReplyKeyboardMarkup(Object):
super().__init__()
self.keyboard = keyboard
self.is_persistent = is_persistent
self.resize_keyboard = resize_keyboard
self.one_time_keyboard = one_time_keyboard
self.selective = selective
self.placeholder = placeholder
@staticmethod
def read(kb):
def read(kb: "raw.base.ReplyMarkup"):
keyboard = []
for i in kb.rows:
@ -82,6 +88,7 @@ class ReplyKeyboardMarkup(Object):
return ReplyKeyboardMarkup(
keyboard=keyboard,
is_persistent=kb.persistent,
resize_keyboard=kb.resize,
one_time_keyboard=kb.single_use,
selective=kb.selective,
@ -100,5 +107,6 @@ class ReplyKeyboardMarkup(Object):
resize=self.resize_keyboard or None,
single_use=self.one_time_keyboard or None,
selective=self.selective or None,
persistent=self.is_persistent or None,
placeholder=self.placeholder or None
)