From dd2fee24d06444ea52d368ba6ea2cdeebb7b6b51 Mon Sep 17 00:00:00 2001 From: Maseshi Date: Mon, 16 May 2022 13:10:54 +0700 Subject: [PATCH] Added a way to clear the old application commands. --- source/events/client/ready.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/events/client/ready.js b/source/events/client/ready.js index 28dd811b..309cedde 100644 --- a/source/events/client/ready.js +++ b/source/events/client/ready.js @@ -93,11 +93,19 @@ module.exports = async (client) => { const data = client.interaction.map(commands => commands.interaction.data); if (client.mode === "start") { + // Remove all old commands. + await client.application.commands.set([]); + + // Set all new commands. await client.application.commands.set(data); spinnies.remove("app-commands-loading"); console.log("Application (/) commands is ready to use. "); } else { + // Remove all old commands. + await client.application.commands.set([]); + + // Set all new commands. await client.application.commands.set(data, guildID); spinnies.remove("app-commands-loading");