Struct telbot_types::markup::ForceReply [−][src]
pub struct ForceReply {
pub input_field_placeholder: Option<String>,
pub selective: Option<bool>,
// some fields omitted
}Expand description
Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot’s message and tapped ‘Reply’).
This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.
Example: A poll bot for groups runs in privacy mode (only receives commands, replies to its messages and mentions). There could be two ways to create a new poll:
Explain the user how to send a command with parameters (e.g. /newpoll question answer1 answer2). May be appealing for hardcore users but lacks modern day polish.
Guide the user through a step-by-step process. ‘Please send me your question’, ‘Cool, now let’s add the first answer option’, ‘Great. Keep adding answer options, then send /done when you’re ready’.
The last option is definitely more attractive. And if you use ForceReply in your bot’s questions, it will receive the user’s answers even if it only receives replies, commands and mentions — without any extra work for the user.
Fields
input_field_placeholder: Option<String>The placeholder to be shown in the input field when the reply is active; 1-64 characters
selective: Option<bool>Use this parameter if you want to show the keyboard to specific users only.
Targets:
- users that are @mentioned in the text of the Message object;
- 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.
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Performs the conversion.