-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
67 lines (61 loc) · 2.03 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
55
56
57
58
59
60
61
62
63
64
65
66
67
//Require the necessary discord.js classes
const CardinalBot = require("./utility/bot.js");
const CardinalLogger = require("./utility/CardinalLogger.js");
const DataHandler = require("./utility/DataHandler.js");
const ServiceHandler = require("./utility/ServiceHandler.js");
const ScheduleHandler = require("./utility/scheduleHandler.js");
const fs = require("node:fs");
const path = require("node:path");
const Discord = require("discord.js");
/* {
Client,
Collection,
Events,
GatewayIntentBits,
REST,
Routes,
} */
const config = require("./config.json");
const CommandHandler = require("./utility/CommandHandler.js");
const util = {};
util.logger = new CardinalLogger(util);
util.logger.log(`Initializing bot...`);
util.path = path;
util.fs = fs;
util.config = config;
util.lib = Discord;
util.bot = new Discord.Client({
intents: [
Discord.GatewayIntentBits.Guilds,
Discord.GatewayIntentBits.GuildEmojisAndStickers,
Discord.GatewayIntentBits.GuildMembers,
Discord.GatewayIntentBits.GuildMessages,
Discord.GatewayIntentBits.GuildMessageTyping,
Discord.GatewayIntentBits.GuildMessageReactions,
Discord.GatewayIntentBits.GuildModeration,
Discord.GatewayIntentBits.MessageContent,
Discord.GatewayIntentBits.GuildVoiceStates
],
});
util.commandHandler = new CommandHandler(util);
util.services = new ServiceHandler(util);
util.dataHandler = new DataHandler(util);
util.schedule = new ScheduleHandler(util);
util.BotClass = new CardinalBot(util);
// const handleTermination = () => {
// util.logger.log('\nBot is shutting down...');
// util.commandHandler.deleteAllCommands();
// util.bot.destroy();
// // process.exit();
// };
// process.on('SIGINT', handleTermination);
// This doesn't work in d.js V14 OR I've implemented it wrong
// util.buildEmbed = function (title, description, fields, thumbnail) {
// let embed = new Discord.EmbedBuilder()
// .setTitle(title)
// //.setColor(colour)
// .setDescription(description)
// .setThumbnail(thumbnail)
// .addFields(fields);
// return embed;
// };