This repository has been archived by the owner on Jun 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
66 lines (64 loc) · 2.56 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
/**
* @INFO
* Bot Coded by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template
* @INFO
* Work for Milrato Development | https://milrato.eu
* @INFO
* Please mention Him / Milrato Development, when using this Code!
* @INFO
*/
//Importing all needed Commands
const Discord = require("discord.js");
const Meme = require("memer-api");
//this is the official discord.js wrapper for the Discord Api, which we use!
const colors = require("colors"); //this Package is used, to change the colors of our Console! (optional and doesnt effect performance)
const fs = require("fs"); //this package is for reading files and getting their inputs
//Creating the Discord.js Client for This Bot with some default settings ;) and with partials, so you can fetch OLD messages
const client = new Discord.Client({
messageCacheLifetime: 60,
fetchAllMembers: false,
messageCacheMaxSize: 10,
restTimeOffset: 0,
restWsBridgetimeout: 100,
disableEveryone: true,
partials: ['MESSAGE', 'CHANNEL', 'REACTION']
});
client.memer = new Meme(require("./botconfig/config.json").apitoken))
//Client variables to use everywhere
client.commands = new Discord.Collection(); //an collection (like a digital map(database)) for all your commands
client.aliases = new Discord.Collection(); //an collection for all your command-aliases
client.categories = fs.readdirSync("./commands/"); //categories
client.cooldowns = new Discord.Collection(); //an collection for cooldown commands of each user
//Loading files, with the client variable like Command Handler, Event Handler, ...
["command", "events"].forEach(handler => {
require(`./handlers/${handler}`)(client);
});
//login into the bot
client.login(require("./botconfig/config.json").token);
/**
* @INFO
* Bot Coded by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template
* @INFO
* Work for Milrato Development | https://milrato.eu
* @INFO
* Please mention Him / Milrato Development, when using this Code!
* @INFO
*/
process.on('unhandledRejection', (reason, p) => {
console.log('Promise: ', p , 'Reason: ', reason.stack ? reason.stack : reason);
});
process.on("uncaughtException", (err, origin) => {
console.log('Exception: ', err.stack ? err.stack : err)
})
process.on('uncaughtExceptionMonitor', (err, origin) => {
console.log('Exception: ', err.stack ? err.stack : err)
});
process.on('beforeExit', (code) => {
console.log('Code: ', code);
});
process.on('exit', (code) => {
console.log('Code: ', code);
});
process.on('multipleResolves', (type, promise, reason) => {
console.log(type, promise, reason);
});