Search newer guilds first

This commit is contained in:
Sakuhl 2018-01-16 19:28:31 +01:00
parent 6b035809ea
commit 7a6f05ac70

View File

@ -100,7 +100,7 @@ fn guild_by_prefix(prefix: &str) -> Result<Option<String>, Error> {
return Ok(Some(guild.get("name").unwrap().as_str().unwrap().to_owned()));
}
}
for guild in guilds.get("guilds").unwrap().as_array().unwrap() {
for guild in guilds.get("guilds").unwrap().as_array().unwrap().into_iter().rev() {
if guild.get("prefix").unwrap().as_str().unwrap().to_lowercase() == prefix.to_lowercase() {
return Ok(Some(guild.get("name").unwrap().as_str().unwrap().to_owned()));
}