13 lines
369 B
Rust
13 lines
369 B
Rust
|
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(),
|
||
|
}
|
||
|
}
|