From 270a2b48d9a40dd42028f61531c83a8dd3aaf36b 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/src/command.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/euphoxide-bot/src/command.rs b/euphoxide-bot/src/command.rs index 29534d0..c2a04dd 100644 --- a/euphoxide-bot/src/command.rs +++ b/euphoxide-bot/src/command.rs @@ -153,6 +153,13 @@ pub trait CommandExt: Sized { fn clap(self) -> 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 {}`