use crate::util; use log::info; use serenity::framework::{ standard::macros::group, StandardFramework, }; #[cfg(feature = "diesel")] pub use self::meme::*; pub use self::{ playback::*, roll::ROLL_COMMAND, today::TODAY_COMMAND, }; pub(crate) mod playback; pub(crate) mod roll; pub(crate) mod sound_levels; pub(crate) mod today; mod help; #[group] #[prefix = ""] #[only_in(guild)] #[commands(roll, today)] struct General; pub fn register_commands(f: StandardFramework) -> StandardFramework { let result = f.group(&PLAYBACK_GROUP).group(&GENERAL_GROUP); #[cfg(feature = "diesel")] 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| { Box::pin(async move { let url = match msg.content.split_whitespace().skip(1).next() { Some(x) if x.starts_with("http") => x, _ => { info!("bad command formatting: '{}'", unrec); let _ = util::send( ctx, msg.channel_id, "format your commands right. fuck you.", msg.tts, ) .await; return; }, }; let _ = _play(ctx, msg, &url); }) }) } #[cfg(feature = "diesel")] mod meme;