This repository has been archived by the owner on Aug 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
index.js
78 lines (60 loc) · 2.04 KB
/
index.js
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
const {
Client
} = require("discord.js");
const {
prefix,
region,
token
} = require("./config");
const lang = require("./lang");
const {
startAki,
endGame,
checkTime,
oldCollects,
text
} = require("./functions")
const client = new Client();
client.on('ready', () => {
console.log(`I\'m Online As ${client.user.tag}...!`);
if (region !== 'ar' && region !== 'en') text = lang['ar'];
setInterval(checkTime, 180000);
});
client.on('error', console.error);
const coolDownList = new Set();
client.on("message", async msg => {
if (msg.content.indexOf(prefix) !== 0) return;
const args = msg.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
if (command == 'aki') {
if (args[0] == 'start') {
if (coolDownList.has(msg.author.id)) return;
else {
coolDownList.add(msg.author.id);
if (oldCollects[msg.author.id]) {
msg.reply(text.openGame);
return coolDownList.delete(msg.author.id);
}
if (!msg.channel.memberPermissions(msg.guild.me).has(['ADD_REACTIONS', 'SEND_MESSAGES'])) {
coolDownList.delete(msg.author.id);
try {
msg.channel.send(text.noPerm);
msg.author.send(text.noPerm)
} catch (err) {
//lol
};
return;
}
var akiMsg = await msg.channel.send(text.wait)
startAki(msg, akiMsg);
setTimeout(() => {
coolDownList.delete(msg.author.id);
}, 5000);
}
} else if (args[0] == 'stop') {
if (!oldCollects[msg.author.id]) return msg.reply(text.noGame);
endGame(msg.author.id, oldCollects[msg.author.id].akiMsg)
}
}
});
client.login(token);