Skip to content

Commit

Permalink
Fix case insensitivity for aliases (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakelezz authored and arqunis committed Jan 31, 2018
1 parent 174e6d2 commit d240074
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/framework/standard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,12 @@ impl Framework for StandardFramework {
for group in groups.values() {
let command_length = built.len();

built = if self.configuration.case_insensitive {
built.to_lowercase()
} else {
built
};

let cmd = group.commands.get(&built);

if let Some(&CommandOrAlias::Alias(ref points_to)) = cmd {
Expand All @@ -963,12 +969,6 @@ impl Framework for StandardFramework {
built.clone()
};

to_check = if self.configuration.case_insensitive {
to_check.to_lowercase()
} else {
to_check
};

let mut args = {
let content = message.content.chars().skip(position).skip_while(|x| x.is_whitespace())
.skip(command_length).collect::<String>();
Expand Down Expand Up @@ -1009,6 +1009,7 @@ impl Framework for StandardFramework {
if let Some(&CommandOrAlias::Command(ref command)) =
group.commands.get(&to_check) {
let command = Arc::clone(command);

if let Some(error) = self.should_fail(
&mut context,
&message,
Expand Down

0 comments on commit d240074

Please sign in to comment.