From 399e9af75a03117228f4a1c1dd8bd5a24bba38bd Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sat, 7 Dec 2024 17:29:33 +0000 Subject: [PATCH] Fix some improvements suggested --- src/commands/effects.ts | 2 +- src/helpers/EffectHelper.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/effects.ts b/src/commands/effects.ts index aa58d3b..bcaa929 100644 --- a/src/commands/effects.ts +++ b/src/commands/effects.ts @@ -33,7 +33,7 @@ export default class Effects extends Command { private async List(interaction: CommandInteraction) { const pageOption = interaction.options.get("page"); - const page = pageOption && Number(pageOption.value) ? Number(pageOption.value) : 1; + const page = !isNaN(Number(pageOption?.value)) ? Number(pageOption?.value) : 1; const result = await EffectHelper.GenerateEffectEmbed(interaction.user.id, page); diff --git a/src/helpers/EffectHelper.ts b/src/helpers/EffectHelper.ts index 11f6ed8..d0d29a0 100644 --- a/src/helpers/EffectHelper.ts +++ b/src/helpers/EffectHelper.ts @@ -80,7 +80,7 @@ export default class EffectHelper { .setCustomId(`effects list ${page - 1}`) .setLabel("Previous") .setStyle(ButtonStyle.Primary) - .setDisabled(page - 1 == 0), + .setDisabled(page == 1), new ButtonBuilder() .setCustomId(`effects list ${page + 1}`) .setLabel("Next")