2021-09-17 18:28:39 +02:00
|
|
|
const { MessageEmbed } = require("discord.js");
|
2021-11-18 18:56:42 +01:00
|
|
|
const { bool } = require("cath");
|
2021-09-17 18:28:39 +02:00
|
|
|
module.exports = {
|
2021-11-18 18:56:42 +01:00
|
|
|
name: "bet",
|
2021-09-17 18:28:39 +02:00
|
|
|
usage: "(Number)",
|
|
|
|
timeout: 5000,
|
|
|
|
description: "Win double amount of coins or lose all coins",
|
|
|
|
category: "Economy",
|
|
|
|
options: [
|
|
|
|
{
|
2021-11-18 18:56:42 +01:00
|
|
|
type: 4,
|
2021-09-17 18:28:39 +02:00
|
|
|
name: "cp",
|
|
|
|
description: "The number of CP you want to bet",
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
],
|
2021-11-18 18:56:42 +01:00
|
|
|
run: async (client, interaction, args) => {
|
|
|
|
const max = 100000;
|
|
|
|
let amt = args[0];
|
|
|
|
if (amt > max) amt = max;
|
|
|
|
const winamt = amt * 2;
|
|
|
|
if (args[0] < 100) {
|
|
|
|
interaction.followUp({
|
|
|
|
content: `You need to bet at least 100${client.currency}`,
|
|
|
|
});
|
|
|
|
} else if ((await client.bal(interaction.user.id)) < amt) {
|
|
|
|
interaction.followUp({ content: "You don't have enough balance" });
|
|
|
|
} else if (bool()) {
|
|
|
|
const multi = (await client.multi(interaction)) / 10 + 1;
|
2021-09-17 18:28:39 +02:00
|
|
|
await client.add(interaction.user.id, winamt, interaction);
|
|
|
|
await client.ADDBWin(interaction.user.id);
|
|
|
|
const abc = new MessageEmbed()
|
|
|
|
.setColor("GREEN")
|
|
|
|
.setTimestamp()
|
2021-11-18 18:56:42 +01:00
|
|
|
.setFooter(`Made by ${client.author}`, client.user.displayAvatarURL())
|
2021-09-17 18:28:39 +02:00
|
|
|
.setTitle(`${interaction.user.username} wins a gamble game`)
|
2021-11-18 18:56:42 +01:00
|
|
|
.addFields(
|
|
|
|
{
|
|
|
|
name: "Won",
|
|
|
|
value: `**${Math.round(winamt * multi)}**${client.currency}`,
|
|
|
|
inline: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "New Balance",
|
|
|
|
value: `**${Math.round(
|
|
|
|
(await client.bal(interaction.user.id)) + winamt * multi
|
|
|
|
)}**${client.currency}`,
|
|
|
|
inline: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "Multiplier",
|
|
|
|
value: `x${2 + multi}`,
|
|
|
|
inline: true,
|
|
|
|
}
|
2021-09-17 18:28:39 +02:00
|
|
|
);
|
2021-11-18 18:56:42 +01:00
|
|
|
interaction.followUp({ embeds: [abc] });
|
2021-09-17 18:28:39 +02:00
|
|
|
} else {
|
|
|
|
await client.rmv(interaction.user.id, amt);
|
|
|
|
const cba = new MessageEmbed()
|
|
|
|
.setColor("RED")
|
|
|
|
.setTimestamp()
|
2021-11-18 18:56:42 +01:00
|
|
|
.setFooter(`Made by ${client.author}`, client.user.displayAvatarURL())
|
2021-09-17 18:28:39 +02:00
|
|
|
.setTitle(`${interaction.user.username} loses a gamble game`)
|
2021-11-18 18:56:42 +01:00
|
|
|
.addFields(
|
|
|
|
{
|
|
|
|
name: "Lost",
|
|
|
|
value: `**${amt}**${client.currency}`,
|
|
|
|
inline: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "New Balance",
|
|
|
|
value: `**${
|
|
|
|
parseInt(await client.bal(interaction.user.id)) - amt
|
|
|
|
}**${client.currency}`,
|
|
|
|
inline: true,
|
|
|
|
}
|
2021-09-17 18:28:39 +02:00
|
|
|
);
|
2021-11-18 18:56:42 +01:00
|
|
|
interaction.followUp({ embeds: [cba] });
|
2021-09-17 18:28:39 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|