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
|
@ -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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue