diff options
| author | Nathan Perry <np@nathanperry.dev> | 2020-01-28 17:26:01 -0500 |
|---|---|---|
| committer | Nathan Perry <np@nathanperry.dev> | 2020-01-28 17:26:01 -0500 |
| commit | af2676294754d22cf2774f2cea2c16151aa5a6c7 (patch) | |
| tree | 421e1c305691db7d7fe3a2c9a0a8e752b130dd1d /src/commands | |
| parent | dde5eb52706a9ca8ee257a6cbd75e243582d0a86 (diff) | |
add help, fix gaem
Diffstat (limited to 'src/commands')
| -rw-r--r-- | src/commands/help.rs | 32 | ||||
| -rw-r--r-- | src/commands/mod.rs | 29 |
2 files changed, 49 insertions, 12 deletions
diff --git a/src/commands/help.rs b/src/commands/help.rs new file mode 100644 index 0000000..743a099 --- /dev/null +++ b/src/commands/help.rs @@ -0,0 +1,32 @@ +use std::collections::HashSet; + +use serenity::{ + model::{ + channel::Message, + id::UserId, + }, + framework::{ + standard::{ + macros::help, + help_commands, + Args, + HelpOptions, + CommandGroup, + }, + }, + prelude::*, +}; + +use crate::Result; + +#[help] +pub fn help( + ctx: &mut Context, + msg: &Message, + args: Args, + opts: &'static HelpOptions, + groups: &[&'static CommandGroup], + owners: HashSet<UserId>, +) -> Result<()> { + help_commands::with_embeds(ctx, msg, args, opts, groups, owners) +} diff --git a/src/commands/mod.rs b/src/commands/mod.rs index da75275..74cdaf5 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -2,7 +2,9 @@ use log::info; use serenity::{ framework::{ StandardFramework, - standard::macros::group, + standard::{ + macros::group, + }, }, }; @@ -21,6 +23,7 @@ pub use self::meme::*; pub(crate) mod playback; pub(crate) mod sound_levels; pub(crate) mod roll; +mod help; group!({ @@ -44,18 +47,20 @@ pub fn register_commands(f: StandardFramework) -> StandardFramework { #[cfg(feature = "games")] let result = result.group(&crate::game::GAME_GROUP); - result.unrecognised_command(|ctx, msg, unrec| { - let url = match msg.content.split_whitespace().skip(1).next() { - Some(x) if x.starts_with("http") => x, - _ => { - info!("bad command formatting: '{}'", unrec); - let _ = ctx.send(msg.channel_id, "format your commands right. fuck you.", msg.tts); - return; - } - }; + result + .help(&help::HELP) + .unrecognised_command(|ctx, msg, unrec| { + let url = match msg.content.split_whitespace().skip(1).next() { + Some(x) if x.starts_with("http") => x, + _ => { + info!("bad command formatting: '{}'", unrec); + let _ = ctx.send(msg.channel_id, "format your commands right. fuck you.", msg.tts); + return; + } + }; - let _ = self::playback::_play(ctx, msg, &url); - }) + let _ = self::playback::_play(ctx, msg, &url); + }) } |
