forked from applejuiceyy/LightLoop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
57 lines (44 loc) · 1.57 KB
/
Copy pathindex.js
File metadata and controls
57 lines (44 loc) · 1.57 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
55
56
57
require('dotenv').config();
require('./src/util/dataStorage').load();
const fs = require('fs');
const { Client, Collection, Intents } = require('discord.js');
const client = new Client({
intents: [
Intents.FLAGS.DIRECT_MESSAGES,
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
],
partials: [
'CHANNEL',
],
});
// Dialogs setup
client.dialogs = new Collection();
require('./src/dialogs/registerDialogEvents').register(client);
// Commands setup
client.cooldowns = new Collection();
client.slashCommands = new Collection();
const slashCommandFiles = fs.readdirSync('./src/commands/slash').filter(file => file.endsWith('.js'));
for (const file of slashCommandFiles) {
const command = require(`./src/commands/slash/${file}`);
client.slashCommands.set(command.data.name, command);
}
client.prefixCommands = new Collection();
const prefixCommandFiles = fs.readdirSync('./src/commands/prefix').filter(file => file.endsWith('.js'));
for (const file of prefixCommandFiles) {
const command = require(`./src/commands/prefix/${file}`);
client.prefixCommands.set(command.name, command);
}
// Events setup
const eventFiles = fs.readdirSync('./src/events').filter(file => file.endsWith('.js'));
for (const file of eventFiles) {
const event = require(`./src/events/${file}`);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
}
else {
client.on(event.name, (...args) => event.execute(...args));
}
}
client.login(process.env.TOKEN);