From fe467f60d99efa54f2ef64606e7d39b9b06d7294 Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Wed, 8 May 2024 10:28:04 -0400 Subject: update all deps --- src/commands/mod.rs | 76 +++++++++++++++++++++-------------------------------- 1 file changed, 30 insertions(+), 46 deletions(-) (limited to 'src/commands/mod.rs') 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; - } - }; - - let _ = self::playback::_play(ctx, msg, &url); - }) + 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 _ = _play(ctx, msg, &url); + }) } - #[cfg(feature = "diesel")] mod meme; -- cgit v1.3.1