forked from DarkThunder99/Bot-with-Advanced-Dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MEE8.js
70 lines (59 loc) · 2.05 KB
/
MEE8.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
const { Client, Collection } = require("discord.js");
const Util = require('./structures/Util');
const config = require('./config.json');
const logger = require('./utils/logger');
const { token } = require('./utils/variables');
module.exports = class MEE8Client extends Client {
constructor(options = {}, sentry) {
super({
partials: ['MESSAGE', 'CHANNEL', 'REACTION', 'GUILD_MEMBER', 'USER'],
cacheGuilds: true,
cacheChannels: true,
cacheOverwrites: false,
cacheRoles: true,
cacheEmojis: true,
cachePresences: false,
fetchAllMembers: true,
disableMentions: 'everyone',
messageCacheMaxSize: 25,
messageCacheLifetime: 10000,
messageSweepInterval: 12000,
shardCount: 1,
ws: {
intents: [
"GUILDS",
"GUILD_MEMBERS",
"GUILD_MESSAGES",
"GUILD_EMOJIS",
'GUILD_MESSAGE_REACTIONS',
'GUILD_VOICE_STATES'
],
},
});
this.validate(options);
this.partials = ['MESSAGE', 'CHANNEL', 'REACTION', 'GUILD_MEMBER', 'USER'],
this.commands = new Collection();
this.events = new Collection();
this.aliases = new Collection();
this.utils = require('./utils/utils.js');
this.mongoose = require('./utils/mongoose');
this.utils = new Util(this);
this.config = require('./config.json');
}
validate(options) {
if (typeof options !== 'object') throw new TypeError('Options should be a type of Object.');
if (!token) throw new Error('You must pass the token for the client.');
this.token = token;
if(!options.prefix) throw new Error('You must pass a prefix for the client.');
if(typeof options.prefix !== 'string') throw new TypeError('Prefix should be a type of String.');
this.prefix = options.prefix;
if (!options.mongodb_url) throw new Error('You must pass a MONGODB URL for the client.')
}
async start(token = this.token) {
this.utils.loadCommands()
this.utils.loadEvents()
.catch(e => console.log(e))
this.mongoose.init();
this.login(this.token)
}
};