GUH
This commit is contained in:
parent
3024a3f489
commit
70e05a7de2
|
@ -108,7 +108,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "slots",
|
"name": "slots",
|
||||||
"description": "Play the slots",
|
"description": "Play the slots (Costs 3 coins)",
|
||||||
"type": 1
|
"type": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
63
index.js
63
index.js
|
@ -270,32 +270,32 @@ client.on("interactionCreate", async interaction => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "modifyeveryone": // Modify the coins of everyone in the database
|
case "modifyeveryone": // Modify the coins of everyone in the database
|
||||||
// check if the user is in the config.discord.givers array
|
// check if the user is in the config.discord.givers array
|
||||||
if (!config.discord.givers.includes(interaction.user.id)) return interaction.reply({
|
if (!config.discord.givers.includes(interaction.user.id)) return interaction.reply({
|
||||||
content: "You do not have permission to use this command.",
|
content: "You do not have permission to use this command.",
|
||||||
|
ephemeral: true
|
||||||
|
});
|
||||||
|
// Run a lil db query to update every user's coins, dont bother sending a message to the user, it would take too long
|
||||||
|
await db.all(`SELECT * FROM points`, async (err, rows) => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
if (!rows) return interaction.reply({
|
||||||
|
content: "It's quiet here...",
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
// Run a lil db query to update every user's coins, dont bother sending a message to the user, it would take too long
|
if (rows) {
|
||||||
await db.all(`SELECT * FROM points`, async (err, rows) => {
|
for (let i = 0; i < rows.length; i++) {
|
||||||
if (err) {
|
checkAndModifyPoints(await client.users.fetch(rows[i].id), interaction.options.getNumber("amount"));
|
||||||
console.error(err);
|
|
||||||
}
|
}
|
||||||
if (!rows) return interaction.reply({
|
interaction.reply({
|
||||||
content: "It's quiet here...",
|
content: `Gave everyone ${interaction.options.getNumber("amount")} coins.`,
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
if (rows) {
|
}
|
||||||
for (let i = 0; i < rows.length; i++) {
|
});
|
||||||
checkAndModifyPoints(await client.users.fetch(rows[i].id), interaction.options.getNumber("amount"));
|
break;
|
||||||
}
|
|
||||||
interaction.reply({
|
|
||||||
content: `Gave everyone ${interaction.options.getNumber("amount")} coins.`,
|
|
||||||
ephemeral: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "transfer": // Allows a user to transfer a positive amount of coins to another user at a 50% tax, rounded down, if the user sends 2 coins, the other user will receive 1, the other gets sent to the abyss.
|
case "transfer": // Allows a user to transfer a positive amount of coins to another user at a 50% tax, rounded down, if the user sends 2 coins, the other user will receive 1, the other gets sent to the abyss.
|
||||||
// check if the arguments are there
|
// check if the arguments are there
|
||||||
|
@ -511,13 +511,16 @@ client.on("interactionCreate", async interaction => {
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
// Check if they won or lost, if they won, give them the prize
|
// Check if they won or lost, if they won, give them the prize
|
||||||
await checkAndModifyPoints(interaction.user.id, slotResults.coinDifference);
|
difference = await new Number(slotResults.coinDifference);
|
||||||
if (slotResults.coinDifference > 0) {
|
await checkAndModifyPoints(interaction.user, difference);
|
||||||
await checkAndModifyPoints(interaction.user.id, 3); // Give them the 3 coins back
|
newBal = await checkPoints(interaction.user);
|
||||||
|
if (difference > 0) {
|
||||||
|
await checkAndModifyPoints(interaction.user, 3);
|
||||||
|
if (slotResults.jackpot) {
|
||||||
return await interaction.editReply({
|
return await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
title: "Jackpot!",
|
title: "Jackpot!",
|
||||||
description: `:rotating_light: ${slotResults.spinResult[0]}${slotResults.spinResult[1]}${slotResults.spinResult[2]} :rotating_light:\nYou won the jackpot! (${slotResults.coinDifference} coins)`,
|
description: `:rotating_light: ${slotResults.spinResult[0]}${slotResults.spinResult[1]}${slotResults.spinResult[2]} :rotating_light:\nYou won the jackpot! (${difference} coins)`,
|
||||||
color: 0xffffff
|
color: 0xffffff
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
@ -525,7 +528,7 @@ client.on("interactionCreate", async interaction => {
|
||||||
return await interaction.editReply({
|
return await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
title: "Triple!",
|
title: "Triple!",
|
||||||
description: `${slotResults.spinResult[0]}${slotResults.spinResult[1]}${slotResults.spinResult[2]}\nYou won ${slotResults.coinDifference} coins!`,
|
description: `${slotResults.spinResult[0]}${slotResults.spinResult[1]}${slotResults.spinResult[2]}\nYou won ${difference} coins!`,
|
||||||
color: 0x00ffff
|
color: 0x00ffff
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
@ -533,7 +536,7 @@ client.on("interactionCreate", async interaction => {
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
title: "Slots",
|
title: "Slots",
|
||||||
description: `${slotResults.spinResult[0]}${slotResults.spinResult[1]}${slotResults.spinResult[2]}\nYou won ${slotResults.coinDifference} coins!`,
|
description: `${slotResults.spinResult[0]}${slotResults.spinResult[1]}${slotResults.spinResult[2]}\nYou won ${difference} coins!`,
|
||||||
color: 0x00ff00
|
color: 0x00ff00
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
@ -545,7 +548,7 @@ client.on("interactionCreate", async interaction => {
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
title: "Bombs!",
|
title: "Bombs!",
|
||||||
description: `${slotResults.spinResult[0]}${slotResults.spinResult[1]}${slotResults.spinResult[2]}\nYou lost ${Math.abs(slotResults.coinDifference)} coins!\nYou now have ${await checkPoints(interaction.user)} coins.`,
|
description: `${slotResults.spinResult[0]}${slotResults.spinResult[1]}${slotResults.spinResult[2]}\nYou lost ${Math.abs(difference)} coins!`,
|
||||||
color: 0xff0000
|
color: 0xff0000
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
@ -553,7 +556,7 @@ client.on("interactionCreate", async interaction => {
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
title: "Slots",
|
title: "Slots",
|
||||||
description: `${slotResults.spinResult[0]}${slotResults.spinResult[1]}${slotResults.spinResult[2]}\nYou lost ${Math.abs(slotResults.coinDifference)} coins!\nYou now have ${await checkPoints(interaction.user)} coins.`,
|
description: `${slotResults.spinResult[0]}${slotResults.spinResult[1]}${slotResults.spinResult[2]}\nYou lost ${Math.abs(difference)} coins!`,
|
||||||
color: 0xff0000
|
color: 0xff0000
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
@ -755,7 +758,7 @@ function playSlotMachine() {
|
||||||
return counts;
|
return counts;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
let coinDifference = -3; // Default coin difference for no match
|
let coinDifference = 0; // Default coin difference for no match, they just lose the play cost
|
||||||
let triple = false;
|
let triple = false;
|
||||||
let jackpot = false;
|
let jackpot = false;
|
||||||
let bombs = false;
|
let bombs = false;
|
||||||
|
|
Loading…
Reference in a new issue