can now use reactions on lang command

This commit is contained in:
2020-11-23 14:11:57 +00:00
parent 06d13ec810
commit 3c1fe1f091
3 changed files with 105 additions and 22 deletions

View File

@ -47,6 +47,14 @@ impl LanguageManager {
.next()
}
pub fn get_language_by_flag(&self, flag: &str) -> Option<&str> {
self.languages
.iter()
.filter(|(k, _)| self.get(k, "flag") == flag)
.map(|(k, _)| k.as_str())
.next()
}
pub fn all_languages(&self) -> impl Iterator<Item = (&str, &str)> {
self.languages.iter().map(|(k, v)| (k.as_str(), v.as_str()))
}