-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
68 lines (32 loc) · 1.32 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
const Discord = require("discord.js");
const Client = new Discord.Client();
const Info = require("./Info.json");
const fs = require("fs");
Client.commands = new Discord.Collection();
fs.readdir("./CMD", (err, files) => {
if(err) console.log(`Error in CMD ${err}`);
let jsfile = files.filter(f => f.split(".").pop() === "js")
if(jsfile.length <= 0){
console.log("Couldn't find CMD add something to the CMD");
return
}
jsfile.forEach((f, i) => {
let props = require(`./CMD/${f}`);
console.log(`${f} || Command Ready!`);
Client.commands.set(props.help.name, props);
});
});
Client.on("ready", () => {
let today = new Date();
console.log("[Log] "+Info.Name+" by "+Info.Creator);
console.log("[Log] Launched " + today)
});
Client.on("message", async message => {
if (message.content.indexOf(Info.Prefix) !== 0) return;
let messageArray = message.content.split(" ");
let cmd = messageArray[0].toLowerCase();
let args = message.content.substring(Info.Prefix.length).split(" ");
let commandfile = Client.commands.get(cmd.slice(Info.Prefix.length));
if(commandfile) commandfile.run(Client,message,args);
})
Client.login(Info.Token);