From a3625e2e3fa8419cbfa0b3cc6ec71ca83cb65274 Mon Sep 17 00:00:00 2001 From: Taken Date: Sun, 28 Jan 2024 12:09:27 +0100 Subject: [PATCH] Updated autodeploy script --- src/utils/Autodeploy.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/utils/Autodeploy.ts b/src/utils/Autodeploy.ts index d944d8a..4dacb1b 100644 --- a/src/utils/Autodeploy.ts +++ b/src/utils/Autodeploy.ts @@ -95,12 +95,13 @@ export default async function autoDeployCommands(fileType: FileType, client: Ext } for (const cmd of commandData) { - const currentCommand = currentCommandsData.find(c => c.name === cmd.name)! - const newCmd = commands.find(c => c.name === cmd.name)! - const currentCommandID = currentCommands.find(c => c.name === cmd.name)!.id + if (!currentCommandsData.find(c => c.name === cmd.name)) continue - if (JSON.stringify(cmd) !== JSON.stringify(currentCommand)) { - await guildclient.commands.edit(currentCommandID, newCmd) + const currentCommand = currentCommands.find(c => c.name === cmd.name)! + const currentCommandData = currentCommandsData.find(c => c.name === cmd.name)! + + if (JSON.stringify(cmd) !== JSON.stringify(currentCommandData)) { + await guildclient.commands.edit(currentCommand.id, cmd) console.log(color(" " + cmd.name + " was updated.", "lavender")) } }