Consider perfect matches first
This commit is contained in:
parent
e7d1b9c380
commit
6b035809ea
@ -95,6 +95,11 @@ fn guild_by_prefix(prefix: &str) -> Result<Option<String>, Error> {
|
||||
|
||||
let guilds: Value = serde_json::from_str(&resp)?;
|
||||
|
||||
for guild in guilds.get("guilds").unwrap().as_array().unwrap() {
|
||||
if guild.get("prefix").unwrap().as_str().unwrap() == prefix {
|
||||
return Ok(Some(guild.get("name").unwrap().as_str().unwrap().to_owned()));
|
||||
}
|
||||
}
|
||||
for guild in guilds.get("guilds").unwrap().as_array().unwrap() {
|
||||
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()));
|
||||
|
Loading…
Reference in New Issue
Block a user