-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
32 lines (28 loc) · 888 Bytes
/
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
// Importation des librairies
const config = require('./src/config.json');
const { GatewayIntentBits, Partials, Client } = require('discord.js');
const fs = require("fs-extra");
const client = new Client({
intents: [
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessageReactions
], partials: [
Partials.Message,
Partials.GuildMember,
Partials.Reaction,
Partials.User
]
});
// Handler Events
const eventFiles = fs.readdirSync(__dirname + '/src/events').filter(file => file.endsWith('.js'));
eventFiles.forEach(fEvt => {
const eventName = fEvt.split('.')[0];
const event = require(`./src/events/${fEvt}`);
client.on(eventName, event.bind(null, client));
delete require.cache[require.resolve(`./src/events/${fEvt}`)];
});
// Login
client.login(config.token);