tetratto/crates/app/src/routes/api/v1/communities/emojis.rs

13 lines
369 B
Rust
Raw Normal View History

2025-05-05 23:44:10 -04:00
use axum::response::IntoResponse;
/// Expand a unicode emoji into its Gemoji shortcode.
pub async fn get_emoji_shortcode(emoji: String) -> impl IntoResponse {
match emojis::get(&emoji) {
Some(e) => match e.shortcode() {
Some(s) => s.to_string(),
None => e.name().replace(" ", "-"),
},
None => String::new(),
}
}