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.
This commit is contained in:
parent
01fbdf6985
commit
0b51b8dc09
6
index.js
6
index.js
|
@ -627,7 +627,6 @@ client.on("interactionCreate", async interaction => {
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setCooldown(interaction.user, "coinflip", config.games.coinflip.cooldown * 60 * 1000)
|
|
||||||
|
|
||||||
bet = parseInt(interaction.options.get("amount").value);
|
bet = parseInt(interaction.options.get("amount").value);
|
||||||
if (bet < 1 || bet > 10) return interaction.reply({
|
if (bet < 1 || bet > 10) return interaction.reply({
|
||||||
|
@ -651,6 +650,7 @@ client.on("interactionCreate", async interaction => {
|
||||||
// if they lose inverse the bet
|
// if they lose inverse the bet
|
||||||
if (!outcome) bet = -bet;
|
if (!outcome) bet = -bet;
|
||||||
await checkAndModifyPoints(interaction.user, bet);
|
await checkAndModifyPoints(interaction.user, bet);
|
||||||
|
setCooldown(interaction.user, "coinflip", config.games.coinflip.cooldown * 60 * 1000)
|
||||||
if (coin == "heads") return interaction.reply({
|
if (coin == "heads") return interaction.reply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
title: "Coinflip",
|
title: "Coinflip",
|
||||||
|
@ -689,7 +689,7 @@ client.on("interactionCreate", async interaction => {
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setCooldown(interaction.user, "snakeeyes", config.games.snakeeyes.cooldown * 60 * 1000)
|
|
||||||
|
|
||||||
bet = parseInt(interaction.options.get("amount").value);
|
bet = parseInt(interaction.options.get("amount").value);
|
||||||
if (bet < 1 || bet > 10) return interaction.reply({
|
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.",
|
content: "You do not have enough coins to play snakeeyes.",
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
|
setCooldown(interaction.user, "snakeeyes", config.games.snakeeyes.cooldown * 60 * 1000)
|
||||||
// Roll the dice
|
// Roll the dice
|
||||||
dice = Math.floor(Math.random() * 6) + 1;
|
dice = Math.floor(Math.random() * 6) + 1;
|
||||||
before = points;
|
before = points;
|
||||||
|
|
Loading…
Reference in a new issue