This repository has been archived by the owner on Jul 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
kokoro.js
97 lines (89 loc) · 2.47 KB
/
kokoro.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
const Bot = require("./mods/tasker");
const conf = require("./config.json");
const fs = require("fs");
const Kokoro = new Bot({
tasks: "tasks/**",
token: conf.token,
prefix: conf.prefix,
ownerID: conf.owners,
});
Kokoro.on("ready", () => {
Kokoro.user.setActivity(
`${Kokoro.prefix}help`,
{type: "LISTENING"}
);
if (!Kokoro.settings.get("guild")) {
Kokoro.settings.set("guild", {});
}
if (!Kokoro.settings.get("user")) {
Kokoro.settings.set("user", {});
}
if (!Kokoro.settings.get("cache")) {
Kokoro.settings.set("cache", settings.cache);
}
Array.from(Kokoro.guilds.keys()).forEach(id => {
if (!Kokoro.settings.get("guild")[id]) {
var guild = Kokoro.settings.get("guild");
guild[id] = settings.guild;
Kokoro.settings.set("guild", guild);
}
});
Array.from(Kokoro.users.keys()).forEach(id => {
if (!Kokoro.settings.get("user")[id]) {
Kokoro.settings.get("user")[id] = settings.user;
}
});
});
Kokoro.on("guildCreate", guild => {
Kokoro.settings.get("guild")[guild.id] = settings.guild;
});
fs.readdirSync("./events/").forEach(file => {
var event = require("./events/" + file);
event.name = file.split(".")[0];
event.event = file.split(".")[0];
Kokoro.loadEvent(event);
});
fs.readdirSync("./jobs/").forEach(file => {
var job = require("./jobs/" + file);
job.name = file.split(".").shift();
Kokoro.loadJob(job);
});
Kokoro.start();
var settings = {
cache: {
events: {
en: null,
jp: null,
tw: null,
kr: null
}
},
guild: {
birthday: null,
eventChannelEN: null,
eventChannelJP: null,
eventChannelTW: null,
eventChannelKR: null,
eventMsgEN: "[BanG Dream! EN] **New Event!**",
eventMsgJP: "[BanG Dream! JP] **New Event!**",
eventMsgTW: "[BanG Dream! TW] **New Event!**",
eventMsgKR: "[BanG Dream! KR] **New Event!**",
birthdayMsg: "[BanG Dream!] **Happy Birthday!**"
},
user: {
subscriptions: {
eventEN: false,
eventJP: false,
eventTW: false,
eventKR: false,
birthday: false
},
accounts: {
bandori_EN: null,
bandori_JP: null,
bandori_TW: null,
bandori_KR: null
}
}
}
Kokoro.defaultSettings = settings;