diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/commands/help.rs | 32 | ||||
| -rw-r--r-- | src/commands/mod.rs | 29 | ||||
| -rw-r--r-- | src/game.rs | 1 | ||||
| -rw-r--r-- | src/main.rs | 4 |
4 files changed, 52 insertions, 14 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); + }) } diff --git a/src/game.rs b/src/game.rs index 31e19b7..b5c6b49 100644 --- a/src/game.rs +++ b/src/game.rs @@ -57,6 +57,7 @@ group!({ only_in: "guild", }, commands: [ + game, installedgame, ownedgame, updategaem, diff --git a/src/main.rs b/src/main.rs index 98c9765..636fe44 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,6 +28,7 @@ use log::{ error, info, trace, + warn, }; use serenity::{ framework::StandardFramework, @@ -132,7 +133,7 @@ fn run() -> Result<()> { .and_then(|f| serde_json::from_reader::<_, Vec<u64>>(f).map_err(Error::from)); if let Err(ref e) = restrict_ids { - error!("opening restrict file: {}", e); + warn!("opening restrict file: {}", e); } let restrict_ids = restrict_ids @@ -274,7 +275,6 @@ fn main() { message )) }) - .level(log::LevelFilter::Info) .level_for("thulani", log::LevelFilter::Trace) .chain(fern::log_file("thulani.log").expect("problem creating log file")) |
