add description and delete all commands on start

This commit is contained in:
Lionarius
2023-04-17 21:29:31 +03:00
parent 09ac679496
commit 193edbb9a7
2 changed files with 12 additions and 2 deletions

View File

@@ -26,7 +26,7 @@ impl MixerCommand for RatingCommand {
fn create(&self, command: &mut CreateApplicationCommand) { fn create(&self, command: &mut CreateApplicationCommand) {
command command
.name(self.name()) .name(self.name())
.description("") .description("Set user's rating on specific role")
.create_option(|option| { .create_option(|option| {
option option
.name("set") .name("set")

View File

@@ -40,7 +40,17 @@ impl EventHandler for MixerBot {
async fn ready(&self, ctx: Context, data_about_bot: Ready) { async fn ready(&self, ctx: Context, data_about_bot: Ready) {
info!("{} is connected!", data_about_bot.user.name); 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); self.command_handler.create_all(commands);
commands commands
}) })