-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.js
35 lines (26 loc) · 1.1 KB
/
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
const fs = require("fs");
const Discord = require("discord.js");
const client = new Discord.Client({partials: ["GUILD_MEMBER"], intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_MEMBERS", "DIRECT_MESSAGES", "GUILD_PRESENCES", "GUILD_MESSAGE_REACTIONS"], fetchAllMembers: true });
if (!fs.existsSync("./config.json")) {
console.log("config.json not found");
process.exit();
}
client.config = require("./config.json");
client.function = require("./include/core.js");
client.function.configcheck(client);
fs.readdir("./events/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
const event = require(`./events/${file}`);
let eventName = file.split(".")[0];
client.on(eventName, event.bind(null, client));
});
});
client.commands = new Discord.Collection();
client.aliases = new Discord.Collection();
["commandHandler"].forEach(x => require(`./helpers/${x}`)(client));
client.categories = fs.readdirSync("./commands/");
["commandHandler"].forEach(handler => {
require(`./helpers/${handler}`)(client);
});
client.login(client.config.token);