diff options
| author | Nathan Perry <np@nathanperry.dev> | 2024-05-08 10:28:04 -0400 |
|---|---|---|
| committer | Nathan Perry <np@nathanperry.dev> | 2024-05-08 14:16:01 -0400 |
| commit | fe467f60d99efa54f2ef64606e7d39b9b06d7294 (patch) | |
| tree | a62bb50fedb1959d1a155878f0ff0ab7b1f699b6 /src/commands/mod.rs | |
| parent | 48aa684dece2696e21fd871eb6f3825f28fe0200 (diff) | |
update all deps
Diffstat (limited to 'src/commands/mod.rs')
| -rw-r--r-- | src/commands/mod.rs | 74 |
1 files changed, 29 insertions, 45 deletions
diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 705d697..4893e73 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,71 +1,55 @@ use log::info; -use serenity::{ - framework::{ - StandardFramework, - standard::{ - macros::group, - }, - }, -}; - -use crate::{ - util::CtxExt, +use serenity::framework::{ + standard::macros::group, + StandardFramework, }; +#[cfg(feature = "diesel")] +pub use self::meme::*; pub use self::{ playback::*, - sound_levels::*, - roll::{roll, ROLL_COMMAND}, - today::{today, TODAY_COMMAND}, + roll::ROLL_COMMAND, + today::{ + today, + TODAY_COMMAND, + }, }; -#[cfg(feature = "diesel")] -pub use self::meme::*; pub(crate) mod playback; -pub(crate) mod sound_levels; pub(crate) mod roll; +pub(crate) mod sound_levels; pub(crate) mod today; mod help; -group!({ - name: "general", - options: { - only_in: "guild", - }, - commands: [ - roll, - today, - ], -}); +#[group] +#[prefix = ""] +#[only_in(guild)] +#[commands(roll, today)] +struct General; pub fn register_commands(f: StandardFramework) -> StandardFramework { - let result = f - .group(&self::playback::PLAYBACK_GROUP) - .group(&GENERAL_GROUP); + let result = f.group(&PLAYBACK_GROUP).group(&GENERAL_GROUP); #[cfg(feature = "diesel")] - let result = result.group(&self::meme::MEMES_GROUP); + let result = result.group(&MEMES_GROUP); #[cfg(feature = "games")] let result = result.group(&crate::game::GAME_GROUP); - 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; - } - }; + 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 _ = _play(ctx, msg, &url); + }) } - #[cfg(feature = "diesel")] mod meme; |
