From 9c2330897a5819c1e4e30e11ea7c9d894bade4ea Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Mon, 5 Jun 2023 17:58:25 +0400 Subject: [PATCH] Use `MessageId` for `reply_to_message_id` for some methods that were forgotten --- crates/teloxide-core/CHANGELOG.md | 1 + crates/teloxide-core/schema.ron | 6 +++--- crates/teloxide-core/src/payloads/send_game.rs | 5 +++-- crates/teloxide-core/src/payloads/send_invoice.rs | 5 +++-- crates/teloxide-core/src/payloads/send_sticker.rs | 5 +++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/crates/teloxide-core/CHANGELOG.md b/crates/teloxide-core/CHANGELOG.md index d81afb58..6d0f2d73 100644 --- a/crates/teloxide-core/CHANGELOG.md +++ b/crates/teloxide-core/CHANGELOG.md @@ -59,6 +59,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `Poll::total_voter_count` and `PollOption::voter_count` now use `u32` instead of `i32` ([#887][pr887]) - `PollAnswer::option_ids` now use `u8` instead of `i32` ([#887][pr887]) - Use `u32` for sizes and `Seconds` for timespans in `InlineQueryResult*` ([#887][pr887]) +- `SendGame::reply_to_message_id`, `SendSticker::reply_to_message_id` and `SendInvoice::reply_to_message_id` now use `MessageId` instead of `i32` ([#887][pr887]) [pr852]: https://github.com/teloxide/teloxide/pull/853 [pr859]: https://github.com/teloxide/teloxide/pull/859 diff --git a/crates/teloxide-core/schema.ron b/crates/teloxide-core/schema.ron index 66a35e33..d0519df9 100644 --- a/crates/teloxide-core/schema.ron +++ b/crates/teloxide-core/schema.ron @@ -3437,7 +3437,7 @@ Schema( ), Param( name: "reply_to_message_id", - ty: Option(i32), + ty: Option(RawTy("MessageId")), descr: Doc(md: "If the message is a reply, ID of the original message") ), Param( @@ -3798,7 +3798,7 @@ Schema( ), Param( name: "reply_to_message_id", - ty: Option(i32), + ty: Option(RawTy("MessageId")), descr: Doc(md: "If the message is a reply, ID of the original message") ), Param( @@ -4049,7 +4049,7 @@ Schema( ), Param( name: "reply_to_message_id", - ty: Option(i32), + ty: Option(RawTy("MessageId")), descr: Doc(md: "If the message is a reply, ID of the original message") ), Param( diff --git a/crates/teloxide-core/src/payloads/send_game.rs b/crates/teloxide-core/src/payloads/send_game.rs index 734cfede..551252f2 100644 --- a/crates/teloxide-core/src/payloads/send_game.rs +++ b/crates/teloxide-core/src/payloads/send_game.rs @@ -2,7 +2,7 @@ use serde::Serialize; -use crate::types::{Message, ReplyMarkup, ThreadId}; +use crate::types::{Message, MessageId, ReplyMarkup, ThreadId}; impl_payload! { /// Use this method to send a game. On success, the sent [`Message`] is returned. @@ -26,7 +26,8 @@ impl_payload! { /// Protects the contents of sent messages from forwarding and saving pub protect_content: bool, /// If the message is a reply, ID of the original message - pub reply_to_message_id: i32, + #[serde(serialize_with = "crate::types::serialize_reply_to_message_id")] + pub reply_to_message_id: MessageId, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found pub allow_sending_without_reply: bool, /// A JSON-serialized object for an [inline keyboard]. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game. diff --git a/crates/teloxide-core/src/payloads/send_invoice.rs b/crates/teloxide-core/src/payloads/send_invoice.rs index 0d428229..1156457c 100644 --- a/crates/teloxide-core/src/payloads/send_invoice.rs +++ b/crates/teloxide-core/src/payloads/send_invoice.rs @@ -3,7 +3,7 @@ use serde::Serialize; use url::Url; -use crate::types::{InlineKeyboardMarkup, LabeledPrice, Message, Recipient, ThreadId}; +use crate::types::{InlineKeyboardMarkup, LabeledPrice, Message, MessageId, Recipient, ThreadId}; impl_payload! { /// Use this method to send invoices. On success, the sent [`Message`] is returned. @@ -71,7 +71,8 @@ impl_payload! { /// Protects the contents of sent messages from forwarding and saving pub protect_content: bool, /// If the message is a reply, ID of the original message - pub reply_to_message_id: i32, + #[serde(serialize_with = "crate::types::serialize_reply_to_message_id")] + pub reply_to_message_id: MessageId, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found pub allow_sending_without_reply: bool, /// A JSON-serialized object for an [inline keyboard]. If empty, one 'Pay `total price`' button will be shown. If not empty, the first button must be a Pay button. diff --git a/crates/teloxide-core/src/payloads/send_sticker.rs b/crates/teloxide-core/src/payloads/send_sticker.rs index 7ab3b568..da0d9e57 100644 --- a/crates/teloxide-core/src/payloads/send_sticker.rs +++ b/crates/teloxide-core/src/payloads/send_sticker.rs @@ -2,7 +2,7 @@ use serde::Serialize; -use crate::types::{InputFile, Message, Recipient, ReplyMarkup, ThreadId}; +use crate::types::{InputFile, Message, MessageId, Recipient, ReplyMarkup, ThreadId}; impl_payload! { @[multipart = sticker] @@ -29,7 +29,8 @@ impl_payload! { /// Protects the contents of sent messages from forwarding and saving pub protect_content: bool, /// If the message is a reply, ID of the original message - pub reply_to_message_id: i32, + #[serde(serialize_with = "crate::types::serialize_reply_to_message_id")] + pub reply_to_message_id: MessageId, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found pub allow_sending_without_reply: bool, /// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.