From 50d87bf5e9665bb91b7d3bf1b976ccec3959d9ca Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Fri, 30 Dec 2022 15:10:53 +0100 Subject: [PATCH] Add the field is_persistent to the class ReplyKeyboardMarkup --- .../types/bots_and_keyboards/reply_keyboard_markup.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py b/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py index b62f6dcf..2949c3e2 100644 --- a/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py +++ b/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py @@ -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 )