From 0e5489f0d12181dd54c1a2da85d1ab7f7160a723 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Fri, 6 Sep 2024 18:09:23 +0100 Subject: [PATCH] Add default if not supplied --- src/buttonEvents/Sacrifice.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/buttonEvents/Sacrifice.ts b/src/buttonEvents/Sacrifice.ts index 7b5616e..63c3971 100644 --- a/src/buttonEvents/Sacrifice.ts +++ b/src/buttonEvents/Sacrifice.ts @@ -23,7 +23,7 @@ export default class Sacrifice extends ButtonEvent { private async confirm(interaction: ButtonInteraction) { const userId = interaction.customId.split(" ")[2]; const cardNumber = interaction.customId.split(" ")[3]; - const quantity = Number(interaction.customId.split(" ")[4]); + const quantity = Number(interaction.customId.split(" ")[4]) ?? 1; if (userId != interaction.user.id) { await interaction.reply("Only the user who created this sacrifice can confirm it."); @@ -105,7 +105,7 @@ export default class Sacrifice extends ButtonEvent { private async cancel(interaction: ButtonInteraction) { const userId = interaction.customId.split(" ")[2]; const cardNumber = interaction.customId.split(" ")[3]; - const quantity = Number(interaction.customId.split(" ")[4]); + const quantity = Number(interaction.customId.split(" ")[4]) ?? 1; if (userId != interaction.user.id) { await interaction.reply("Only the user who created this sacrifice can cancel it.");