-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
46 lines (36 loc) · 1.57 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
const config = require("./config.js");
const { CommandoClient } = require("discord.js-commando");
const { Intents } = require("discord.js");
const structureHandler = require("./src/handlers/structureHandler.js");
const serviceHandler = require("./src/handlers/serviceHandler.js");
const commandHandler = require("./src/handlers/commandHandler.js");
const dataHandler = require("./src/handlers/dataHandler.js");
const contextGenerator = require("./src/contextGenerator.js");
const logger = require("./src/utilities/logger.js");
structureHandler.initialize();
const client = new CommandoClient({
owner: config.owners,
commandPrefix: config.defaultPrefix,
nonCommandEditable: false,
commandEditableDuration: 0,
partials: ["CHANNEL", "MESSAGE", "REACTION"],
intents: [Intents.ALL]
});
client.once("ready", async () => {
logger.info(`Logged in as ${client.user.tag} (${client.user.id})`);
contextGenerator.initialize(client)
.then(() => logger.info("Context generator initialized."))
.catch(logger.error);
serviceHandler.initialize(client)
.then(services => logger.info(`${services.length} services initialized.`))
.catch(logger.error);
commandHandler.initialize(client)
.then(commands => logger.info(`${commands.length} commands initialized.`))
.catch(logger.error);
dataHandler.initialize(client)
.then(guildStorages => logger.info(`${guildStorages.length} guilds initialized.`))
.catch(logger.error);
});
client.on("ready", () => client.user.setActivity(`Type ${client.commandPrefix}help for help!`));
client.on("error", err => logger.error(err));
client.login(config.token);