From 74d43b5fe6953b5d0179779664c78171c7e625ce Mon Sep 17 00:00:00 2001 From: Mari Date: Sat, 4 May 2024 00:44:10 -0700 Subject: [PATCH] Add some error handling for commands --- src/commands/base.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/commands/base.ts b/src/commands/base.ts index b5b22a4..a988f66 100644 --- a/src/commands/base.ts +++ b/src/commands/base.ts @@ -231,6 +231,11 @@ export abstract class AbstractCharacterStatusCommand extends SlashCommand { } } const loadedCharacters = await this.loadCharacters(neededCharacters); + for (const char of loadedCharacters) { + if (!char.success) { + console.error(`While loading ${char.name}: `, char.error) + } + } const characterMap = new Map(); for (const character of loadedCharacters) { characterMap.set(character.name, character); @@ -349,7 +354,7 @@ export abstract class AbstractCharacterStatusCommand extends SlashCommand { } await Promise.all(pendingSaves); return ctx.send({ - content: message ?? undefined, + content: message ?? (resultImage ? undefined : "Uh... OK? There's kind of nothing to say..."), attachments: resultImage ? [ {