-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
54 lines (38 loc) · 1.14 KB
/
index.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
const { Client, Collection } = require("discord.js");
const fs = require("fs");
const client = new Client({
disableEveryone: true
});
require('dotenv').config()
// Commands Collection
client.commands = new Collection();
client.aliases = new Collection();
client.categories = fs.readdirSync("./commands/");
// Loading Commands
["command"].forEach(handler => {
require(`./handlers/${handler}`)(client);
})
// Loading Events
fs.readdir("./events/", (err, files) => {
if (err) return console.error(err);
if(!files) return
files.forEach(file => {
const event = require(`./events/${file}`);
let eventName = file.split(".")[0];
client.on(eventName, event.bind(null, client))
console.log(`Event Loaded: ${eventName}`)
})
})
// Web server to work with monitoring servers
// Such as UptimeRobot
const port = process.env.PORT || 1337;
const express = require("express");
const app = express();
app.get("/", (req, res) => {
res.json("Hello World!");
});
app.get("/", (request, response) => {
response.sendStatus(200);
});
app.listen(process.env.PORT);
client.login(process.env.TOKEN).catch(err => console.log(err))