mirror of
https://github.com/arthur-pbty/bot-discord-coins.git
synced 2026-06-15 00:02:43 +02:00
Update : possiblilter de mettre all
This commit is contained in:
+24
-31
@@ -10,6 +10,22 @@ module.exports = {
|
||||
permission: 0,
|
||||
|
||||
async execute(message, args, client) {
|
||||
let mise = 0
|
||||
const pocket = await new Promise((resolve, reject) => {
|
||||
db.get(`SELECT pocket FROM users WHERE userId = ? AND guildId = ?`, [message.author.id, message.guild.id], (err, row) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve(row.pocket);
|
||||
}
|
||||
});
|
||||
});
|
||||
if (args[0] == 'all') {
|
||||
mise = pocket
|
||||
} else {
|
||||
mise = args[0]
|
||||
}
|
||||
|
||||
if (args.length !== 2) {
|
||||
embedColor(message.author.id, message.guild.id).then(color => {
|
||||
const embed = new EmbedBuilder()
|
||||
@@ -22,7 +38,7 @@ module.exports = {
|
||||
message.reply({ embeds: [embed], allowedMentions: { repliedUser: false } })
|
||||
});
|
||||
return
|
||||
} else if (isNaN(args[0])) {
|
||||
} else if (isNaN(args[0]) && !args[0] == "all") {
|
||||
embedColor(message.author.id, message.guild.id).then(color => {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('🎲 Roulette')
|
||||
@@ -34,7 +50,7 @@ module.exports = {
|
||||
message.reply({ embeds: [embed], allowedMentions: { repliedUser: false } })
|
||||
});
|
||||
return
|
||||
} else if (args[0] < 25) {
|
||||
} else if (mise < 25) {
|
||||
embedColor(message.author.id, message.guild.id).then(color => {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('🎲 Roulette')
|
||||
@@ -60,34 +76,11 @@ module.exports = {
|
||||
return
|
||||
}
|
||||
|
||||
const pocket = await new Promise((resolve, reject) => {
|
||||
db.get(`SELECT pocket FROM users WHERE userId = ? AND guildId = ?`, [message.author.id, message.guild.id], (err, row) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
if (row.pocket < args[0]) {
|
||||
embedColor(message.author.id, message.guild.id).then(color => {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('🎲 Roulette')
|
||||
.setDescription(`Vous n'avez pas assez d'argent sur vous pour miser cette somme.`)
|
||||
.setColor(color)
|
||||
.setTimestamp()
|
||||
.setFooter({ text: `Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() })
|
||||
|
||||
return message.reply({ embeds: [embed], allowedMentions: { repliedUser: false } })
|
||||
});
|
||||
} else {
|
||||
resolve(row.pocket);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
embedColor(message.author.id, message.guild.id).then(color => {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('🎲 Roulette')
|
||||
.setImage('https://images-ext-1.discordapp.net/external/Zz7GmmFoFdFRB7GCjiJGaDHDjJi8noOLY8zasCmUOGQ/https/media.giphy.com/media/26uflBhaGt5lQsaCA/giphy.gif')
|
||||
.setDescription(`Vous avez misé \`${args[0]}\` sur \`${args[1]}\`. La bille tourne...\nRésultat dans 5 secondes...`)
|
||||
.setDescription(`Vous avez misé \`${mise}\` sur \`${args[1]}\`. La bille tourne...\nRésultat dans 5 secondes...`)
|
||||
.setColor(color)
|
||||
.setTimestamp()
|
||||
.setFooter({ text: `Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() })
|
||||
@@ -109,11 +102,11 @@ module.exports = {
|
||||
|
||||
let gain = 0;
|
||||
if (((args[1] === 'rouge' || args[1] === 'red') && colorR === 'rouge') || ((args[1] === 'noir' || args[1] === 'black') && colorR === 'noir')) {
|
||||
gain = args[0] * 2;
|
||||
gain = mise * 2;
|
||||
} else if ((args[1] === 'vert' || args[1] === 'green') && colorR === 'vert') {
|
||||
gain = args[0] * 36;
|
||||
gain = mise * 36;
|
||||
} else {
|
||||
gain = 0 - args[0];
|
||||
gain = 0 - mise;
|
||||
}
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
@@ -130,7 +123,7 @@ module.exports = {
|
||||
embedColor(message.author.id, message.guild.id).then(color => {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('🎲 Roulette')
|
||||
.setDescription(`Vous avez misé \`${args[0]}\` sur \`${args[1]}\` et la bille est tombée sur \`${colorR}\`. Vous avez gagné \`${gain}\` !`)
|
||||
.setDescription(`Vous avez misé \`${mise}\` sur \`${args[1]}\` et la bille est tombée sur \`${colorR}\`. Vous avez gagné \`${gain}\` !`)
|
||||
.setColor(color)
|
||||
.setTimestamp()
|
||||
.setFooter({ text: `Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() })
|
||||
@@ -142,7 +135,7 @@ module.exports = {
|
||||
embedColor(message.author.id, message.guild.id).then(color => {
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('🎲 Roulette')
|
||||
.setDescription(`Vous avez misé \`${args[0]}\` sur \`${args[1]}\` et la bille est tombée sur \`${colorR}\`. Vous avez perdu \`${0 - gain}\` !`)
|
||||
.setDescription(`Vous avez misé \`${mise}\` sur \`${args[1]}\` et la bille est tombée sur \`${colorR}\`. Vous avez perdu \`${0 - gain}\` !`)
|
||||
.setColor(color)
|
||||
.setTimestamp()
|
||||
.setFooter({ text: `Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() })
|
||||
|
||||
Reference in New Issue
Block a user