Skip to content

Commit

Permalink
Fix help-commands' plain
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakelezz authored and arqunis committed Jan 5, 2018
1 parent 9aaa555 commit 4bd223a
Showing 1 changed file with 37 additions and 4 deletions.
41 changes: 37 additions & 4 deletions src/framework/standard/help_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,13 @@ pub fn plain<H: BuildHasher>(
return Ok(());
}

let mut result = format!("**Commands**\n{}\n\n", help_options.individual_command_tip)
.to_string();
let mut result = "**Commands**\n".to_string();

if let Some(striked_command_text) = help_options.striked_commands_tip.clone() {
let _ = write!(result, "{}\n{}\n\n", &help_options.individual_command_tip, &striked_command_text);
} else {
let _ = write!(result, "{}\n\n", &help_options.individual_command_tip);
}

let mut group_names = groups.keys().collect::<Vec<_>>();
group_names.sort();
Expand All @@ -432,8 +437,36 @@ pub fn plain<H: BuildHasher>(
let cmd = &commands[name];
let cmd = cmd.options();

if cmd.help_available && has_all_requirements(&cmd, msg) {
let _ = write!(group_help, "`{}` ", name);
if !cmd.dm_only && !cmd.guild_only || cmd.dm_only && msg.is_private() || cmd.guild_only && !msg.is_private() {
if cmd.help_available && has_correct_permissions(&cmd, msg) {
let _ = write!(group_help, "`{}` ", name);
} else {
match help_options.lacking_permissions {
HelpBehaviour::Strike => {
let name = format!("~~`{}`~~", &name);
let _ = write!(group_help, "{} ", name);
},
HelpBehaviour::Nothing => {
let _ = write!(group_help, "`{}` ", name);
},
HelpBehaviour::Hide => {
continue;
},
}
}
} else {
match help_options.wrong_channel {
HelpBehaviour::Strike => {
let name = format!("~~`{}`~~", &name);
let _ = write!(group_help, "{} ", name);
},
HelpBehaviour::Nothing => {
let _ = write!(group_help, "`{}` ", name);
},
HelpBehaviour::Hide => {
continue;
},
}
}
}

Expand Down

0 comments on commit 4bd223a

Please sign in to comment.