Skip to content

Commit

Permalink
Implement From<&Message> for InputMessage (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
er-azh authored Oct 30, 2024
1 parent d62c5ac commit 6a3cdbe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/grammers-client/src/types/input_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,3 +401,14 @@ impl From<String> 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()
}
}
}

0 comments on commit 6a3cdbe

Please sign in to comment.