This repository was archived by the owner on Dec 21, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
109 lines (80 loc) · 2.28 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
if (Number(process.version.slice(1).split('.')[0]) < 8) throw new RangeError('Node 8.0.0 or higher is required. Update Node on your system.');
const Discord = require('discord.js');
//const sentryconfig = require('./sentry.json');
//const Raven = require('raven');
//Raven.config(sentryconfig.link).install();
const { promisify } = require('util');
const readdir = promisify(require('fs').readdir);
const Enmap = require('enmap');
const client = new Discord.Client({
fetchAllMembers: true,
disableEveryone: true});
client.config = require('./config.json');
client.logger = require('./modules/Logger');
require('./modules/functions.js')(client);
client.commands = new Enmap();
client.aliases = new Enmap();
client.settings = new Enmap({
name: 'settings',
autoFetch: true
});
client.tokens = new Enmap({
name: 'tokens',
autofetch: true,
fetchAll: true
});
client.blackList = new Enmap({
name: 'blackList',
autofetch: true,
fetchAll:true
});
client.bans = new Enmap({
name: 'bans',
autoFetch: true,
fetchAll: true
});
client.approved = new Enmap({
name: 'approved',
autofetch: true,
fetchAll: true
});
client.approvedUsers = new Enmap({
name: 'approvedUsers',
autofetch: true,
fetchAll: true
});
client.whiteList = new Enmap({
name: 'whiteList',
autofetch: true,
fetchAll: true
});
client.raidMode = new Enmap({
name: 'raidMode',
autoFetch: true,
fetchAll: true
});
const init = async () => {
const { join } = require('path');
const commands = await readdir(join(__dirname, './commands/'));
client.logger.log(`Loading a total of ${commands.length} commands.`);
commands.forEach(f => {
if (!f.endsWith('.js' || '.ts')) return;
const response = client.loadCommand(f);
if (response) console.log(response);
});
const evtFiles = await readdir(join(__dirname, './events/'));
client.logger.log(`Loading a total of ${evtFiles.length} events.`);
evtFiles.forEach(file => {
const eventName = file.split('.')[0];
client.logger.log(`Loading Event: ${eventName}`);
const event = require(`./events/${file}`);
client.on(eventName, event.bind(null, client));
});
client.login(client.config.token);
};
init();
setTimeout(() => {
const start = require('./server/main.js');
new start();
}, 3400);
module.exports = client;