Update inventory command so it errors gracefully if no page is found for the user (#286)
#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:
parent
edf6c99bad
commit
6a18f34949
3 changed files with 16 additions and 5 deletions
|
@ -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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue