Add emoji to text

This commit is contained in:
Leon Grünewald 2024-12-11 22:16:54 +01:00
parent c0e9252fcd
commit 54b5ba5c5f

View file

@ -40,13 +40,14 @@ impl From<ScoredChatMessage> for Markup {
fn from(item: ScoredChatMessage) -> Markup { fn from(item: ScoredChatMessage) -> Markup {
if let Some(mime_type) = &item.chat_message.mime_type { if let Some(mime_type) = &item.chat_message.mime_type {
let message_file = item.chat_message.file.expect("No sticker file"); let message_file = item.chat_message.file.expect("No sticker file");
let message_emoji = item.chat_message.sticker_emoji.expect("No sticker emoji");
let message_date = item.last_used; let message_date = item.last_used;
match mime_type.as_str() { match mime_type.as_str() {
"image/webp" => { "image/webp" => {
return html! { return html! {
.sticker { .sticker {
img loading="lazy" src=(message_file); img loading="lazy" src=(message_file);
p { "Times used: " (item.times) br; (message_date.format("%Y-%m-%d %H:%M:%S")) } p { "Times used: " (item.times) br; (message_date.format("%Y-%m-%d %H:%M:%S")) br; (message_emoji) }
} }
}; };
} }
@ -54,7 +55,7 @@ impl From<ScoredChatMessage> for Markup {
return html! { return html! {
.sticker.animated { .sticker.animated {
video loading="lazy" autoplay loop controls src=(message_file) {} video loading="lazy" autoplay loop controls src=(message_file) {}
p { "Times used: " (item.times) br; (message_date.format("%Y-%m-%d %H:%M:%S")) } p { "Times used: " (item.times) br; (message_date.format("%Y-%m-%d %H:%M:%S")) br; (message_emoji) }
} }
} }
} }
@ -62,7 +63,7 @@ impl From<ScoredChatMessage> for Markup {
return html! { return html! {
.sticker.animated { .sticker.animated {
tgs-player loading="lazy" autoplay loop controls src=(message_file) {} tgs-player loading="lazy" autoplay loop controls src=(message_file) {}
p { "Times used: " (item.times) br; (message_date.format("%Y-%m-%d %H:%M:%S")) } p { "Times used: " (item.times) br; (message_date.format("%Y-%m-%d %H:%M:%S")) br; (message_emoji) }
} }
} }
} }
@ -87,6 +88,7 @@ struct ChatMessage {
pub media_type: Option<MediaType>, pub media_type: Option<MediaType>,
pub mime_type: Option<String>, pub mime_type: Option<String>,
pub file: Option<String>, pub file: Option<String>,
pub sticker_emoji: Option<String>,
pub date_unixtime: String, pub date_unixtime: String,
pub date: String pub date: String
} }