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:
parent
a116ea42c8
commit
50d87bf5e9
@ -31,6 +31,10 @@ class ReplyKeyboardMarkup(Object):
|
|||||||
keyboard (List of List of :obj:`~pyrogram.types.KeyboardButton`):
|
keyboard (List of List of :obj:`~pyrogram.types.KeyboardButton`):
|
||||||
List of button rows, each represented by a List of KeyboardButton objects.
|
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*):
|
resize_keyboard (``bool``, *optional*):
|
||||||
Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if
|
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
|
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__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
keyboard: List[List[Union["types.KeyboardButton", str]]],
|
keyboard: List[List[Union["types.KeyboardButton", str]]],
|
||||||
|
is_persistent: bool = None,
|
||||||
resize_keyboard: bool = None,
|
resize_keyboard: bool = None,
|
||||||
one_time_keyboard: bool = None,
|
one_time_keyboard: bool = None,
|
||||||
selective: bool = None,
|
selective: bool = None,
|
||||||
@ -63,13 +68,14 @@ class ReplyKeyboardMarkup(Object):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.keyboard = keyboard
|
self.keyboard = keyboard
|
||||||
|
self.is_persistent = is_persistent
|
||||||
self.resize_keyboard = resize_keyboard
|
self.resize_keyboard = resize_keyboard
|
||||||
self.one_time_keyboard = one_time_keyboard
|
self.one_time_keyboard = one_time_keyboard
|
||||||
self.selective = selective
|
self.selective = selective
|
||||||
self.placeholder = placeholder
|
self.placeholder = placeholder
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def read(kb):
|
def read(kb: "raw.base.ReplyMarkup"):
|
||||||
keyboard = []
|
keyboard = []
|
||||||
|
|
||||||
for i in kb.rows:
|
for i in kb.rows:
|
||||||
@ -82,6 +88,7 @@ class ReplyKeyboardMarkup(Object):
|
|||||||
|
|
||||||
return ReplyKeyboardMarkup(
|
return ReplyKeyboardMarkup(
|
||||||
keyboard=keyboard,
|
keyboard=keyboard,
|
||||||
|
is_persistent=kb.persistent,
|
||||||
resize_keyboard=kb.resize,
|
resize_keyboard=kb.resize,
|
||||||
one_time_keyboard=kb.single_use,
|
one_time_keyboard=kb.single_use,
|
||||||
selective=kb.selective,
|
selective=kb.selective,
|
||||||
@ -100,5 +107,6 @@ class ReplyKeyboardMarkup(Object):
|
|||||||
resize=self.resize_keyboard or None,
|
resize=self.resize_keyboard or None,
|
||||||
single_use=self.one_time_keyboard or None,
|
single_use=self.one_time_keyboard or None,
|
||||||
selective=self.selective or None,
|
selective=self.selective or None,
|
||||||
|
persistent=self.is_persistent or None,
|
||||||
placeholder=self.placeholder or None
|
placeholder=self.placeholder or None
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user