Skip to content
Snippets Groups Projects
Commit 170e4df3 authored by Reviath's avatar Reviath
Browse files

Update commands/slots.js

parent ce846742
Branches
No related tags found
No related merge requests found
const db = require('quick.db');
const Discord = require('discord.js');
exports.run = async(client, message, args) => {
......@@ -5,8 +6,23 @@ let slots = ["<a:blue_fire:801857759989465170>", "<a:orange_fire:801858052163895
let result1 = Math.floor((Math.random() * slots.length));
let result2 = Math.floor((Math.random() * slots.length));
let result3 = Math.floor((Math.random() * slots.length));
let name = message.author.username;
let icon = message.author.avatarURL();
let number = args[0];
let bal = await db.get(`Balance_${message.author.id}`);
if (number > bal || number <= 0|| !bal) return message.channel.send(`Your balance is under the value you entered.`)
let cfNumber;
if (!number) return message.channel.send('Please specify an amout to use.');
if (number > 50000 || number == "all") {
if (50000 > bal){
cfNumber = bal;
}else{
cfNumber=50000;
}
}
else{
cfNumber = number;
};
if (slots[result1] === slots[result2] && slots[result1] === slots[result3]) {
let embed = new Discord.MessageEmbed()
......@@ -14,15 +30,14 @@ let slots = ["<a:blue_fire:801857759989465170>", "<a:orange_fire:801858052163895
.setTitle(':slot_machine: Slots :slot_machine:')
.addField('Result:', slots[result1] + slots[result2] + slots[result3], true)
.setColor(0xF4E842)
message.channel.send(embed);
message.channel.send(embed).then(db.add(`${message.author.id}`, cfNumber));
} else {
let embed2 = new Discord.MessageEmbed()
.setFooter('You lost!', icon)
.setTitle(':slot_machine: Slots :slot_machine:')
.addField('Result:', slots[result1] + slots[result2] + slots[result3], true)
.setColor(0xF4E842)
message.channel.send(embed2);
message.channel.send(embed2).then(db.subtract(`${message.author.id}`, cfNumber));
}
}
module.exports.help = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment