magmastream 2.9.3-dev.3 → 2.9.3-dev.31

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.
Files changed (42) hide show
  1. package/dist/config/blockedWords.d.ts +1 -0
  2. package/dist/index.d.ts +19 -3687
  3. package/dist/index.js +1 -1
  4. package/dist/statestorage/JsonQueue.d.ts +173 -0
  5. package/dist/statestorage/JsonQueue.js +32 -4
  6. package/dist/statestorage/MemoryQueue.d.ts +154 -0
  7. package/dist/statestorage/MemoryQueue.js +56 -36
  8. package/dist/statestorage/RedisQueue.d.ts +178 -0
  9. package/dist/statestorage/RedisQueue.js +29 -7
  10. package/dist/structures/Enums.d.ts +310 -0
  11. package/dist/structures/Enums.js +6 -0
  12. package/dist/structures/Filters.d.ts +352 -0
  13. package/dist/structures/Filters.js +5 -4
  14. package/dist/structures/MagmastreamError.d.ts +14 -0
  15. package/dist/structures/Manager.d.ts +259 -0
  16. package/dist/structures/Manager.js +296 -555
  17. package/dist/structures/Node.d.ts +390 -0
  18. package/dist/structures/Node.js +100 -145
  19. package/dist/structures/Player.d.ts +347 -0
  20. package/dist/structures/Player.js +55 -132
  21. package/dist/structures/Plugin.d.ts +23 -0
  22. package/dist/structures/Rest.d.ts +93 -0
  23. package/dist/structures/Rest.js +41 -21
  24. package/dist/structures/Types.d.ts +1315 -0
  25. package/dist/structures/Utils.d.ts +169 -0
  26. package/dist/structures/Utils.js +145 -71
  27. package/dist/utils/filtersEqualizers.d.ts +16 -0
  28. package/dist/utils/managerCheck.d.ts +7 -0
  29. package/dist/utils/nodeCheck.d.ts +7 -0
  30. package/dist/utils/playerCheck.d.ts +7 -0
  31. package/dist/wrappers/discord.js.d.ts +15 -0
  32. package/dist/wrappers/discord.js.js +19 -4
  33. package/dist/wrappers/discordeno.d.ts +19 -0
  34. package/dist/wrappers/discordeno.js +77 -0
  35. package/dist/wrappers/eris.d.ts +15 -0
  36. package/dist/wrappers/eris.js +20 -3
  37. package/dist/wrappers/oceanic.d.ts +15 -0
  38. package/dist/wrappers/oceanic.js +22 -4
  39. package/dist/wrappers/seyfert.d.ts +37 -0
  40. package/dist/wrappers/seyfert.js +25 -1
  41. package/package.json +106 -98
  42. package/dist/wrappers/detritus.js +0 -52
@@ -0,0 +1,15 @@
1
+ import { GatewayVoiceStateUpdate } from "discord-api-types/v10";
2
+ import { Manager as BaseManager } from "../structures/Manager";
3
+ import type { Client, Guild, User } from "eris";
4
+ import { AnyUser, ManagerOptions } from "../structures/Types";
5
+ export * from "../index";
6
+ /**
7
+ * Eris wrapper for Magmastream.
8
+ */
9
+ export declare class ErisManager extends BaseManager {
10
+ readonly client: Client;
11
+ constructor(client: Client, options?: ManagerOptions);
12
+ protected send(packet: GatewayVoiceStateUpdate): void;
13
+ resolveUser(user: AnyUser | string): Promise<User | AnyUser>;
14
+ resolveGuild(guildId: string): Guild;
15
+ }
@@ -2,7 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ErisManager = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const v10_1 = require("discord-api-types/v10");
5
6
  const Manager_1 = require("../structures/Manager");
7
+ const Enums_1 = require("../structures/Enums");
8
+ const MagmastreamError_1 = require("../structures/MagmastreamError");
6
9
  tslib_1.__exportStar(require("../index"), exports);
7
10
  /**
8
11
  * Eris wrapper for Magmastream.
@@ -12,11 +15,19 @@ class ErisManager extends Manager_1.Manager {
12
15
  constructor(client, options) {
13
16
  super(options);
14
17
  this.client = client;
15
- client.once("ready", () => {
18
+ const intents = this.client.options.intents;
19
+ const hasGuildVoiceStates = typeof intents === "number" ? (intents & v10_1.GatewayIntentBits.GuildVoiceStates) === v10_1.GatewayIntentBits.GuildVoiceStates : intents.includes("guildVoiceStates");
20
+ if (!hasGuildVoiceStates) {
21
+ throw new MagmastreamError_1.MagmaStreamError({
22
+ code: Enums_1.MagmaStreamErrorCode.INTENT_MISSING,
23
+ message: "[Custom Wrapper] Your Eris client must have the guildVoiceStates intent enabled.",
24
+ });
25
+ }
26
+ this.client.once("ready", () => {
16
27
  if (!this.options.clientId)
17
28
  this.options.clientId = client.user.id;
18
29
  });
19
- client.on("rawWS", async (packet) => {
30
+ this.client.on("rawWS", async (packet) => {
20
31
  await this.updateVoiceState(packet);
21
32
  });
22
33
  }
@@ -26,7 +37,7 @@ class ErisManager extends Manager_1.Manager {
26
37
  guild.shard.sendWS(packet.op, packet.d);
27
38
  }
28
39
  async resolveUser(user) {
29
- const id = typeof user === "string" ? user : user.id;
40
+ const id = typeof user === "string" ? user : String(user.id);
30
41
  const cached = this.client.users.get(id);
31
42
  if (cached)
32
43
  return cached;
@@ -35,5 +46,11 @@ class ErisManager extends Manager_1.Manager {
35
46
  username: typeof user === "string" ? undefined : user.username,
36
47
  };
37
48
  }
49
+ resolveGuild(guildId) {
50
+ const cached = this.client.guilds.get(guildId);
51
+ if (cached)
52
+ return cached;
53
+ return null;
54
+ }
38
55
  }
39
56
  exports.ErisManager = ErisManager;
@@ -0,0 +1,15 @@
1
+ import { GatewayVoiceStateUpdate } from "discord-api-types/v10";
2
+ import { Manager as BaseManager } from "../structures/Manager";
3
+ import { AnyUser, ManagerOptions } from "../structures/Types";
4
+ import { Client, Guild, User } from "oceanic.js";
5
+ export * from "../index";
6
+ /**
7
+ * Oceanic wrapper for Magmastream.
8
+ */
9
+ export declare class OceanicManager extends BaseManager {
10
+ readonly client: Client;
11
+ constructor(client: Client, options?: ManagerOptions);
12
+ protected send(packet: GatewayVoiceStateUpdate): void;
13
+ resolveUser(user: AnyUser | string): Promise<User | AnyUser>;
14
+ resolveGuild(guildId: string): Guild;
15
+ }
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OceanicManager = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const Manager_1 = require("../structures/Manager");
6
+ const oceanic_js_1 = require("oceanic.js");
7
+ const Enums_1 = require("../structures/Enums");
8
+ const MagmastreamError_1 = require("../structures/MagmastreamError");
6
9
  tslib_1.__exportStar(require("../index"), exports);
7
10
  /**
8
11
  * Oceanic wrapper for Magmastream.
@@ -12,11 +15,20 @@ class OceanicManager extends Manager_1.Manager {
12
15
  constructor(client, options) {
13
16
  super(options);
14
17
  this.client = client;
15
- client.once("ready", () => {
18
+ const intents = this.client.shards.options.intents;
19
+ const { Intents } = oceanic_js_1.Constants;
20
+ const hasGuildVoiceStates = typeof intents === "number" ? (intents & Intents.GUILD_VOICE_STATES) === Intents.GUILD_VOICE_STATES : intents.includes("GUILD_VOICE_STATES");
21
+ if (!hasGuildVoiceStates) {
22
+ throw new MagmastreamError_1.MagmaStreamError({
23
+ code: Enums_1.MagmaStreamErrorCode.INTENT_MISSING,
24
+ message: "[Custom Wrapper] Your Oceanic client must have the GUILD_VOICE_STATES intent enabled.",
25
+ });
26
+ }
27
+ this.client.once("ready", () => {
16
28
  if (!this.options.clientId)
17
- this.options.clientId = client.user.id;
29
+ this.options.clientId = this.client.user.id;
18
30
  });
19
- client.on("packet", async (packet) => {
31
+ this.client.on("packet", async (packet) => {
20
32
  await this.updateVoiceState(packet);
21
33
  });
22
34
  }
@@ -26,7 +38,7 @@ class OceanicManager extends Manager_1.Manager {
26
38
  guild.shard.send(packet.op, packet.d);
27
39
  }
28
40
  async resolveUser(user) {
29
- const id = typeof user === "string" ? user : user.id;
41
+ const id = typeof user === "string" ? user : String(user.id);
30
42
  const cached = this.client.users.get(id);
31
43
  if (cached)
32
44
  return cached;
@@ -35,5 +47,11 @@ class OceanicManager extends Manager_1.Manager {
35
47
  username: typeof user === "string" ? undefined : user.username,
36
48
  };
37
49
  }
50
+ resolveGuild(guildId) {
51
+ const cached = this.client.guilds.get(guildId);
52
+ if (cached)
53
+ return cached;
54
+ return null;
55
+ }
38
56
  }
39
57
  exports.OceanicManager = OceanicManager;
@@ -0,0 +1,37 @@
1
+ import { Manager as BaseManager } from "../structures/Manager";
2
+ import { type GatewayVoiceStateUpdate } from "discord-api-types/v10";
3
+ import { Client, Guild, User, WorkerClient } from "seyfert";
4
+ import { AnyUser, ManagerOptions } from "../structures/Types";
5
+ export * from "../index";
6
+ /**
7
+ * Seyfert wrapper for Magmastream.
8
+ *
9
+ * @note This wrapper does require the manual implementation of the "raw" and "ready" events, to call the `updateVoiceState` and `init` methods respectively.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * const client = new Client();
14
+ * const manager = new SeyfertManager(client, options);
15
+ *
16
+ * client.events.values.RAW = {
17
+ * data: { name: "raw" },
18
+ * run: async (data) => {
19
+ * await manager.updateVoiceState(data);
20
+ * }
21
+ * }
22
+ *
23
+ * client.events.values.READY = {
24
+ * data: { name: "ready" },
25
+ * run: async (user, client) => {
26
+ * await manager.init({ clientId: client.botId });
27
+ * }
28
+ * }
29
+ * ```
30
+ */
31
+ export declare class SeyfertManager extends BaseManager {
32
+ readonly client: Client | WorkerClient;
33
+ constructor(client: Client | WorkerClient, options?: ManagerOptions);
34
+ protected send(packet: GatewayVoiceStateUpdate): void;
35
+ resolveUser(user: AnyUser | string): Promise<User | AnyUser>;
36
+ resolveGuild(guildId: string): Guild<"cached">;
37
+ }
@@ -4,7 +4,10 @@ exports.SeyfertManager = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const Manager_1 = require("../structures/Manager");
6
6
  const seyfert_1 = require("seyfert");
7
+ const types_1 = require("seyfert/lib/types");
7
8
  const common_1 = require("seyfert/lib/common");
9
+ const MagmastreamError_1 = require("../structures/MagmastreamError");
10
+ const Enums_1 = require("../structures/Enums");
8
11
  tslib_1.__exportStar(require("../index"), exports);
9
12
  /**
10
13
  * Seyfert wrapper for Magmastream.
@@ -36,6 +39,21 @@ class SeyfertManager extends Manager_1.Manager {
36
39
  constructor(client, options) {
37
40
  super(options);
38
41
  this.client = client;
42
+ this.client
43
+ .getRC()
44
+ .then((rc) => {
45
+ if (!(rc.intents & types_1.GatewayIntentBits.GuildVoiceStates)) {
46
+ throw new MagmastreamError_1.MagmaStreamError({
47
+ code: Enums_1.MagmaStreamErrorCode.INTENT_MISSING,
48
+ message: "[Custom Wrapper] Your Seyfert client must have the GuildVoiceStates intent enabled.",
49
+ });
50
+ }
51
+ })
52
+ .catch((error) => {
53
+ queueMicrotask(() => {
54
+ throw error;
55
+ });
56
+ });
39
57
  }
40
58
  send(packet) {
41
59
  if (this.client instanceof seyfert_1.Client) {
@@ -46,7 +64,7 @@ class SeyfertManager extends Manager_1.Manager {
46
64
  }
47
65
  }
48
66
  async resolveUser(user) {
49
- const id = typeof user === "string" ? user : user.id;
67
+ const id = typeof user === "string" ? user : String(user.id);
50
68
  const cached = this.client.cache.users?.get(id);
51
69
  if (cached)
52
70
  return cached;
@@ -57,5 +75,11 @@ class SeyfertManager extends Manager_1.Manager {
57
75
  return { id, username: typeof user === "string" ? undefined : user.username };
58
76
  }
59
77
  }
78
+ resolveGuild(guildId) {
79
+ const cached = this.client.cache.guilds?.get(guildId);
80
+ if (cached)
81
+ return cached;
82
+ return null;
83
+ }
60
84
  }
61
85
  exports.SeyfertManager = SeyfertManager;
package/package.json CHANGED
@@ -1,100 +1,108 @@
1
1
  {
2
- "name": "magmastream",
3
- "version": "2.9.3-dev.3",
4
- "description": "A user-friendly Lavalink client designed for NodeJS.",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "files": [
8
- "dist"
9
- ],
10
- "scripts": {
11
- "build": "tsc",
12
- "types": "rtb --dist dist",
13
- "lint": "eslint src",
14
- "lint:fix": "eslint --fix src",
15
- "ci": "run-s lint:fix lint build types",
16
- "release:dev": "npm run ci && npm version prerelease --preid=dev && npm run ci && npm publish --tag dev"
17
- },
18
- "devDependencies": {
19
- "@favware/rollup-type-bundler": "^4.0.0",
20
- "@types/jsdom": "^21.1.7",
21
- "@types/lodash": "^4.17.20",
22
- "@types/node": "^22.16.5",
23
- "@types/ws": "^8.18.1",
24
- "@typescript-eslint/eslint-plugin": "^8.37.0",
25
- "@typescript-eslint/parser": "^8.37.0",
26
- "eslint": "^9.31.0",
27
- "npm-run-all": "^4.1.5",
28
- "typedoc": "^0.27.9",
29
- "typedoc-plugin-no-inherit": "^1.6.1",
30
- "typescript": "^5.8.3"
31
- },
32
- "dependencies": {
33
- "@discordjs/collection": "^2.1.1",
34
- "axios": "^1.10.0",
35
- "events": "^3.3.0",
36
- "ioredis": "^5.6.1",
37
- "jsdom": "^26.1.0",
38
- "lodash": "^4.17.21",
39
- "safe-stable-stringify": "^2.5.0",
40
- "tslib": "^2.8.1",
41
- "ws": "^8.18.3"
42
- },
43
- "optionalDependencies": {
44
- "detritus-client": "0.16.x",
45
- "discord.js": "14.x",
46
- "eris": "0.18.x",
47
- "oceanic.js": "1.12.0",
48
- "seyfert": "3.2.x"
49
- },
50
- "engines": {
51
- "node": ">=16.0.0"
52
- },
53
- "eslintConfig": {
54
- "root": true,
55
- "parser": "@typescript-eslint/parser",
56
- "plugins": [
57
- "@typescript-eslint"
58
- ],
59
- "rules": {
60
- "object-curly-spacing": [
61
- "error",
62
- "always"
63
- ]
64
- },
65
- "extends": [
66
- "eslint:recommended",
67
- "plugin:@typescript-eslint/recommended"
68
- ]
69
- },
70
- "keywords": [
71
- "lavalink client",
72
- "wrapper",
73
- "typescript",
74
- "discord.js",
75
- "node.js",
76
- "java",
77
- "javascript",
78
- "audio streaming",
79
- "music bot",
80
- "voice chat",
81
- "discord integration",
82
- "high performance",
83
- "scalable",
84
- "easy-to-use",
85
- "feature-rich",
86
- "cross-platform",
87
- "seamless integration",
88
- "community support",
89
- "documentation",
90
- "open-source",
91
- "lavalink",
92
- "magmastream"
93
- ],
94
- "repository": {
95
- "url": "git+https://github.com/Blackfort-Hosting/magmastream.git#main"
96
- },
97
- "homepage": "https://docs.magmastream.com",
98
- "author": "Abel Purnwasy",
99
- "license": "Apache-2.0"
2
+ "name": "magmastream",
3
+ "version": "2.9.3-dev.31",
4
+ "description": "A user-friendly Lavalink client designed for NodeJS.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "prepare": "npm run build",
12
+ "build": "tsc",
13
+ "types": "rtb --dist dist",
14
+ "format": "prettier --write .",
15
+ "format:check": "prettier --check .",
16
+ "lint": "eslint \"src/**/*.{ts,js}\"",
17
+ "lint:fix": "eslint --fix \"src/**/*.{ts,js}\"",
18
+ "ci": "run-s format:check lint build types",
19
+ "release:dev": "npm run format && npm run lint:fix && npm run ci && npm version prerelease --preid=dev && git push && npm publish --tag dev"
20
+ },
21
+ "devDependencies": {
22
+ "@favware/rollup-type-bundler": "^4.0.0",
23
+ "@types/jsdom": "^28.0.0",
24
+ "@types/lodash": "^4.17.24",
25
+ "@types/node": "^25.3.0",
26
+ "@types/ws": "^8.18.1",
27
+ "@typescript-eslint/eslint-plugin": "^8.56.0",
28
+ "@typescript-eslint/parser": "^8.56.0",
29
+ "eslint": "^10.0.2",
30
+ "npm-run-all": "^4.1.5",
31
+ "prettier": "^3.8.1",
32
+ "typedoc": "^0.28.17",
33
+ "typedoc-plugin-no-inherit": "^1.6.1",
34
+ "typescript": "^5.9.3"
35
+ },
36
+ "dependencies": {
37
+ "@discordjs/collection": "^2.1.1",
38
+ "axios": "^1.13.6",
39
+ "events": "^3.3.0",
40
+ "ioredis": "^5.10.0",
41
+ "jsdom": "^28.1.0",
42
+ "lodash": "^4.17.23",
43
+ "safe-stable-stringify": "^2.5.0",
44
+ "tslib": "^2.8.1",
45
+ "ws": "^8.19.0"
46
+ },
47
+ "optionalDependencies": {
48
+ "discord.js": "14.x",
49
+ "discordeno": "21.x",
50
+ "eris": "0.18.x",
51
+ "oceanic.js": "1.13.x",
52
+ "seyfert": "4.x"
53
+ },
54
+ "overrides": {
55
+ "undici": "^7.0.0"
56
+ },
57
+ "engines": {
58
+ "node": ">=20.19.0"
59
+ },
60
+ "eslintConfig": {
61
+ "root": true,
62
+ "parser": "@typescript-eslint/parser",
63
+ "plugins": [
64
+ "@typescript-eslint"
65
+ ],
66
+ "rules": {
67
+ "object-curly-spacing": [
68
+ "error",
69
+ "always"
70
+ ]
71
+ },
72
+ "extends": [
73
+ "eslint:recommended",
74
+ "plugin:@typescript-eslint/recommended"
75
+ ]
76
+ },
77
+ "keywords": [
78
+ "lavalink client",
79
+ "wrapper",
80
+ "typescript",
81
+ "discord.js",
82
+ "node.js",
83
+ "java",
84
+ "javascript",
85
+ "audio streaming",
86
+ "music bot",
87
+ "voice chat",
88
+ "discord integration",
89
+ "high performance",
90
+ "scalable",
91
+ "easy-to-use",
92
+ "feature-rich",
93
+ "cross-platform",
94
+ "seamless integration",
95
+ "community support",
96
+ "documentation",
97
+ "open-source",
98
+ "lavalink",
99
+ "magmastream"
100
+ ],
101
+ "repository": {
102
+ "type": "git",
103
+ "url": "git+https://gitryx.com/MagmaStream/magmastream.git#main"
104
+ },
105
+ "homepage": "https://docs.magmastream.com",
106
+ "author": "Abel Purnwasy",
107
+ "license": "Apache-2.0"
100
108
  }
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DetritusManager = void 0;
4
- const tslib_1 = require("tslib");
5
- const Manager_1 = require("../structures/Manager");
6
- const detritus_client_1 = require("detritus-client");
7
- tslib_1.__exportStar(require("../index"), exports);
8
- /**
9
- * Detritus wrapper for Magmastream.
10
- */
11
- class DetritusManager extends Manager_1.Manager {
12
- client;
13
- constructor(client, options) {
14
- super(options);
15
- this.client = client;
16
- client.once("ready", () => {
17
- if (!this.options.clientId)
18
- this.options.clientId = client instanceof detritus_client_1.ClusterClient ? client.applicationId : client.clientId;
19
- });
20
- client.on("raw", async (packet) => {
21
- await this.updateVoiceState(packet);
22
- });
23
- }
24
- send(packet) {
25
- const asCluster = this.client;
26
- const asShard = this.client;
27
- if (asShard.guilds)
28
- return asShard.gateway.send(packet.op, packet.d);
29
- if (asCluster.shards) {
30
- const shard = asCluster.shards.find((c) => c.guilds.has(packet.d.guild_id));
31
- if (shard)
32
- shard.gateway.send(packet.op, packet.d);
33
- }
34
- }
35
- async resolveUser(user) {
36
- const id = typeof user === "string" ? user : user.id;
37
- if (this.client instanceof detritus_client_1.ShardClient) {
38
- const cached = this.client.users.get(id);
39
- if (cached)
40
- return { id: cached.id, username: cached.username };
41
- }
42
- else if (this.client instanceof detritus_client_1.ClusterClient) {
43
- for (const [, shard] of this.client.shards) {
44
- const cached = shard.users.get(id);
45
- if (cached)
46
- return { id: cached.id, username: cached.username };
47
- }
48
- }
49
- return typeof user === "string" ? { id: user } : user;
50
- }
51
- }
52
- exports.DetritusManager = DetritusManager;