-
Notifications
You must be signed in to change notification settings - Fork 189
/
Copy pathindex.js
65 lines (62 loc) · 2.09 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const Discord = require('discord.js')
const keep_alive = require('./keep_alive.js')
const client = new Discord.Client({
fetchAllMembers: true,
partials: ['MESSAGE', 'CHANNEL', 'REACTION', 'GUILD_PRESENCES', 'GUILD_MEMBERS', 'GUILD_MESSAGES', 'GUILD_VOICE_STATES'],
intents: [
Discord.Intents.FLAGS.DIRECT_MESSAGES,
Discord.Intents.FLAGS.DIRECT_MESSAGE_REACTIONS,
Discord.Intents.FLAGS.DIRECT_MESSAGE_TYPING,
Discord.Intents.FLAGS.GUILDS,
Discord.Intents.FLAGS.GUILD_BANS,
Discord.Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS,
Discord.Intents.FLAGS.GUILD_INTEGRATIONS,
Discord.Intents.FLAGS.GUILD_INVITES,
Discord.Intents.FLAGS.GUILD_MEMBERS,
Discord.Intents.FLAGS.GUILD_MESSAGES,
Discord.Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Discord.Intents.FLAGS.GUILD_MESSAGE_TYPING,
Discord.Intents.FLAGS.GUILD_PRESENCES,
Discord.Intents.FLAGS.GUILD_VOICE_STATES,
Discord.Intents.FLAGS.GUILD_WEBHOOKS,
]
})
const {
readdirSync
} = require("fs")
const db = require('quick.db')
const ms = require("ms")
const {
MessageEmbed
} = require('discord.js')
const {
login
} = require("./util/login.js");
login(client)
process.on("unhandledRejection", err => {
if (err.message) return
console.error("Uncaught Promise Error: ", err);
})
const loadCommands = (dir = "./commands/") => {
readdirSync(dir).forEach(dirs => {
const commands = readdirSync(`${dir}/${dirs}/`).filter(files => files.endsWith(".js"));
for (const file of commands) {
const getFileName = require(`${dir}/${dirs}/${file}`);
client.commands.set(getFileName.name, getFileName);
console.log(`> Commande Charger ${getFileName.name} [${dirs}]`)
};
});
};
const loadEvents = (dir = "./events/") => {
readdirSync(dir).forEach(dirs => {
const events = readdirSync(`${dir}/${dirs}/`).filter(files => files.endsWith(".js"));
for (const event of events) {
const evt = require(`${dir}/${dirs}/${event}`);
const evtName = event.split(".")[0];
client.on(evtName, evt.bind(null, client));
console.log(`> Event Charger ${evtName}`)
};
});
};
loadEvents();
loadCommands();