From 6cf5a59074a9511b202fb6f77af333db6ff06b5f Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Wed, 17 Jan 2024 18:28:45 +0000 Subject: [PATCH] Update gdrivesync command to fail upon json error --- src/commands/gdrivesync.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/commands/gdrivesync.ts b/src/commands/gdrivesync.ts index be36fc1..35cf9cd 100644 --- a/src/commands/gdrivesync.ts +++ b/src/commands/gdrivesync.ts @@ -34,12 +34,18 @@ export default class Gdrivesync extends Command { await interaction.editReply(`Error while running sync command. Safe Mode has been activated. Code: ${error.code}`); await Config.SetValue("safemode", "true"); } else { - await CardMetadataFunction.Execute(); + const result = await CardMetadataFunction.Execute(); - await interaction.editReply("Synced successfully."); + if (result) { + await interaction.editReply("Synced successfully."); - CoreClient.AllowDrops = true; - await Config.SetValue("safemode", "false"); + CoreClient.AllowDrops = true; + await Config.SetValue("safemode", "false"); + } else { + const safemode = await Config.GetValue("safemode"); + + await interaction.editReply(`Sync failed. ${safemode == "true" ? "(Safe Mode is on)": "(Safe Mode is off)"}`); + } } }); }