mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-14 11:44:04 +01:00
TBA 5.3: Add input_field_placeholder
to KeyboardMarkup
and ForceReply
This commit is contained in:
parent
52313b740c
commit
2c65fea742
2 changed files with 27 additions and 1 deletions
|
@ -13,12 +13,16 @@ use crate::types::True;
|
|||
///
|
||||
/// [privacy mode]: https://core.telegram.org/bots#privacy-mode
|
||||
#[serde_with_macros::skip_serializing_none]
|
||||
#[derive(Copy, Clone, Default, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Default, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ForceReply {
|
||||
/// Shows reply interface to the user, as if they manually selected the
|
||||
/// bot‘s message and tapped ’Reply'.
|
||||
pub force_reply: True,
|
||||
|
||||
/// The placeholder to be shown in the input field when the reply is active;
|
||||
/// 1-64 characters.
|
||||
pub input_field_placeholder: Option<String>,
|
||||
|
||||
/// 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
|
||||
|
@ -32,10 +36,19 @@ impl ForceReply {
|
|||
pub const fn new() -> Self {
|
||||
Self {
|
||||
force_reply: True,
|
||||
input_field_placeholder: None,
|
||||
selective: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn input_field_placeholder<T>(mut self, val: T) -> Self
|
||||
where
|
||||
T: Into<Option<String>>,
|
||||
{
|
||||
self.input_field_placeholder = val.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub const fn selective(mut self, val: bool) -> Self {
|
||||
self.selective = Some(val);
|
||||
self
|
||||
|
|
|
@ -31,6 +31,10 @@ pub struct KeyboardMarkup {
|
|||
/// Defaults to `false`.
|
||||
pub one_time_keyboard: Option<bool>,
|
||||
|
||||
/// The placeholder to be shown in the input field when the keyboard is
|
||||
/// active; 1-64 characters.
|
||||
pub input_field_placeholder: Option<String>,
|
||||
|
||||
/// Use this parameter if you want to show the keyboard to 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
|
||||
|
@ -58,6 +62,7 @@ impl KeyboardMarkup {
|
|||
.collect(),
|
||||
resize_keyboard: None,
|
||||
one_time_keyboard: None,
|
||||
input_field_placeholder: None,
|
||||
selective: None,
|
||||
}
|
||||
}
|
||||
|
@ -91,6 +96,14 @@ impl KeyboardMarkup {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn input_field_placeholder<T>(mut self, val: T) -> Self
|
||||
where
|
||||
T: Into<Option<String>>,
|
||||
{
|
||||
self.input_field_placeholder = val.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn selective<T>(mut self, val: T) -> Self
|
||||
where
|
||||
T: Into<Option<bool>>,
|
||||
|
|
Loading…
Add table
Reference in a new issue