-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
79 lines (65 loc) · 2.63 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
66
67
68
69
70
71
72
73
74
75
76
/**********************************************************
* @param {1} Import_Modules for this FIle
*********************************************************/
const Discord = require("discord.js");
const colors = require("colors");
const enmap = require("enmap");
const fs = require("fs");
const config = require("./botconfig/config.json")
/**********************************************************
* @param {2} CREATE_THE_DISCORD_BOT_CLIENT with some default settings
*********************************************************/
const client = new Discord.Client({
fetchAllMembers: false,
failIfNotExists: false,
shards: "auto",
allowedMentions: {
parse: ["roles", "users"],
repliedUser: false,
},
partials: ['MESSAGE', 'CHANNEL', 'REACTION', 'GUILD_MEMBER', 'USER'],
intents: [
Discord.Intents.FLAGS.GUILDS,
Discord.Intents.FLAGS.GUILD_MEMBERS,
Discord.Intents.FLAGS.GUILD_INTEGRATIONS,
Discord.Intents.FLAGS.GUILD_VOICE_STATES,
Discord.Intents.FLAGS.GUILD_MESSAGES, //for slash
],
presence: {
activities: [{
name: `${config.status.text}`.replace("{prefix}", config.prefix),
type: config.status.type, url: config.status.url
}],
status: "dnd"
}
});
/**********************************************************
* @param {3} create_the_languages_objects to select via CODE
*********************************************************/
client.la = { }
var langs = fs.readdirSync("./languages")
for(const lang of langs.filter(file => file.endsWith(".json"))){
client.la[`${lang.split(".json").join("")}`] = require(`./languages/${lang}`)
}
Object.freeze(client.la)
/**********************************************************
* @param {4} Raise_the_Max_Listeners to 25 (default 10)
*********************************************************/
client.setMaxListeners(25);
require('events').defaultMaxListeners = 25;
/**********************************************************
* @LOAD_THE_DASHBOARD
* *******************************************************/
client.on("ready", () => {
require("./dashboard/index.js")(client);
})
/**********************************************************
* @param {5} LOAD_the_BOT_Functions_and_events
*********************************************************/
Array("extraevents", "loaddb", "clientvariables", "command", "events", "erelahandler", "slashCommands").forEach(handler => {
try{ require(`./handlers/${handler}`)(client); }catch (e){ console.warn(e) }
});
/**********************************************************
* @param {6} Login_to_the_Bot
*********************************************************/
client.login(process.env.token || config.token);