From ce79f0183d9fc457ce0fc10fa94e3a1350f33f66 Mon Sep 17 00:00:00 2001 From: Lakelezz <12222135+Lakelezz@users.noreply.github.com> Date: Sun, 9 Sep 2018 13:12:38 +0200 Subject: Suggest similar commands when using help (#377) --- src/framework/standard/create_help_command.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/framework/standard/create_help_command.rs') diff --git a/src/framework/standard/create_help_command.rs b/src/framework/standard/create_help_command.rs index b1fd8ec..b8eb57a 100644 --- a/src/framework/standard/create_help_command.rs +++ b/src/framework/standard/create_help_command.rs @@ -218,6 +218,13 @@ impl CreateHelpCommand { self } + /// Sets the maximum Levenshtein-distance to find similar commands. + pub fn max_levenshtein_distance(mut self, distance: usize) -> Self { + self.0.max_levenshtein_distance = distance; + + self + } + fn produce_strike_text(&self, dm_or_guild: &str) -> Option { let mut strike_text = String::from("~~`Strikethrough commands`~~ are unavailable because they"); let mut is_any_option_strike = false; -- cgit v1.2.3