-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
49 lines (40 loc) · 1.45 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
const Discord = require("discord.js");
const { Intents } = require("discord.js");
const fs = require("fs");
const emojis = require("./assets/emoji.json");
const config = require("./config/config.json");
const utils = require("./utils/utils.js");
const colors = require("./assets/colors.json");
const client = new Discord.Client({
intents: 131071,
partials: [Discord.Partials.Message, Discord.Partials.Channel, Discord.Partials.GuildMember], // Needed to get messages from DM's as well
});
let commandModules = fs.readFileSync("./assets/modules.json", {
encoding: "utf8",
});
commandModules = JSON.parse(commandModules);
client.modules = Object.keys(commandModules);
commandsList = [];
client.interactions = new Discord.Collection();
client.modules.forEach((c) => {
files = fs.readdirSync(`./interactions/${c}/`);
files.forEach((f) => {
if (!f.endsWith(".js")) return;
interaction = require(`./interactions/${c}/${f}`);
data = interaction.data.toJSON();
commandsList.push(data);
client.interactions.set(data.name, interaction);
});
});
// For easy access
client.commandsList = commandsList;
client.bridges = require("./utils/bridge.js");
client.info = require("./assets/version.json");
client.brandColor = 16746496;
client.config = config;
client.utils = utils;
client.colors = colors;
// Deploy slash commands to Discord.
client.utils.deploy.deploy(commandsList);
require("./utils/eventLoader.js")(client);
client.login(process.env.token);