-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
38 lines (27 loc) · 889 Bytes
/
app.js
File metadata and controls
38 lines (27 loc) · 889 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
35
36
37
38
require("dotenv").config();
const { Client } = require("discord.js"),
fs = require("fs"),
Enmap = require("enmap"),
client = new Client();
client.commands = new Enmap();
fs.readdir("./events/", (err, files) => {
if (err) return console.error;
files.forEach((file) => {
if (!file.endsWith(".js")) return;
let evt = require(`./events/${file}`);
let evtName = file.split(".")[0];
console.log(`[LOG: LOADED EVT] ${evtName}`);
client.on(evtName, evt.bind(null, client));
});
});
fs.readdir("./commands/", async (err, files) => {
if (err) return console.error;
files.forEach((file) => {
if (!file.endsWith(".js")) return;
let props = require(`./commands/${file}`);
let cmdName = file.split(".")[0];
console.log(`[LOG: LOADED CMD] ${cmdName}`);
client.commands.set(cmdName, props);
});
});
client.login(process.env.BOT_TOKEN);