-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.js
83 lines (70 loc) · 2.52 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
77
78
79
80
81
82
83
// Remember I will create the .env file if it is not already created
const Env = require('dotenv').config();
// Libraries
const Enmap = require("enmap");
const Discord = require(`discord.js`);
// Exports
const { getAllFiles } = require('./utils')
// JSONs
const DiscordIDs = {
prod: "./Configs/idsDiscordProd.json",
dev: "./Configs/idsDiscordDev.json"
}
// Hosting? only prod
// If you are going to fork this, remove line 5-14, they are there for hosting purpose, you don't need them if you run locally
if(Env.error != null){
const express = require("express");
const app = express();
app.listen(3000, () => {
console.log("whatever you want here");
});
app.get("/", (_, res) => {
res.send("whatever you want here");
});
}
// Discord Client initialization
const client = new Discord.Client({
intents: [
Discord.GatewayIntentBits.Guilds,
Discord.GatewayIntentBits.GuildMessages,
Discord.GatewayIntentBits.MessageContent,
Discord.GatewayIntentBits.GuildModeration,
Discord.GatewayIntentBits.GuildMembers
],
allowedMentions: {
parse: [`users`]
}
});
// Discord IDs JSON
client.discordIDs = require((Env.error != null) ? DiscordIDs.prod: DiscordIDs.dev);
// Discord Tables
client.forumSpammer = {}
// Discord Collections
client.commands = new Discord.Collection();
client.slashCommands = new Discord.Collection();
client.contextMenuCommands = new Discord.Collection();
client.snipes = new Discord.Collection();
client.esnipes = new Discord.Collection();
client.deprecationCD = new Discord.Collection();
client.use = new Discord.Collection();
client.doxx = new Discord.Collection();
// Enmap's creation
client.items = new Enmap({name: 'items'});
client.currencies = new Enmap({name: 'currencies'});
client.equipments = new Enmap({name: 'equipments'});
client.models = new Enmap({name: 'models'});
client.levels = new Enmap({name: 'levels'});
client.exp = new Enmap({name: 'exp'});
client.epochs = new Enmap({name: 'epochs'});
client.banana = new Enmap({name: 'banana'});
client.bananaCD = new Enmap();
client.scourCD = new Enmap();
client.prefix = new Enmap({name: 'prefix'});
// Read all handlers of the folder
const handlerFiles = getAllFiles('./Handlers').filter(file => file.endsWith('.js'));
for(const handler of handlerFiles) {
require(handler)(client, Discord);
};
// Add your bot token in the token variable in the .env file (create it if it doesn't exist)
// Then use dotenv to read the token from that file
client.login(process.env.token);