This repository has been archived by the owner on May 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.js
44 lines (40 loc) · 1.19 KB
/
bot.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
require("dotenv").config();
const Commando = require("discord.js-commando");
const path = require("path");
const fs = require("fs").promises;
const sqlite = require("sqlite");
const client = new Commando.CommandoClient({
commandPrefix: process.env.PREFIX,
owner: process.env.OWNER,
invite: process.env.INVITE,
unknownCommandResponse: false
});
client.registry
.registerDefaultTypes()
.registerGroups([
["fun", "Fun"],
["moderation", "Moderation"],
["roles", "Roles"],
["voice", "Voice"]
])
.registerDefaultGroups()
.registerDefaultCommands()
.registerCommandsIn(path.join(__dirname, "commands"));
client
.setProvider(
sqlite
.open(path.join(__dirname, "database", "main.db"))
.then(db => new Commando.SQLiteProvider(db))
)
.catch(console.error);
fs.readdir(path.join(__dirname, "events"))
.then(files => files.filter(file => file.endsWith(".js")))
.then(files =>
files.forEach(file => {
let eventName = file.substr(0, file.indexOf(".js"));
let event = require(path.join(__dirname, "events", eventName));
client.on(eventName, event.bind(null, client));
})
)
.catch(err => console.log(err));
client.login(process.env.TOKEN);