-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
34 lines (28 loc) · 962 Bytes
/
index.js
File metadata and controls
34 lines (28 loc) · 962 Bytes
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
require("dotenv").config();
const fs = require("fs");
const { Client, Intents, Collection } = require("discord.js");
const bot = new Client(/*{ ws: { intents: Discord.Intents.ALL } }*/
{
intents: [Intents.FLAGS.GUILDS],
// partials: ['CHANNEL', 'MESSAGE']
}
);
bot.commands = new Collection();
//Added useful functions to bot
require("./libraries/functions")(bot);
//Loads each command in "commands" folder
bot.loadCommands();
console.log("Loading events...");
try {
fs.readdirSync("./events/").forEach((file) => {
const event = require(`./events/${file}`);
const eventName = file.substr(0, file.indexOf("."));
bot.on(eventName, event.bind(null, bot));
console.log(`Loaded event ${eventName} (${file})`);
});
} catch (err) {
console.log(`Error while loading events. ${err}`);
console.log(err.stack);
}
require("./libraries/website")(bot); //create website
bot.login(process.env.TOKEN);