Update gdrivesync command to error if JSON parsing fails (#143)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
# Description Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. - Update the gdrivesync command so if the JSON parse function fails, it returns an error message #134 ## Type of change Please delete options that are not relevant. - [x] New feature (non-breaking change which adds functionality) # How Has This Been Tested? Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration. # Checklist - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that provde my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/143 Reviewed-by: VylpesTester <tester@vylpes.com> Co-authored-by: Ethan Lane <ethan@vylpes.com> Co-committed-by: Ethan Lane <ethan@vylpes.com>
This commit is contained in:
parent
cfff3be143
commit
275a804e28
4 changed files with 13 additions and 7 deletions
2
.dev.env
2
.dev.env
|
@ -7,7 +7,7 @@
|
||||||
# any secret values.
|
# any secret values.
|
||||||
|
|
||||||
BOT_TOKEN=
|
BOT_TOKEN=
|
||||||
BOT_VER=0.4.0
|
BOT_VER=0.5.0
|
||||||
BOT_AUTHOR=Vylpes
|
BOT_AUTHOR=Vylpes
|
||||||
BOT_OWNERID=147392775707426816
|
BOT_OWNERID=147392775707426816
|
||||||
BOT_CLIENTID=682942374040961060
|
BOT_CLIENTID=682942374040961060
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# any secret values.
|
# any secret values.
|
||||||
|
|
||||||
BOT_TOKEN=
|
BOT_TOKEN=
|
||||||
BOT_VER=0.4.0
|
BOT_VER=0.5.0
|
||||||
BOT_AUTHOR=Vylpes
|
BOT_AUTHOR=Vylpes
|
||||||
BOT_OWNERID=147392775707426816
|
BOT_OWNERID=147392775707426816
|
||||||
BOT_CLIENTID=1093810443589529631
|
BOT_CLIENTID=1093810443589529631
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# any secret values.
|
# any secret values.
|
||||||
|
|
||||||
BOT_TOKEN=
|
BOT_TOKEN=
|
||||||
BOT_VER=0.4.0
|
BOT_VER=0.5.0
|
||||||
BOT_AUTHOR=Vylpes
|
BOT_AUTHOR=Vylpes
|
||||||
BOT_OWNERID=147392775707426816
|
BOT_OWNERID=147392775707426816
|
||||||
BOT_CLIENTID=1147976642942214235
|
BOT_CLIENTID=1147976642942214235
|
||||||
|
|
|
@ -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 interaction.editReply(`Error while running sync command. Safe Mode has been activated. Code: ${error.code}`);
|
||||||
await Config.SetValue("safemode", "true");
|
await Config.SetValue("safemode", "true");
|
||||||
} else {
|
} else {
|
||||||
await CardMetadataFunction.Execute();
|
const result = await CardMetadataFunction.Execute();
|
||||||
|
|
||||||
await interaction.editReply("Synced successfully.");
|
if (result) {
|
||||||
|
await interaction.editReply("Synced successfully.");
|
||||||
|
|
||||||
CoreClient.AllowDrops = true;
|
CoreClient.AllowDrops = true;
|
||||||
await Config.SetValue("safemode", "false");
|
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)"}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue