forked from timotejroiko/discord.js-light
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.js
57 lines (52 loc) · 1.55 KB
/
client.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
"use strict";
const Discord = require("./extensions.js");
const PacketHandlers = require("./handlers.js");
const Actions = require("./actions.js");
const { emitWarning } = process;
process.emitWarning = function(...args) {
if(args[1] !== "UnsupportedCacheOverwriteWarning" && !args[0].includes("#deleted")) {
emitWarning(...args);
}
};
Discord.Client = class Client extends Discord.Client {
constructor(options = {}) {
if(Array.isArray(options.disabledEvents)) {
for(const event of options.disabledEvents) { delete PacketHandlers[event]; }
}
if(!options.makeCache) {
options.makeCache = Discord.Options.cacheWithLimits({
ApplicationCommandManager: 0,
BaseGuildEmojiManager: 0,
ChannelManager: 0,
GuildBanManager: 0,
GuildChannelManager: 0,
GuildInviteManager: 0,
// GuildManager: 0,
GuildMemberManager: 0,
GuildStickerManager: 0,
MessageManager: 0,
PermissionOverwriteManager: 0,
PresenceManager: 0,
ReactionManager: 0,
ReactionUserManager: 0,
RoleManager: 0,
StageInstanceManager: 0,
ThreadManager: 0,
ThreadMemberManager: 0,
UserManager: 0,
VoiceStateManager: 0
});
}
super(options);
for(const action of Object.keys(Actions)) { this.actions[action].handle = Actions[action]; }
this.ws.handlePacket = (packet, shard) => {
if(packet && PacketHandlers[packet.t]) {
PacketHandlers[packet.t](this, packet, shard);
}
return true;
};
}
};
const pkg = require("./package.json");
Discord.version = `${pkg.version} (${Discord.version})`;
module.exports = Discord;