-
Notifications
You must be signed in to change notification settings - Fork 26
/
app.js
38 lines (32 loc) · 1013 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
36
37
38
const { Collection } = require("discord.js");
const { readdirSync } = require("fs");
const { TOKEN } = require("./config");
const Nana = require("./lib/NanaClient");
// require("./server");
const client = new Nana({
cacheGuilds: true,
cacheChannels: true,
fetchAllMembers: true,
disableEvents: ["GUILD_SYNC", "PRESENCE_UPDATE", "TYPING_START"]
});
// events
for (const event of readdirSync("./events")) {
client.on(event.split(".")[0], (...args) =>
require(`./events/${event}`)(client, ...args)
);
}
// modules
client.commands = new Collection();
client.aliases = new Collection();
for (const command of readdirSync("./commands").filter(x =>
x.endsWith(".js")
)) {
let cmd = require(`./commands/${command}`);
client.commands.set(cmd.help.name.toLowerCase(), cmd);
// get aliases command
for (const alias of cmd.conf.aliases) {
client.aliases.set(alias.toLowerCase(), cmd.help.name.toLowerCase());
}
}
client.login(TOKEN);
module.exports = Nana;