From 08d7d8f6b4195fae8a43414809ce24cf493b4c61 Mon Sep 17 00:00:00 2001 From: Akshett Rai Jindal Date: Sat, 24 Aug 2024 13:25:15 +0530 Subject: [PATCH] Move `business_connection_id` from `Message` to `MessageCommon` --- crates/teloxide-core/src/types/message.rs | 14 ++++++-------- crates/teloxide-core/src/types/update.rs | 2 +- crates/teloxide/src/dispatching/handler_ext.rs | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/crates/teloxide-core/src/types/message.rs b/crates/teloxide-core/src/types/message.rs index 23d67f63..2b2ce6e2 100644 --- a/crates/teloxide-core/src/types/message.rs +++ b/crates/teloxide-core/src/types/message.rs @@ -59,12 +59,6 @@ pub struct Message { /// connected business account. pub sender_business_bot: Option, - /// Unique identifier of the business connection from which the message was - /// received. If non-empty, the message belongs to a chat of the - /// corresponding business account that is independent from any potential - /// bot chat which might share the same identifier. - pub business_connection_id: Option, - #[serde(flatten)] pub kind: MessageKind, } @@ -170,6 +164,12 @@ pub struct MessageCommon { /// an away or a greeting business message, or as a scheduled message #[serde(default, skip_serializing_if = "std::ops::Not::not")] pub is_from_offline: bool, + + /// Unique identifier of the business connection from which the message was + /// received. If non-empty, the message belongs to a chat of the + /// corresponding business account that is independent from any potential + /// bot chat which might share the same identifier. + pub business_connection_id: Option, } #[serde_with::skip_serializing_none] @@ -1917,7 +1917,6 @@ mod tests { chat_full_info: ChatFullInfo::default() }, sender_business_bot: None, - business_connection_id: None, kind: MessageKind::ChatShared(MessageChatShared { chat_shared: ChatShared { request_id: RequestId(348349), @@ -2590,7 +2589,6 @@ mod tests { }, via_bot: None, sender_business_bot: None, - business_connection_id: None, kind: MessageKind::Giveaway(MessageGiveaway { giveaway: Giveaway { chats: vec![Chat { diff --git a/crates/teloxide-core/src/types/update.rs b/crates/teloxide-core/src/types/update.rs index 6af03fba..b6707c2b 100644 --- a/crates/teloxide-core/src/types/update.rs +++ b/crates/teloxide-core/src/types/update.rs @@ -609,7 +609,6 @@ mod test { chat_full_info: ChatFullInfo::default(), }, sender_business_bot: None, - business_connection_id: None, kind: MessageKind::Common(MessageCommon { reply_to_message: None, forward_origin: None, @@ -634,6 +633,7 @@ mod test { is_automatic_forward: false, has_protected_content: false, is_from_offline: false, + business_connection_id: None, }), }), }; diff --git a/crates/teloxide/src/dispatching/handler_ext.rs b/crates/teloxide/src/dispatching/handler_ext.rs index ae59c76f..d45c29f1 100644 --- a/crates/teloxide/src/dispatching/handler_ext.rs +++ b/crates/teloxide/src/dispatching/handler_ext.rs @@ -190,7 +190,6 @@ mod tests { sender_chat: None, is_topic_message: false, sender_business_bot: None, - business_connection_id: None, date, chat: Chat { id: ChatId(109_998_024), @@ -239,6 +238,7 @@ mod tests { reply_to_story: None, sender_boost_count: None, is_from_offline: false, + business_connection_id: None, }), }), }