Skip to content

Commit

Permalink
Add help command
Browse files Browse the repository at this point in the history
  • Loading branch information
Scotsguy committed Feb 15, 2020
1 parent 990b57d commit 7876525
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ use regex::Regex;
use reqwest::blocking::get;

use serenity::{
framework::standard::StandardFramework,
framework::standard::{
help_commands, macros::help, Args, CommandGroup, CommandResult, HelpOptions,
StandardFramework,
},
model::{channel::Message, gateway::Ready, id::UserId},
prelude::*,
utils::Colour,
Expand All @@ -16,6 +19,7 @@ use parsers::PARSERS;

mod commands;
use commands::{STATICIMAGE_GROUP, STATICTEXT_GROUP};
use std::collections::HashSet;

fn main() {
kankyo::load(false).expect("Expected a .env file");
Expand Down Expand Up @@ -44,14 +48,31 @@ fn main() {
.case_insensitivity(true)
})
.group(&STATICTEXT_GROUP)
.group(&STATICIMAGE_GROUP),
.group(&STATICIMAGE_GROUP)
.help(&MY_HELP),
);

if let Err(why) = client.start() {
error!("Client error: {:?}", why);
}
}

#[help]
#[strikethrough_commands_tip_in_guild(" ")]
#[strikethrough_commands_tip_in_dm(" ")]
#[individual_command_tip = " "]
#[max_levenshtein_distance(3)]
fn my_help(
context: &mut Context,
msg: &Message,
args: Args,
help_options: &'static HelpOptions,
groups: &[&'static CommandGroup],
owners: HashSet<UserId>,
) -> CommandResult {
help_commands::with_embeds(context, msg, args, help_options, groups, owners)
}

fn common_mistakes(input: &str) -> Vec<(&str, String)> {
PARSERS.par_iter().flat_map(|m| m(input)).collect()
}
Expand Down

0 comments on commit 7876525

Please sign in to comment.