-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
39 lines (30 loc) · 1.1 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
console.clear();
// Import Modules
const Discord = require('discord.js');
const config = require('./config.json');
const path = require('path')
const fs = require('fs');
// Create Discord Client
const client = new Discord.Client({
intents: [
Discord.GatewayIntentBits.Guilds,
Discord.GatewayIntentBits.GuildMembers,
Discord.GatewayIntentBits.GuildMessages,
Discord.GatewayIntentBits.MessageContent
]
});
// Global Constants and Variables
const dirEvents = fs.readdirSync(path.join(__dirname,'src/events'));
const dirCommands = fs.readdirSync(path.join(__dirname,'src/commands'));
// Collections
client.cmds = new Discord.Collection();
for (const fileEvent of dirEvents) {
const event = require(path.join(__dirname, 'src/events', fileEvent));
client.on(event.name, (...args) => event.run(client,...args));
}
for (const fileCommand of dirCommands) {
const command = require(path.join(__dirname, 'src/commands', fileCommand));
client.cmds.set(command.name, command);
}
client.login(config.token)
module.exports.client = client;