-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
35 lines (30 loc) · 1.2 KB
/
main.js
File metadata and controls
35 lines (30 loc) · 1.2 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
/* eslint-disable no-unused-vars */
const path = require('path');
const fs = require('fs');
const Discord = require('discord.js');
const client = new Discord.Client({
partials: ['MESSAGE', 'CHANNEL', 'REACTION', 'GUILD_MEMBER', 'USER'],
intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_MEMBERS', 'GUILD_PRESENCES', 'DIRECT_MESSAGES', 'GUILD_BANS', 'GUILD_WEBHOOKS'],
}).setMaxListeners(0);
const config = require('./config.json');
client.config = require('./configurations/config');
client.emotes = client.config.emotes;
client.colors = client.config.colors;
client.snipes = new Discord.Collection();
client.commands = new Discord.Collection();
const eventFiles = fs.readdirSync('./events').filter(file => file.endsWith('.js'));
for (const file of eventFiles) {
const event = require(`./events/${file}`);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args, client));
}
else {
client.on(event.name, (...args) => event.execute(...args, client));
}
}
const commandFiles = fs.readdirSync('./slashys').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./slashys/${file}`);
client.commands.set(command.name, command);
}
client.login(config.token);