forked from ZariZaryab/SlotsMachine-DiscordJS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
95 lines (75 loc) · 2.35 KB
/
Copy pathmain.js
File metadata and controls
95 lines (75 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
const Discord = require('discord.js');
const bot = new Discord.Client()
const config = require("./config.json");
/* BOT READY */
bot.on("ready", async () => {
console.log(`Your bot is dealing slots and running!`);
bot.user.setActivity("Slots by Gazarino#9899", {type: "PLAYING"});
});
/* ONE COMMAND BY DEFAULT */
bot.on("message", async message => {
const msg = message;
/* AVOID BAD PEEPS */
if(message.author.bot) return;
if(message.channel.type === "dm") return;
if(message.content === '+slot') {
/* SPIN ANIMATION (use own or check mine)*/
const slotemoji = ":money_mouth:";
const customemoji = "<a:"+ config.emojiname +":"+ config.emojiid + ">";
if(config.haveEmoji === '1') slotemoji = customemoji;
/* ITEMS (SLOTS) */
let items = ['💵','💍','💯'];
/* RANDOM */
let $ = items[Math.floor(items.length * Math.random())];
let $$ = items[Math.floor(items.length * Math.random())];
let $$$ = items[Math.floor(items.length * Math.random())];
/* EMBEDS */
const play = new Discord.MessageEmbed()
.setTitle("Slot Machine")
.setDescription("• "+slotemoji+" "+slotemoji+" "+slotemoji+" •")
.setColor('RANDOM')
.setFooter("are you lucky bitch?")
const $1 = new Discord.MessageEmbed()
.setTitle("Slot Machine")
.setDescription("• "+$+" "+slotemoji+" "+slotemoji+" •")
.setColor('RANDOM')
.setFooter("are you lucky bitch?")
const $2 = new Discord.MessageEmbed()
.setTitle("Slot Machine")
.setDescription("• "+$+" "+$$+" "+slotemoji+" •")
.setColor('RANDOM')
.setFooter("are you lucky bitch?")
const $3 = new Discord.MessageEmbed()
.setTitle("Slot Machine")
.setDescription("• "+$+" "+$$+" "+$$$+" •")
.setColor('RANDOM')
.setFooter("are you lucky bitch?")
/* SPIN THE SLOTS */
spinner = await message.channel.send(play)
setTimeout(() => {
spinner.edit($1);
}, 600);
setTimeout(() => {
spinner.edit($2);
}, 1200);
setTimeout(() => {
spinner.edit($3);
}, 1800);
/* DEDUCT RESULTS */
// You can add/remove user balance in respective result (if using some currency system)
if($$ !== $ && $$ !== $$$) {
setTimeout(() => {
msg.channel.send("You LOST!`")
}, 2000);
})
} else if($ === $$ && $ === $$$) {
setTimeout(() => {
msg.channel.send("You WON!`")
}, 2000);
})
} else {
msg.channel.send("2 slots are equal...")
}
}
})
bot.login(config.token)