From 0b51b8dc09cb5b304a9756ec24ee4c3756293a2c Mon Sep 17 00:00:00 2001 From: Mmadrid509 <63370132+mmadrid509@users.noreply.github.com> Date: Fri, 10 Nov 2023 18:32:25 -0800 Subject: [PATCH] Possibly fix the cooldowns of coinflip and snakeeyes cmd The cooldowns were being applied before checks, added it after so that it applies when the command goes fully through. --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 57404e0..16ef896 100644 --- a/index.js +++ b/index.js @@ -627,8 +627,7 @@ client.on("interactionCreate", async interaction => { ephemeral: true }); } - setCooldown(interaction.user, "coinflip", config.games.coinflip.cooldown * 60 * 1000) - + bet = parseInt(interaction.options.get("amount").value); if (bet < 1 || bet > 10) return interaction.reply({ content: "You can only bet between 1 and 10 coins.", @@ -651,6 +650,7 @@ client.on("interactionCreate", async interaction => { // if they lose inverse the bet if (!outcome) bet = -bet; await checkAndModifyPoints(interaction.user, bet); + setCooldown(interaction.user, "coinflip", config.games.coinflip.cooldown * 60 * 1000) if (coin == "heads") return interaction.reply({ embeds: [{ title: "Coinflip", @@ -689,7 +689,7 @@ client.on("interactionCreate", async interaction => { ephemeral: true }); } - setCooldown(interaction.user, "snakeeyes", config.games.snakeeyes.cooldown * 60 * 1000) + bet = parseInt(interaction.options.get("amount").value); if (bet < 1 || bet > 10) return interaction.reply({ @@ -703,7 +703,7 @@ client.on("interactionCreate", async interaction => { content: "You do not have enough coins to play snakeeyes.", ephemeral: true }); - + setCooldown(interaction.user, "snakeeyes", config.games.snakeeyes.cooldown * 60 * 1000) // Roll the dice dice = Math.floor(Math.random() * 6) + 1; before = points;