-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
35 lines (28 loc) · 823 Bytes
/
app.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
var dis = require("discord.js");
var commands = require("./commands");
var profiles = require("./profiles");
var monster = require("./monster");
var jf = require("jsonfile");
var fs = require("fs");
var token = (jf.readFileSync("config.json")).token;
var bot = new dis.Client();
bot.on("ready", function(){
console.log("\nReady to work!");
profiles.initialize(bot);
monster.initialize(bot);
});
bot.on("guildMemberAdd", function(member){
profiles.createProfile(member.user);
profiles.save();
});
bot.on("message", function(msg){
if(msg.auther === bot.user)return;
if(msg.content.startsWith("/")){
var msgL = msg.content.toLowerCase().slice(1);
var words = msgL.split(" ");
var cmd = words[0];
var args = words.slice(1);
commands.onCommand(msg, cmd, args);
}
});
bot.login(token);