From 149685f9d3802130af31721171f9c7db4dabec57 Mon Sep 17 00:00:00 2001 From: Mahesh <44301650+Mahesh0253@users.noreply.github.com> Date: Sat, 29 Jan 2022 16:24:00 +0530 Subject: [PATCH] Add placeholder in ForceReply & ReplyKeyboardMarkup (#717) * Added placeholder * Fix docs --- pyrogram/types/bots_and_keyboards/force_reply.py | 13 ++++++++++--- .../bots_and_keyboards/reply_keyboard_markup.py | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/pyrogram/types/bots_and_keyboards/force_reply.py b/pyrogram/types/bots_and_keyboards/force_reply.py index 025176f2..4cb137d8 100644 --- a/pyrogram/types/bots_and_keyboards/force_reply.py +++ b/pyrogram/types/bots_and_keyboards/force_reply.py @@ -36,24 +36,31 @@ class ForceReply(Object): 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; 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__( self, - selective: bool = None + selective: bool = None, + placeholder: str = None ): super().__init__() self.selective = selective + self.placeholder = placeholder @staticmethod def read(b): return ForceReply( - selective=b.selective + selective=b.selective, + placeholder=b.placeholder ) async def write(self, _: "pyrogram.Client"): return raw.types.ReplyKeyboardForceReply( single_use=True, - selective=self.selective or None + selective=self.selective or None, + placeholder=self.placeholder or None ) diff --git a/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py b/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py index b619216a..b62f6dcf 100644 --- a/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py +++ b/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py @@ -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. 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. + + placeholder (``str``, *optional*): + The placeholder to be shown in the input field when the keyboard is active; 1-64 characters. """ def __init__( @@ -54,7 +57,8 @@ class ReplyKeyboardMarkup(Object): keyboard: List[List[Union["types.KeyboardButton", str]]], resize_keyboard: bool = None, one_time_keyboard: bool = None, - selective: bool = None + selective: bool = None, + placeholder: str = None ): super().__init__() @@ -62,6 +66,7 @@ class ReplyKeyboardMarkup(Object): self.resize_keyboard = resize_keyboard self.one_time_keyboard = one_time_keyboard self.selective = selective + self.placeholder = placeholder @staticmethod def read(kb): @@ -79,7 +84,8 @@ class ReplyKeyboardMarkup(Object): keyboard=keyboard, resize_keyboard=kb.resize, one_time_keyboard=kb.single_use, - selective=kb.selective + selective=kb.selective, + placeholder=kb.placeholder ) async def write(self, _: "pyrogram.Client"): @@ -93,5 +99,6 @@ class ReplyKeyboardMarkup(Object): ) for i in self.keyboard], resize=self.resize_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 )