-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
54 lines (44 loc) · 1.42 KB
/
index.js
File metadata and controls
54 lines (44 loc) · 1.42 KB
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
require("dotenv-flow").config({ silent: true });
const { CommandoClient } = require("discord.js-commando");
const path = require("path");
const { Collection } = require("discord.js");
const Database = require("./database/Database.js");
// ================= EXPRESS SERVER FOR REPL ===================
const express = require("express");
const app = express();
const port = 3000;
app.get("/", (req, res) =>
res.send("This is the repl webserver keeping my discord bot alive!")
);
app.listen(port, () =>
console.log(`Dummy webserver listening at http://localhost:${port}`)
);
// ================= START BOT CODE ===================
const client = new CommandoClient({
commandPrefix: "h!",
owner: process.env.OWNERID,
});
client.hackathons = new Collection();
client.database = new Database(client);
client.database.read();
client.registry
.registerDefaultTypes()
.registerTypes([require("./types/date.js")])
.registerGroups([
["hackathon", "Hackathon Command Group"],
["team", "Team Command Group"],
["tools", "Tool Command Group"],
])
.registerDefaultGroups({
eval: false,
})
.registerDefaultCommands({
unknownCommand: false,
})
.registerCommandsIn(path.join(__dirname, "commands"));
client.once("ready", () => {
console.log(`Logged in as ${client.user.tag}! (${client.user.id})`);
client.user.setActivity("with h!help");
});
client.on("error", console.error);
client.login(process.env.TOKEN);