magmastream 2.10.2-dev.2 → 2.10.2-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wrappers/discord.js.js +10 -2
- package/package.json +1 -1
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DiscordJSManager = void 0;
|
|
4
4
|
const Manager_1 = require("../structures/Manager");
|
|
5
|
+
const module_1 = require("module");
|
|
5
6
|
const MagmastreamError_1 = require("../structures/MagmastreamError");
|
|
6
7
|
const Enums_1 = require("../structures/Enums");
|
|
7
8
|
const GUILD_VOICE_STATES_INTENT = 128;
|
|
9
|
+
const moduleRequire = (0, module_1.createRequire)(__filename);
|
|
8
10
|
/**
|
|
9
11
|
* Discord.js wrapper for Magmastream.
|
|
10
12
|
*/
|
|
@@ -13,6 +15,8 @@ class DiscordJSManager extends Manager_1.Manager {
|
|
|
13
15
|
constructor(client, options) {
|
|
14
16
|
super(options, true);
|
|
15
17
|
this.client = client;
|
|
18
|
+
const { version: djsVersion } = moduleRequire("discord.js/package.json");
|
|
19
|
+
const [major, minor] = djsVersion.split(".").map(Number);
|
|
16
20
|
if (!this.client.options.intents.has(GUILD_VOICE_STATES_INTENT)) {
|
|
17
21
|
throw new MagmastreamError_1.MagmaStreamError({
|
|
18
22
|
code: Enums_1.MagmaStreamErrorCode.INTENT_MISSING,
|
|
@@ -28,8 +32,12 @@ class DiscordJSManager extends Manager_1.Manager {
|
|
|
28
32
|
if (!this.options.clientId)
|
|
29
33
|
this.options.clientId = this.client.user.id;
|
|
30
34
|
};
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
if (major > 14 || (major === 14 && minor >= 22)) {
|
|
36
|
+
this.client.once("clientReady", handler);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.client.once("ready", handler);
|
|
40
|
+
}
|
|
33
41
|
};
|
|
34
42
|
attachReadyHandler();
|
|
35
43
|
client.on("raw", async (data) => {
|