mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
Add placeholder in ForceReply & ReplyKeyboardMarkup (#717)
* Added placeholder * Fix docs
This commit is contained in:
parent
244606eed6
commit
149685f9d3
2 changed files with 20 additions and 6 deletions
|
|
@ -36,24 +36,31 @@ class ForceReply(Object):
|
||||||
Use this parameter if you want to force reply from specific users only. Targets:
|
Use this parameter if you want to force reply from specific users only. Targets:
|
||||||
1) users that are @mentioned in the text of the Message object;
|
1) users that are @mentioned in the text of the Message object;
|
||||||
2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
|
2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
|
||||||
|
|
||||||
|
placeholder (``str``, *optional*):
|
||||||
|
The placeholder to be shown in the input field when the reply is active; 1-64 characters.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
selective: bool = None
|
selective: bool = None,
|
||||||
|
placeholder: str = None
|
||||||
):
|
):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.selective = selective
|
self.selective = selective
|
||||||
|
self.placeholder = placeholder
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def read(b):
|
def read(b):
|
||||||
return ForceReply(
|
return ForceReply(
|
||||||
selective=b.selective
|
selective=b.selective,
|
||||||
|
placeholder=b.placeholder
|
||||||
)
|
)
|
||||||
|
|
||||||
async def write(self, _: "pyrogram.Client"):
|
async def write(self, _: "pyrogram.Client"):
|
||||||
return raw.types.ReplyKeyboardForceReply(
|
return raw.types.ReplyKeyboardForceReply(
|
||||||
single_use=True,
|
single_use=True,
|
||||||
selective=self.selective or None
|
selective=self.selective or None,
|
||||||
|
placeholder=self.placeholder or None
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,9 @@ class ReplyKeyboardMarkup(Object):
|
||||||
2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
|
2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
|
||||||
Example: A user requests to change the bot's language, bot replies to the request with a keyboard to
|
Example: A user requests to change the bot's language, bot replies to the request with a keyboard to
|
||||||
select the new language. Other users in the group don't see the keyboard.
|
select the new language. Other users in the group don't see the keyboard.
|
||||||
|
|
||||||
|
placeholder (``str``, *optional*):
|
||||||
|
The placeholder to be shown in the input field when the keyboard is active; 1-64 characters.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
@ -54,7 +57,8 @@ class ReplyKeyboardMarkup(Object):
|
||||||
keyboard: List[List[Union["types.KeyboardButton", str]]],
|
keyboard: List[List[Union["types.KeyboardButton", str]]],
|
||||||
resize_keyboard: bool = None,
|
resize_keyboard: bool = None,
|
||||||
one_time_keyboard: bool = None,
|
one_time_keyboard: bool = None,
|
||||||
selective: bool = None
|
selective: bool = None,
|
||||||
|
placeholder: str = None
|
||||||
):
|
):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
|
|
@ -62,6 +66,7 @@ class ReplyKeyboardMarkup(Object):
|
||||||
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
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def read(kb):
|
def read(kb):
|
||||||
|
|
@ -79,7 +84,8 @@ class ReplyKeyboardMarkup(Object):
|
||||||
keyboard=keyboard,
|
keyboard=keyboard,
|
||||||
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,
|
||||||
|
placeholder=kb.placeholder
|
||||||
)
|
)
|
||||||
|
|
||||||
async def write(self, _: "pyrogram.Client"):
|
async def write(self, _: "pyrogram.Client"):
|
||||||
|
|
@ -93,5 +99,6 @@ class ReplyKeyboardMarkup(Object):
|
||||||
) for i in self.keyboard],
|
) for i in self.keyboard],
|
||||||
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,
|
||||||
|
placeholder=self.placeholder or None
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue