mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 06:25:10 +01:00
Merge pull request #1182 from LasterAlex/fix-inline-query-results-button-serializing
Fixed InlineQueryResultsButton serialization
This commit is contained in:
commit
329e397900
2 changed files with 18 additions and 0 deletions
|
@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Now Vec<MessageId> in requests serializes into [number] instead of [ {message_id: number} ], `forward_messages`, `copy_messages` and `delete_messages` now work properly
|
- Now Vec<MessageId> in requests serializes into [number] instead of [ {message_id: number} ], `forward_messages`, `copy_messages` and `delete_messages` now work properly
|
||||||
|
- Now `InlineQueryResultsButton` serializes properly ([issue 1181](https://github.com/teloxide/teloxide/issues/1181))
|
||||||
|
|
||||||
## 0.13.0 - 2024-08-16
|
## 0.13.0 - 2024-08-16
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ pub struct InlineQueryResultsButton {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum InlineQueryResultsButtonKind {
|
pub enum InlineQueryResultsButtonKind {
|
||||||
/// Description of the [Web App] that will be launched when the user presses
|
/// Description of the [Web App] that will be launched when the user presses
|
||||||
/// the button. The Web App will be able to switch back to the inline mode
|
/// the button. The Web App will be able to switch back to the inline mode
|
||||||
|
@ -44,3 +45,19 @@ pub enum InlineQueryResultsButtonKind {
|
||||||
/// [switch_inline]: https://core.telegram.org/bots/api#inlinekeyboardmarkup
|
/// [switch_inline]: https://core.telegram.org/bots/api#inlinekeyboardmarkup
|
||||||
StartParameter(String),
|
StartParameter(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use crate::types::{InlineQueryResultsButton, InlineQueryResultsButtonKind};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn inline_query_results_button() {
|
||||||
|
let button = InlineQueryResultsButton {
|
||||||
|
text: "test".into(),
|
||||||
|
kind: InlineQueryResultsButtonKind::StartParameter("bot".into()),
|
||||||
|
};
|
||||||
|
let expected = r#"{"text":"test","start_parameter":"bot"}"#;
|
||||||
|
let actual = serde_json::to_string(&button).unwrap();
|
||||||
|
assert_eq!(expected, actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue