From 1c41dff700ec5151c82528a2797f5e8625ba93b9 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Sat, 25 Jan 2025 12:31:28 -0700 Subject: [PATCH] Clear guild commands --- index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/index.js b/index.js index e0d3d61..c2aee04 100644 --- a/index.js +++ b/index.js @@ -69,6 +69,17 @@ client.on('ready', async () => { log.error(error) }); + // Clear guild commands + log.info("Clearing guild commands...") + const guilds = client.guilds.cache.map(guild => guild.id); + for (const guild of guilds) { + rest.put(Discord.Routes.applicationGuildCommands(client.user.id, guild), { body: [] }).then(() => { + log.success(`Cleared commands for guild ${guild}`) + }).catch((error) => { + log.error(error) + }); + } + } catch (error) { log.error(error) }