Skip to content

Commit 50d87bf

Browse files
committed
Add the field is_persistent to the class ReplyKeyboardMarkup
1 parent a116ea4 commit 50d87bf

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ class ReplyKeyboardMarkup(Object):
3131
keyboard (List of List of :obj:`~pyrogram.types.KeyboardButton`):
3232
List of button rows, each represented by a List of KeyboardButton objects.
3333
34+
is_persistent (``bool``, *optional*):
35+
Requests clients to always show the keyboard when the regular keyboard is hidden.
36+
Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon.
37+
3438
resize_keyboard (``bool``, *optional*):
3539
Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if
3640
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):
5559
def __init__(
5660
self,
5761
keyboard: List[List[Union["types.KeyboardButton", str]]],
62+
is_persistent: bool = None,
5863
resize_keyboard: bool = None,
5964
one_time_keyboard: bool = None,
6065
selective: bool = None,
@@ -63,13 +68,14 @@ def __init__(
6368
super().__init__()
6469

6570
self.keyboard = keyboard
71+
self.is_persistent = is_persistent
6672
self.resize_keyboard = resize_keyboard
6773
self.one_time_keyboard = one_time_keyboard
6874
self.selective = selective
6975
self.placeholder = placeholder
7076

7177
@staticmethod
72-
def read(kb):
78+
def read(kb: "raw.base.ReplyMarkup"):
7379
keyboard = []
7480

7581
for i in kb.rows:
@@ -82,6 +88,7 @@ def read(kb):
8288

8389
return ReplyKeyboardMarkup(
8490
keyboard=keyboard,
91+
is_persistent=kb.persistent,
8592
resize_keyboard=kb.resize,
8693
one_time_keyboard=kb.single_use,
8794
selective=kb.selective,
@@ -100,5 +107,6 @@ async def write(self, _: "pyrogram.Client"):
100107
resize=self.resize_keyboard or None,
101108
single_use=self.one_time_keyboard or None,
102109
selective=self.selective or None,
110+
persistent=self.is_persistent or None,
103111
placeholder=self.placeholder or None
104112
)

0 commit comments

Comments
 (0)