From ea53af739af31a5254d3116d934b69d2633eb41f Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 29 Dec 2024 16:10:58 +0100 Subject: [PATCH] Add helper function for adding command to Commands --- euphoxide-bot/examples/examplebot.rs | 64 ++++++++++++++++------------ euphoxide-bot/src/command.rs | 7 +++ 2 files changed, 43 insertions(+), 28 deletions(-) diff --git a/euphoxide-bot/examples/examplebot.rs b/euphoxide-bot/examples/examplebot.rs index 68fed91..b0e8365 100644 --- a/euphoxide-bot/examples/examplebot.rs +++ b/euphoxide-bot/examples/examplebot.rs @@ -44,35 +44,43 @@ async fn add(args: AddArgs, msg: &Message, ctx: &Context) -> euphoxide::Result

clap::Clap { clap::Clap(self) } + + fn add_to(self, commands: &mut Commands) + where + Self: Command + Send + Sync + 'static, + { + commands.add(self); + } } // Sadly this doesn't work: `impl> CommandExt for C {}`