-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
24 lines (23 loc) · 922 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
const {Client, GatewayIntentBits, Collection, Events} = require('discord.js');
const fs = require("node:fs");
const path = require("node:path");
require("dotenv").config();
const interactionCommands = new Collection()
module.exports.interactionCommands = interactionCommands
require("./interaction/commandsManager");
const client = new Client({
intents: [GatewayIntentBits.Guilds]
})
registerEvents();
function registerEvents(){
const eventFiles = fs.readdirSync(path.join(__dirname, "events"));
for (const eventFile of eventFiles){
const event = require(path.join(__dirname, "events", eventFile));
if (event.once){
client.once(event.name,(...arguments) => {event.run(...arguments)})
}else {
client.on(event.name,(...arguments) => {event.run(...arguments,client)})
}
}
}
client.login(process.env.TOKEN).then(r => console.log("Connection établie"));