From 6a3cdbe122f9e5d733bd61d38b3daa993d4613ce Mon Sep 17 00:00:00 2001 From: er-azh <80633916+er-azh@users.noreply.github.com> Date: Wed, 30 Oct 2024 19:47:55 +0000 Subject: [PATCH] Implement From<&Message> for InputMessage (#284) --- lib/grammers-client/src/types/input_message.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/grammers-client/src/types/input_message.rs b/lib/grammers-client/src/types/input_message.rs index 718ed360..20d945a4 100644 --- a/lib/grammers-client/src/types/input_message.rs +++ b/lib/grammers-client/src/types/input_message.rs @@ -401,3 +401,14 @@ impl From for InputMessage { } } } + +impl From<&super::Message> for InputMessage { + fn from(message: &super::Message) -> Self { + Self { + text: message.text().to_owned(), + entities: message.fmt_entities().cloned().unwrap_or(Vec::new()), + media: message.media().and_then(|m| m.to_raw_input_media()), + ..Default::default() + } + } +}