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

@ -26,6 +26,11 @@ export default class Inventory extends ButtonEvent {
const embed = await InventoryHelper.GenerateInventoryPage(member.user.username, member.user.id, Number(page));
if (!embed) {
await interaction.followUp("No page for user found.");
return;
}
await interaction.followUp({
files: [ embed.image ],
embeds: [ embed.embed ],
@ -34,7 +39,7 @@ export default class Inventory extends ButtonEvent {
} catch (e) {
AppLogger.LogError("Button/Inventory", `Error generating inventory page for ${member.user.username} with id ${member.user.id}: ${e}`);
await interaction.reply("No page for user found.");
await interaction.followUp("An error has occurred running this command.");
}
}
}