initial commit
This commit is contained in:
13
bot/src/utils/flags.rs
Normal file
13
bot/src/utils/flags.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
pub fn country_code_to_flag(code: &str) -> String {
|
||||
if code.len() != 2 {
|
||||
return "🏳".to_string();
|
||||
}
|
||||
|
||||
code.to_uppercase()
|
||||
.chars()
|
||||
.map(|c| {
|
||||
// regional indicator symbols start at 0x1F1E6 ('A')
|
||||
char::from_u32(0x1F1E6 + (c as u32 - 'A' as u32)).unwrap_or('?')
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
Reference in New Issue
Block a user