diff --git a/crates/teloxide-core/CHANGELOG.md b/crates/teloxide-core/CHANGELOG.md index 6b96e267..dde6fe70 100644 --- a/crates/teloxide-core/CHANGELOG.md +++ b/crates/teloxide-core/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Types of `Option` fields of `KeyboardMarkup`, `KeyboardRemove` and `ForceReply` to `bool` ([#853][pr853]) +- Type of `KeyboardMarkup::input_field_placeholder`: `Option` => `String` ([#853][pr853]) [pr852]: https://github.com/teloxide/teloxide/pull/853 diff --git a/crates/teloxide-core/src/types/reply_keyboard_markup.rs b/crates/teloxide-core/src/types/reply_keyboard_markup.rs index 19199a3d..7ea99f7c 100644 --- a/crates/teloxide-core/src/types/reply_keyboard_markup.rs +++ b/crates/teloxide-core/src/types/reply_keyboard_markup.rs @@ -42,7 +42,8 @@ pub struct KeyboardMarkup { /// The placeholder to be shown in the input field when the keyboard is /// active; 1-64 characters. - pub input_field_placeholder: Option, + #[serde(skip_serializing_if = "str::is_empty")] + pub input_field_placeholder: 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 @@ -70,7 +71,7 @@ impl KeyboardMarkup { is_persistent: false, resize_keyboard: false, one_time_keyboard: false, - input_field_placeholder: None, + input_field_placeholder: String::new(), selective: false, } } @@ -113,10 +114,10 @@ impl KeyboardMarkup { Self { one_time_keyboard: true, ..self } } - // FIXME: document + remove Option from signature. + // FIXME: document pub fn input_field_placeholder(self, val: T) -> Self where - T: Into>, + T: Into, { Self { input_field_placeholder: val.into(), ..self } }