From 193edbb9a7f2b88c9d263484a803d1f2a2421231 Mon Sep 17 00:00:00 2001 From: Lionarius Date: Mon, 17 Apr 2023 21:29:31 +0300 Subject: [PATCH] add description and delete all commands on start --- src/bot/commands/rating.rs | 2 +- src/bot/mod.rs | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/bot/commands/rating.rs b/src/bot/commands/rating.rs index acf7a09..d936945 100644 --- a/src/bot/commands/rating.rs +++ b/src/bot/commands/rating.rs @@ -26,7 +26,7 @@ impl MixerCommand for RatingCommand { fn create(&self, command: &mut CreateApplicationCommand) { command .name(self.name()) - .description("") + .description("Set user's rating on specific role") .create_option(|option| { option .name("set") diff --git a/src/bot/mod.rs b/src/bot/mod.rs index ed3cd69..1f9af32 100644 --- a/src/bot/mod.rs +++ b/src/bot/mod.rs @@ -40,7 +40,17 @@ impl EventHandler for MixerBot { async fn ready(&self, ctx: Context, data_about_bot: Ready) { info!("{} is connected!", data_about_bot.user.name); - Command::set_global_application_commands(&ctx.http, |commands| { + let commands = Command::get_global_application_commands(&ctx) + .await + .unwrap(); + + for command in commands { + Command::delete_global_application_command(&ctx, command.id) + .await + .unwrap(); + } + + Command::set_global_application_commands(ctx, |commands| { self.command_handler.create_all(commands); commands })