From c7e5259785992fb5d6376de52936c9b0bb6e692c Mon Sep 17 00:00:00 2001 From: Erwan <30729291+Quozul@users.noreply.github.com> Date: Fri, 15 Mar 2024 18:29:59 +0100 Subject: [PATCH] chore: improve delete command function --- src/main.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index c763139..0798a93 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,9 +8,19 @@ mod commands; struct Handler; #[allow(dead_code)] -async fn delete_all_commands(ctx: Context) -> Result<(), Box> { +async fn delete_all_commands(ctx: &Context) -> Result<(), Box> { for command in Command::get_global_commands(&ctx.http).await? { - Command::delete_global_command(&ctx.http, command.id).await? + Command::delete_global_command(&ctx.http, command.id).await?; + info!("Deleted global command {} commands!", command.name); + } + + let id: u64 = 533362856297496596; + let guild_id = GuildId::new(id); + let guild = Guild::get(ctx, guild_id).await.unwrap(); + let commands = guild.get_commands(ctx).await.unwrap(); + for command in commands { + let _ = guild.delete_command(ctx, command.id).await; + info!("Deleted guild command {} commands!", command.name); } Ok(())