Update inventory command so it errors gracefully if no page is found for the user (#286)
All checks were successful
Deploy To Stage / build (push) Successful in 13s
Deploy To Stage / deploy (push) Successful in 16s

#251

Reviewed-on: #286
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:
Ethan Lane 2024-07-06 19:12:22 +01:00 committed by Vylpes
parent edf6c99bad
commit 6a18f34949
3 changed files with 16 additions and 5 deletions

View file

@ -39,6 +39,11 @@ export default class Inventory extends Command {
const embed = await InventoryHelper.GenerateInventoryPage(user.username, user.id, pageNumber);
if (!embed) {
await interaction.followUp("No page for user found.");
return;
}
await interaction.followUp({
files: [ embed.image ],
embeds: [ embed.embed ],
@ -47,7 +52,7 @@ export default class Inventory extends Command {
} catch (e) {
AppLogger.LogError("Commands/Inventory", e as string);
await interaction.followUp("No page for user found.");
await interaction.followUp("An error has occurred running this command.");
}
}
}