diff options
Diffstat (limited to 'src/commands/mod.rs')
| -rw-r--r-- | src/commands/mod.rs | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 88a47b3..e55419b 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,20 +1,53 @@ -use crate::Data; - -use eyre::Report; -use poise::Command; +use crate::{Data, Error}; mod general; mod moderation; mod optional; -pub fn global() -> Vec<Command<Data, Report>> { - general::to_comands() +type Command = poise::Command<Data, Error>; + +#[macro_export] +macro_rules! cmd { + ($module: ident, $name: ident) => { + $module::$name::$name() + }; + + ($module: ident, $name: ident, $func: ident) => { + $module::$name::$func() + }; +} + +pub fn to_vec() -> Vec<Command> { + vec![ + cmd!(general, ask), + cmd!(general, bing), + cmd!(general, config), + cmd!(general, convert), + cmd!(general, random), + cmd!(general, version), + cmd!(moderation, clear_messages), + cmd!(optional, copypasta), + cmd!(optional, teawiespam), + cmd!(optional, uwurandom), + ] } -pub fn optional() -> Vec<Command<Data, Report>> { - optional::to_commands() +pub fn to_vec_global() -> Vec<Command> { + vec![ + cmd!(general, ask), + cmd!(general, bing), + cmd!(general, config), + cmd!(general, convert), + cmd!(general, random), + cmd!(general, version), + cmd!(moderation, clear_messages), + ] } -pub fn moderation() -> Vec<Command<Data, Report>> { - moderation::to_commands() +pub fn to_vec_optional() -> Vec<Command> { + vec![ + cmd!(optional, copypasta), + cmd!(optional, teawiespam), + cmd!(optional, uwurandom), + ] } |
