forked from TheOdinProject/odin-bot-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
36 lines (31 loc) · 1.05 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
const { Client, GatewayIntentBits, Partials } = require('discord.js');
const { globSync } = require('glob');
const path = require('path');
const { token } = require('./config');
const events = require('./events');
require('./bin/deploy-commands');
globSync('./botCommands/**/*.js', {
ignore: 'botCommands/**/*.test.js',
}).forEach((file) => {
require(`${path.resolve(file)}`); // eslint-disable-line global-require, import/no-dynamic-require
});
const client = new Client({
intents: [
GatewayIntentBits.MessageContent,
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.DirectMessageReactions,
], // eslint-disable-line max-len
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
});
// eslint-disable-next-line no-restricted-syntax
for (const [name, event] of events) {
if (event.once) {
client.once(name, event.execute(client));
} else {
client.on(name, event.execute(client));
}
}
client.login(token);