hoshimi 0.2.5 → 0.3.1

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/index.js CHANGED
@@ -49,6 +49,7 @@ __export(index_exports, {
49
49
  Queue: () => Queue,
50
50
  ResolveError: () => ResolveError,
51
51
  Rest: () => Rest,
52
+ RestPathType: () => RestPathType,
52
53
  SearchEngines: () => SearchEngines,
53
54
  Severity: () => Severity,
54
55
  SourceNames: () => SourceNames,
@@ -316,6 +317,11 @@ var HttpMethods = /* @__PURE__ */ ((HttpMethods2) => {
316
317
  HttpMethods2["Head"] = "HEAD";
317
318
  return HttpMethods2;
318
319
  })(HttpMethods || {});
320
+ var RestPathType = /* @__PURE__ */ ((RestPathType2) => {
321
+ RestPathType2["Raw"] = "/";
322
+ RestPathType2["V4"] = "/v4";
323
+ return RestPathType2;
324
+ })(RestPathType || {});
319
325
  var HttpStatusCodes = /* @__PURE__ */ ((HttpStatusCodes2) => {
320
326
  HttpStatusCodes2[HttpStatusCodes2["OK"] = 200] = "OK";
321
327
  HttpStatusCodes2[HttpStatusCodes2["Created"] = 201] = "Created";
@@ -525,12 +531,12 @@ var UnresolvedTrack = class {
525
531
  // package.json
526
532
  var package_default = {
527
533
  name: "hoshimi",
528
- version: "0.2.5",
534
+ version: "0.3.1",
529
535
  description: "A lavalink@v4 client easy to use, up-to-date and all ears.",
530
536
  main: "./dist/index.js",
531
537
  module: "./dist/index.mjs",
532
538
  types: "./dist/index.d.ts",
533
- packageManager: "pnpm@10.20.0+sha512.cf9998222162dd85864d0a8102e7892e7ba4ceadebbf5a31f9c2fce48dfce317a9c53b9f6464d1ef9042cba2e02ae02a9f7c143a2b438cd93c91840f0192b9dd",
539
+ packageManager: "pnpm@10.24.0+sha512.01ff8ae71b4419903b65c60fb2dc9d34cf8bb6e06d03bde112ef38f7a34d6904c424ba66bea5cdcf12890230bf39f9580473140ed9c946fef328b6e5238a345a",
534
540
  files: [
535
541
  "dist"
536
542
  ],
@@ -566,13 +572,13 @@ var package_default = {
566
572
  author: "Ganyu Studios",
567
573
  license: "MIT",
568
574
  devDependencies: {
569
- "@biomejs/biome": "^2.3.2",
570
- "@types/node": "^24.9.2",
575
+ "@biomejs/biome": "^2.3.8",
576
+ "@types/node": "^24.10.1",
571
577
  "@types/ws": "^8.18.1",
572
578
  husky: "^9.1.7",
573
- "lint-staged": "^16.2.6",
574
- tsup: "^8.5.0",
575
- tsx: "^4.20.6",
579
+ "lint-staged": "^16.2.7",
580
+ tsup: "^8.5.1",
581
+ tsx: "^4.21.0",
576
582
  typescript: "^5.9.3"
577
583
  },
578
584
  dependencies: {
@@ -638,7 +644,7 @@ var ValidSources = new Map(
638
644
  ["pornhub" /* PornHub */]: "phsearch" /* PornHub */
639
645
  })
640
646
  );
641
- var AudioOutputData = {
647
+ var AudioOutputData = Object.freeze({
642
648
  ["mono" /* Mono */]: {
643
649
  leftToLeft: 0.5,
644
650
  leftToRight: 0.5,
@@ -663,7 +669,7 @@ var AudioOutputData = {
663
669
  rightToLeft: 0,
664
670
  rightToRight: 1
665
671
  }
666
- };
672
+ });
667
673
  var DefaultFilterPreset = Object.freeze({
668
674
  Karaoke: { level: 1, monoLevel: 1, filterBand: 220, filterWidth: 100 },
669
675
  Vaporwave: { speed: 0.8500000238418579, pitch: 0.800000011920929, rate: 1 },
@@ -681,6 +687,8 @@ var DefaultFilterPreset = Object.freeze({
681
687
  });
682
688
  var DefaultPlayerFilters = Object.freeze({
683
689
  volume: 1,
690
+ equalizer: [],
691
+ channelMix: AudioOutputData.mono,
684
692
  lowPass: {
685
693
  smoothing: 0
686
694
  },
@@ -735,7 +743,6 @@ var DefaultPlayerFilters = Object.freeze({
735
743
  maxAmplitude: 0
736
744
  }
737
745
  },
738
- equalizer: [],
739
746
  distortion: {
740
747
  cosOffset: 0,
741
748
  sinOffset: 0,
@@ -745,8 +752,7 @@ var DefaultPlayerFilters = Object.freeze({
745
752
  cosScale: 1,
746
753
  sinScale: 1,
747
754
  tanScale: 1
748
- },
749
- channelMix: AudioOutputData.mono
755
+ }
750
756
  });
751
757
 
752
758
  // src/util/functions/utils.ts
@@ -853,6 +859,24 @@ function isUnresolvedTrack(track) {
853
859
  function isValid(value) {
854
860
  return typeof value !== "undefined" && value !== null;
855
861
  }
862
+ function stringify(value, space) {
863
+ const seen = /* @__PURE__ */ new WeakSet();
864
+ return JSON.stringify(
865
+ value,
866
+ (_, value2) => {
867
+ if (typeof value2 === "function") return void 0;
868
+ if (typeof value2 === "symbol") return void 0;
869
+ if (typeof value2 === "bigint") return value2.toString();
870
+ if (typeof value2 === "object" && value2 !== null) {
871
+ if (seen.has(value2)) return void 0;
872
+ seen.add(value2);
873
+ return value2;
874
+ }
875
+ return value2;
876
+ },
877
+ space
878
+ );
879
+ }
856
880
  function isNode(options) {
857
881
  return typeof options.host === "string" && typeof options.port === "number" && typeof options.password === "string" && (typeof options.id === "string" || typeof options.id === "undefined") && (typeof options.secure === "boolean" || typeof options.secure === "undefined") && (typeof options.sessionId === "string" || typeof options.sessionId === "undefined") && (typeof options.retryAmount === "number" || typeof options.retryAmount === "undefined") && (typeof options.retryDelay === "number" || typeof options.retryDelay === "undefined");
858
882
  }
@@ -1086,7 +1110,7 @@ var NodeManager = class {
1086
1110
  /**
1087
1111
  *
1088
1112
  * Delete the node.
1089
- * @param {string} id The id of the node to delete.
1113
+ * @param {NodeIdentifier} node The node or node id to delete.
1090
1114
  * @returns {boolean} If the node was deleted.
1091
1115
  * @example
1092
1116
  * ```ts
@@ -1094,23 +1118,122 @@ var NodeManager = class {
1094
1118
  * if (node) manager.nodeManager.delete(node.id); // true if the node was deleted
1095
1119
  * ```
1096
1120
  */
1097
- delete(id) {
1121
+ delete(node) {
1122
+ const id = typeof node === "string" ? node : node.id;
1098
1123
  return this.nodes.delete(id);
1099
1124
  }
1100
1125
  /**
1101
1126
  *
1102
1127
  * Get the node by id.
1103
- * @param {string} id The id of the node.
1128
+ * @param {NodeIdentifier} node The node or node id to get.
1104
1129
  * @returns {NodeStructure | undefined} The node or undefined if not found.
1105
1130
  * @example
1106
1131
  * ```ts
1107
1132
  * const node = manager.nodeManager.get("node1");
1108
- * if (node) console.log(node.id); // node1
1133
+ * if (node) {
1134
+ * console.log(node.id); // node1
1135
+ * } else {
1136
+ * console.log("Node not found");
1137
+ * }
1109
1138
  * ```
1110
1139
  */
1111
- get(id) {
1140
+ get(node) {
1141
+ const id = typeof node === "string" ? node : node.id;
1112
1142
  return this.nodes.get(id);
1113
1143
  }
1144
+ /**
1145
+ *
1146
+ * Create a new node.
1147
+ * @param {NodeOptions} options The options for the node.
1148
+ * @returns {NodeStructure} The created node.
1149
+ * @example
1150
+ * ```ts
1151
+ * const node = manager.nodeManager.create({
1152
+ * host: "localhost",
1153
+ * port: 2333,
1154
+ * password: "password",
1155
+ * secure: false,
1156
+ * });
1157
+ *
1158
+ * console.log(node.id); // localhost:2333
1159
+ */
1160
+ create(options) {
1161
+ options.id ??= `${options.host}:${options.port}`;
1162
+ const oldNode = this.nodes.get(options.id);
1163
+ if (oldNode) return oldNode;
1164
+ const node = Structures.Node(this, options);
1165
+ this.nodes.set(node.id, node);
1166
+ this.manager.emit("nodeCreate" /* NodeCreate */, node);
1167
+ return node;
1168
+ }
1169
+ /**
1170
+ *
1171
+ * Destroy a node.
1172
+ * @param {NodeIdentifier} node The node or node id to destroy.
1173
+ * @returns {void}
1174
+ * @example
1175
+ * ```ts
1176
+ * const node = manager.nodeManager.get("node1");
1177
+ * if (node) node.destroy();
1178
+ * ```
1179
+ */
1180
+ destroy(node) {
1181
+ const id = typeof node === "string" ? node : node.id;
1182
+ const target = this.nodes.get(id);
1183
+ if (!target) return;
1184
+ target.destroy();
1185
+ }
1186
+ /**
1187
+ *
1188
+ * Reconnect a node.
1189
+ * @param {NodeIdentifier} node The node or node id to reconnect.
1190
+ * @returns {void}
1191
+ * @example
1192
+ * ```ts
1193
+ * const node = manager.nodeManager.get("node1");
1194
+ * if (node) node.reconnect();
1195
+ * ```
1196
+ */
1197
+ reconnect(node) {
1198
+ const id = typeof node === "string" ? node : node.id;
1199
+ const target = this.nodes.get(id);
1200
+ if (!target) return;
1201
+ target.reconnect();
1202
+ }
1203
+ /**
1204
+ *
1205
+ * Disconnect a node.
1206
+ * @param {NodeIdentifier} node The node or node id to disconnect.
1207
+ * @returns {void}
1208
+ * @example
1209
+ * ```ts
1210
+ * const node = manager.nodeManager.get("node1");
1211
+ * if (node) node.disconnect();
1212
+ * ```
1213
+ */
1214
+ disconnect(node) {
1215
+ const id = typeof node === "string" ? node : node.id;
1216
+ const target = this.nodes.get(id);
1217
+ if (!target) return;
1218
+ target.disconnect();
1219
+ }
1220
+ /**
1221
+ *
1222
+ * Connect a node.
1223
+ * @param {NodeIdentifier} node The node or node id to connect.
1224
+ * @returns {void}
1225
+ * @example
1226
+ * ```ts
1227
+ * const node = manager.nodeManager.get("node1");
1228
+ * if (node) node.connect();
1229
+ * ```
1230
+ */
1231
+ connect(node) {
1232
+ const id = typeof node === "string" ? node : node.id;
1233
+ const target = this.nodes.get(id);
1234
+ if (!target) return;
1235
+ target.connect();
1236
+ }
1114
1237
  /**
1115
1238
  *
1116
1239
  * Get the least used node.
@@ -1153,31 +1276,6 @@ var NodeManager = class {
1153
1276
  });
1154
1277
  }
1155
1278
  }
1156
- /**
1157
- *
1158
- * Create a new node.
1159
- * @param {NodeOptions} options The options for the node.
1160
- * @returns {NodeStructure} The created node.
1161
- * @example
1162
- * ```ts
1163
- * const node = manager.nodeManager.create({
1164
- * host: "localhost",
1165
- * port: 2333,
1166
- * password: "password",
1167
- * secure: false,
1168
- * });
1169
- *
1170
- * console.log(node.id); // localhost:2333
1171
- */
1172
- create(options) {
1173
- options.id ??= `${options.host}:${options.port}`;
1174
- const oldNode = this.nodes.get(options.id);
1175
- if (oldNode) return oldNode;
1176
- const node = Structures.Node(this, options);
1177
- this.nodes.set(node.id, node);
1178
- this.manager.emit("nodeCreate" /* NodeCreate */, node);
1179
- return node;
1180
- }
1181
1279
  /**
1182
1280
  *
1183
1281
  * Reconnect the nodes.
@@ -1185,10 +1283,10 @@ var NodeManager = class {
1185
1283
  * @example
1186
1284
  * ```ts
1187
1285
  * const node = manager.nodeManager.get("node1");
1188
- * if (node) node.reconnect();
1286
+ * if (node) node.reconnectAll();
1189
1287
  * ```
1190
1288
  */
1191
- reconnect() {
1289
+ reconnectAll() {
1192
1290
  if (!this.nodes.size) return;
1193
1291
  for (const node of this.nodes.filter((node2) => node2.state !== 2 /* Connected */)) {
1194
1292
  node.reconnect();
@@ -1200,10 +1298,10 @@ var NodeManager = class {
1200
1298
  * @example
1201
1299
  * ```ts
1202
1300
  * const node = manager.nodeManager.get("node1");
1203
- * if (node) node.disconnect();
1301
+ * if (node) node.disconnectAll();
1204
1302
  * ```
1205
1303
  */
1206
- disconnect() {
1304
+ disconnectAll() {
1207
1305
  if (!this.nodes.size) return;
1208
1306
  for (const node of this.nodes.filter((node2) => node2.state !== 3 /* Disconnected */)) {
1209
1307
  node.disconnect();
@@ -1218,7 +1316,7 @@ var NodeManager = class {
1218
1316
  * if (node) node.connect();
1219
1317
  * ```
1220
1318
  */
1221
- connect() {
1319
+ connectAll() {
1222
1320
  if (!this.nodes.size) return;
1223
1321
  for (const node of this.nodes.filter((node2) => node2.state !== 2 /* Connected */)) {
1224
1322
  node.connect();
@@ -1233,7 +1331,7 @@ var NodeManager = class {
1233
1331
  * if (node) node.destroy();
1234
1332
  * ```
1235
1333
  */
1236
- destroy() {
1334
+ destroyAll() {
1237
1335
  if (!this.nodes.size) return;
1238
1336
  for (const node of this.nodes.values()) {
1239
1337
  node.destroy();
@@ -1399,7 +1497,7 @@ async function playerUpdate(payload) {
1399
1497
  this.nodeManager.manager.emit(
1400
1498
  "debug" /* Debug */,
1401
1499
  2 /* Node */,
1402
- `[Player] -> [Update] Player updated: ${player.guildId} | Payload: ${JSON.stringify(payload)}`
1500
+ `[Player] -> [Update] Player updated: ${player.guildId} | Payload: ${stringify(payload)}`
1403
1501
  );
1404
1502
  }
1405
1503
  async function lyricsFound(track, payload) {
@@ -1407,7 +1505,7 @@ async function lyricsFound(track, payload) {
1407
1505
  this.manager.emit(
1408
1506
  "debug" /* Debug */,
1409
1507
  3 /* Player */,
1410
- `[Player] -> [Lyrics] The lyrics have been found: ${this.guildId} | Payload: ${JSON.stringify(payload)}`
1508
+ `[Player] -> [Lyrics] The lyrics have been found: ${this.guildId} | Payload: ${stringify(payload)}`
1411
1509
  );
1412
1510
  }
1413
1511
  async function lyricsLine(track, payload) {
@@ -1415,7 +1513,7 @@ async function lyricsLine(track, payload) {
1415
1513
  this.manager.emit(
1416
1514
  "debug" /* Debug */,
1417
1515
  3 /* Player */,
1418
- `[Player] -> [Lyrics] The lyrics line has been found: ${this.guildId} | Payload: ${JSON.stringify(payload)}`
1516
+ `[Player] -> [Lyrics] The lyrics line has been found: ${this.guildId} | Payload: ${stringify(payload)}`
1419
1517
  );
1420
1518
  }
1421
1519
  async function lyricsNotFound(track, payload) {
@@ -1423,7 +1521,7 @@ async function lyricsNotFound(track, payload) {
1423
1521
  this.manager.emit(
1424
1522
  "debug" /* Debug */,
1425
1523
  3 /* Player */,
1426
- `[Player] -> [Lyrics] The lyrics were not found: ${this.guildId} | Payload: ${JSON.stringify(payload)}`
1524
+ `[Player] -> [Lyrics] The lyrics were not found: ${this.guildId} | Payload: ${stringify(payload)}`
1427
1525
  );
1428
1526
  }
1429
1527
  async function socketClosed(payload) {
@@ -1431,7 +1529,7 @@ async function socketClosed(payload) {
1431
1529
  this.manager.emit(
1432
1530
  "debug" /* Debug */,
1433
1531
  3 /* Player */,
1434
- `[Player] -> [Socket] The socket has closed: ${this.guildId} | Payload: ${JSON.stringify(payload)}`
1532
+ `[Player] -> [Socket] The socket has closed: ${this.guildId} | Payload: ${stringify(payload)}`
1435
1533
  );
1436
1534
  }
1437
1535
 
@@ -1581,11 +1679,7 @@ async function onMessage(message) {
1581
1679
  break;
1582
1680
  }
1583
1681
  }
1584
- this.nodeManager.manager.emit(
1585
- "debug" /* Debug */,
1586
- 2 /* Node */,
1587
- `[Socket] -> [${this.id}]: Received payload: ${JSON.stringify(payload)}`
1588
- );
1682
+ this.nodeManager.manager.emit("debug" /* Debug */, 2 /* Node */, `[Socket] -> [${this.id}]: Received payload: ${stringify(payload)}`);
1589
1683
  } catch (error) {
1590
1684
  this.nodeManager.manager.emit("nodeError" /* NodeError */, this, error);
1591
1685
  }
@@ -1720,7 +1814,7 @@ var Node = class {
1720
1814
  const raw = await this.rest.request({
1721
1815
  endpoint: "/decodetracks",
1722
1816
  method: "POST" /* Post */,
1723
- body: JSON.stringify(tracks)
1817
+ body: stringify(tracks)
1724
1818
  }) ?? [];
1725
1819
  return raw.map((track) => new Track(track, requester));
1726
1820
  }
@@ -1817,6 +1911,7 @@ var Node = class {
1817
1911
  * ```
1818
1912
  */
1819
1913
  connect() {
1914
+ if (this.state === 2 /* Connected */ || this.state === 1 /* Connecting */) return;
1820
1915
  if (!this.nodeManager.manager.options.client)
1821
1916
  throw new NodeError({
1822
1917
  message: "No valid client data provided.",
@@ -1851,7 +1946,7 @@ var Node = class {
1851
1946
  this.nodeManager.manager.emit(
1852
1947
  "debug" /* Debug */,
1853
1948
  2 /* Node */,
1854
- `[Socket] -> [${this.id}]: Connecting to ${this.address} | State: ${this.state} | Session: ${this.sessionId} | Resumed: ${this.session.resuming} | Penalties: ${this.penalties} | Reconnects: ${this.retryAmount} | Headers: ${JSON.stringify(headers)}`
1949
+ `[Socket] -> [${this.id}]: Connecting to ${this.address} | State: ${this.state} | Session: ${this.sessionId} | Resumed: ${this.session.resuming} | Penalties: ${this.penalties} | Reconnects: ${this.retryAmount} | Headers: ${stringify(headers)}`
1855
1950
  );
1856
1951
  }
1857
1952
  /**
@@ -1992,6 +2087,7 @@ var Node = class {
1992
2087
  * ```
1993
2088
  */
1994
2089
  reconnect() {
2090
+ if (this.state === 3 /* Disconnected */ || this.state === 6 /* Destroyed */) return;
1995
2091
  this.state = 7 /* Idle */;
1996
2092
  this.nodeManager.manager.emit("nodeReconnecting" /* NodeReconnecting */, this, this.retryAmount, this.retryDelay);
1997
2093
  this.reconnectTimeout = setTimeout(() => {
@@ -2128,7 +2224,7 @@ var Rest = class {
2128
2224
  */
2129
2225
  constructor(node) {
2130
2226
  const manager = node.nodeManager.manager;
2131
- this.url = `${node.options.secure ? "https" : "http"}://${node.options.host}:${node.options.port}/${this.version}`;
2227
+ this.url = `${node.options.secure ? "https" : "http"}://${node.options.host}:${node.options.port}`;
2132
2228
  this.restTimeout = node.options.restTimeout ?? manager.options.restOptions.resumeTimeout ?? 1e4;
2133
2229
  this.userAgent = manager.options.nodeOptions.userAgent ?? HoshimiAgent;
2134
2230
  this.node = node;
@@ -2161,7 +2257,9 @@ var Rest = class {
2161
2257
  Authorization: this.node.options.password
2162
2258
  };
2163
2259
  options.method ??= "GET" /* Get */;
2164
- const url = new URL(`${this.url}${options.endpoint}`);
2260
+ options.pathType ??= "/v4" /* V4 */;
2261
+ const path = `${options.pathType}${options.endpoint}`.replace(/\/+/g, "/");
2262
+ const url = new URL(`${this.url}${path}`);
2165
2263
  if (options.params) {
2166
2264
  for (const [key, value] of Object.entries(options.params)) {
2167
2265
  url.searchParams.append(key, value);
@@ -2177,12 +2275,12 @@ var Rest = class {
2177
2275
  };
2178
2276
  if (!["GET" /* Get */, "HEAD" /* Head */].includes(options.method) && options.body) {
2179
2277
  if (typeof options.body === "string") fetchOptions.body = options.body;
2180
- else fetchOptions.body = JSON.stringify(options.body);
2278
+ else fetchOptions.body = stringify(options.body);
2181
2279
  }
2182
2280
  this.node.nodeManager.manager.emit(
2183
2281
  "debug" /* Debug */,
2184
2282
  4 /* Rest */,
2185
- `[Rest] -> [${this.node.id} : ${options.method}]: Url: ${this.restUrl} | Endpoint: ${options.endpoint} | Params: ${url.search} | Body: ${options.body ? JSON.stringify(options.body) : "None"} | Headers: ${JSON.stringify(headers)}`
2283
+ `[Rest] -> [${this.node.id} : ${options.method}]: Url: ${this.restUrl} | Endpoint: ${options.endpoint} | Params: ${url.search} | Body: ${options.body ? stringify(options.body) : "None"} | Headers: ${stringify(headers)}`
2186
2284
  );
2187
2285
  const response = await fetch(url.toString(), fetchOptions).finally(() => clearTimeout(timeout));
2188
2286
  if (!response.ok) {
@@ -2224,7 +2322,7 @@ var Rest = class {
2224
2322
  this.node.nodeManager.manager.emit(
2225
2323
  "debug" /* Debug */,
2226
2324
  4 /* Rest */,
2227
- `[Rest] -> [${this.node.id}]: Updated player data for guild: ${data.guildId} | Payload: ${JSON.stringify(data)}`
2325
+ `[Rest] -> [${this.node.id}]: Updated player data for guild: ${data.guildId} | Payload: ${stringify(data)}`
2228
2326
  );
2229
2327
  validatePlayerData.call(this.node, data);
2230
2328
  return this.request({
@@ -2329,7 +2427,7 @@ var DSPXPluginFilter = class {
2329
2427
  *
2330
2428
  * Set the low-pass filter with the given settings.
2331
2429
  * @param {FilterPluginPassSettings} [settings=DefaultFilter.DSPXLowPass] The settings for the low-pass filter.
2332
- * @returns {Promise<boolean>} Whether the filter is now active.
2430
+ * @returns {Promise<this>} The instance of the filter manager.
2333
2431
  */
2334
2432
  async setLowPass(settings = DefaultFilterPreset.DSPXLowPass) {
2335
2433
  validateNodePlugins(this.manager.player.node, ["lavadspx-plugin" /* LavaDspx */]);
@@ -2345,13 +2443,13 @@ var DSPXPluginFilter = class {
2345
2443
  }
2346
2444
  this.manager.filters.lavalinkLavaDspxPlugin.lowPass = !this.manager.filters.lavalinkLavaDspxPlugin.lowPass;
2347
2445
  await this.manager.apply();
2348
- return this.manager.filters.lavalinkLavaDspxPlugin.lowPass;
2446
+ return this;
2349
2447
  }
2350
2448
  /**
2351
2449
  *
2352
2450
  * Set the high-pass filter with the given settings.
2353
2451
  * @param {FilterPluginPassSettings} [settings=DefaultFilter.DSPXHighPass] The settings for the high-pass filter.
2354
- * @returns {Promise<boolean>} Whether the filter is now active.
2452
+ * @returns {Promise<this>} The instance of the filter manager.
2355
2453
  */
2356
2454
  async setHighPass(settings = DefaultFilterPreset.DSPXHighPass) {
2357
2455
  validateNodePlugins(this.manager.player.node, ["lavadspx-plugin" /* LavaDspx */]);
@@ -2367,13 +2465,13 @@ var DSPXPluginFilter = class {
2367
2465
  }
2368
2466
  this.manager.filters.lavalinkLavaDspxPlugin.highPass = !this.manager.filters.lavalinkLavaDspxPlugin.highPass;
2369
2467
  await this.manager.apply();
2370
- return this.manager.filters.lavalinkLavaDspxPlugin.highPass;
2468
+ return this;
2371
2469
  }
2372
2470
  /**
2373
2471
  *
2374
2472
  * Set the normalization filter with the given settings.
2375
2473
  * @param {NormalizationSettings} [settings=DefaultFilter.DSPXNormalization] The settings for the normalization filter.
2376
- * @returns {Promise<boolean>} Whether the filter is now active.
2474
+ * @returns {Promise<this>} The instance of the filter manager.
2377
2475
  */
2378
2476
  async setNormalization(settings = DefaultFilterPreset.DSPXNormalization) {
2379
2477
  validateNodePlugins(this.manager.player.node, ["lavadspx-plugin" /* LavaDspx */]);
@@ -2389,13 +2487,13 @@ var DSPXPluginFilter = class {
2389
2487
  }
2390
2488
  this.manager.filters.lavalinkLavaDspxPlugin.normalization = !this.manager.filters.lavalinkLavaDspxPlugin.normalization;
2391
2489
  await this.manager.apply();
2392
- return this.manager.filters.lavalinkLavaDspxPlugin.normalization;
2490
+ return this;
2393
2491
  }
2394
2492
  /**
2395
2493
  *
2396
2494
  * Set the echo filter with the given settings.
2397
2495
  * @param {EchoSettings} [settings=DefaultFilter.DSPXEcho] The settings for the echo filter.
2398
- * @returns {Promise<boolean>} Whether the filter is now active.
2496
+ * @returns {Promise<this>} The instance of the filter manager.
2399
2497
  */
2400
2498
  async setEcho(settings = DefaultFilterPreset.DSPXEcho) {
2401
2499
  validateNodePlugins(this.manager.player.node, ["lavadspx-plugin" /* LavaDspx */]);
@@ -2411,7 +2509,7 @@ var DSPXPluginFilter = class {
2411
2509
  }
2412
2510
  this.manager.filters.lavalinkLavaDspxPlugin.echo = !this.manager.filters.lavalinkLavaDspxPlugin.echo;
2413
2511
  await this.manager.apply();
2414
- return this.manager.filters.lavalinkLavaDspxPlugin.echo;
2512
+ return this;
2415
2513
  }
2416
2514
  };
2417
2515
 
@@ -2435,7 +2533,7 @@ var LavalinkPluginFilter = class {
2435
2533
  *
2436
2534
  * Set the echo filter with the given settings.
2437
2535
  * @param {Omit<EchoSettings, "echoLength">} [settings=DefaultFilter.PluginEcho] The settings for the echo filter.
2438
- * @returns {Promise<boolean>} Whether the filter is now active.
2536
+ * @returns {Promise<this>} The instance of the filter manager.
2439
2537
  */
2440
2538
  async setEcho(settings = DefaultFilterPreset.PluginEcho) {
2441
2539
  validateNodePlugins(this.manager.player.node, ["lavalink-filter-plugin" /* FilterPlugin */]);
@@ -2451,13 +2549,13 @@ var LavalinkPluginFilter = class {
2451
2549
  this.manager.data.pluginFilters["lavalink-filter-plugin"].echo.decay = this.manager.filters.lavalinkFilterPlugin.echo ? 0 : settings.decay;
2452
2550
  this.manager.filters.lavalinkFilterPlugin.echo = !this.manager.filters.lavalinkFilterPlugin.echo;
2453
2551
  await this.manager.apply();
2454
- return this.manager.filters.lavalinkFilterPlugin.echo;
2552
+ return this;
2455
2553
  }
2456
2554
  /**
2457
2555
  *
2458
2556
  * Set the reverb filter with the given settings.
2459
2557
  * @param {Partial<LavalinkFilterPluginReverbSettings>} [settings=DefaultFilter.PluginReverb] The settings for the reverb filter.
2460
- * @returns {Promise<boolean>} Whether the filter is now active.
2558
+ * @returns {Promise<this>} The instance of the filter manager.
2461
2559
  */
2462
2560
  async setReverb(settings = DefaultFilterPreset.PluginReverb) {
2463
2561
  validateNodePlugins(this.manager.player.node, ["lavalink-filter-plugin" /* FilterPlugin */]);
@@ -2473,7 +2571,7 @@ var LavalinkPluginFilter = class {
2473
2571
  this.manager.data.pluginFilters["lavalink-filter-plugin"].reverb.gains = this.manager.filters.lavalinkFilterPlugin.reverb ? [] : settings.gains;
2474
2572
  this.manager.filters.lavalinkFilterPlugin.reverb = !this.manager.filters.lavalinkFilterPlugin.reverb;
2475
2573
  await this.manager.apply();
2476
- return this.manager.filters.lavalinkFilterPlugin.reverb;
2574
+ return this;
2477
2575
  }
2478
2576
  };
2479
2577
 
@@ -2548,18 +2646,9 @@ var FilterManager = class {
2548
2646
  this.plugin = new LavalinkPluginFilter(this);
2549
2647
  this.dspx = new DSPXPluginFilter(this);
2550
2648
  }
2551
- /**
2552
- *
2553
- * Checks if a custom filter is active.
2554
- * @returns {boolean} True if a custom filter is active, false otherwise.
2555
- */
2556
- isCustom() {
2557
- this.filters.custom = !this.filters.nightcore && !this.filters.vaporwave && Object.values(this.data.timescale ?? {}).some((d) => d !== 1);
2558
- return this.filters.custom;
2559
- }
2560
2649
  /**
2561
2650
  * Resets all filters to their default values.
2562
- * @returns {Promise<void>} A promise that resolves when the filters have been reset.
2651
+ * @returns {Promise<this>} A promise that resolves to the instance of the filter manager.
2563
2652
  */
2564
2653
  async reset() {
2565
2654
  this.filters = {
@@ -2586,20 +2675,17 @@ var FilterManager = class {
2586
2675
  echo: false
2587
2676
  }
2588
2677
  };
2589
- for (const [key, value] of Object.entries(DefaultPlayerFilters)) {
2590
- this.data[key] = value;
2591
- }
2592
- await this.apply();
2678
+ this.data = { ...DefaultPlayerFilters };
2679
+ return this.apply();
2593
2680
  }
2594
2681
  /**
2595
2682
  *
2596
2683
  * Applies the current filters to the player.
2597
- * @returns {Promise<void>} A promise that resolves when the filters have been applied.
2684
+ * @returns {Promise<this>} A promise that resolves to the instance of the filter manager.
2598
2685
  */
2599
2686
  async apply() {
2600
- if (!this.player.node.sessionId) return;
2687
+ if (!this.player.node.sessionId) return this;
2601
2688
  this.check();
2602
- this.isCustom();
2603
2689
  const filters = { ...this.data };
2604
2690
  if (!this.filters.volume) delete filters.volume;
2605
2691
  if (!this.filters.tremolo) delete filters.tremolo;
@@ -2626,6 +2712,7 @@ var FilterManager = class {
2626
2712
  if (!this.player.node.info?.filters?.includes(key)) delete filters[key];
2627
2713
  }
2628
2714
  await this.player.updatePlayer({ playerOptions: { filters } });
2715
+ return this;
2629
2716
  }
2630
2717
  /**
2631
2718
  * Checks if the current filters are active.
@@ -2647,6 +2734,7 @@ var FilterManager = class {
2647
2734
  this.filters.karaoke = Object.values(this.data.karaoke ?? {}).some((v) => v !== 0);
2648
2735
  this.filters.distortion = Object.values(this.data.distortion ?? {}).some((v) => v !== 0 && v !== 1);
2649
2736
  this.filters.timescale = Object.values(this.data.timescale ?? {}).some((v) => v !== 1);
2737
+ this.filters.custom = !this.filters.nightcore && !this.filters.vaporwave && Object.values(this.data.timescale ?? {}).some((d) => d !== 1);
2650
2738
  if ((this.filters.nightcore || this.filters.vaporwave) && timescale) {
2651
2739
  if (timescale.pitch !== this.data.timescale?.pitch || timescale.rate !== this.data.timescale?.rate || timescale.speed !== this.data.timescale?.speed) {
2652
2740
  this.filters.custom = Object.values(this.data.timescale ?? {}).some((v) => v !== 1);
@@ -2675,34 +2763,32 @@ var FilterManager = class {
2675
2763
  *
2676
2764
  * Sets the volume for the player.
2677
2765
  * @param {number} volume The volume level to set (between 0 and 5).
2678
- * @returns {Promise<boolean>} A promise that resolves to true if the volume was changed, false otherwise.
2766
+ * @returns {Promise<this>} A promise that resolves to the player instance.
2679
2767
  */
2680
2768
  async setVolume(volume) {
2681
2769
  if (typeof volume !== "number" || Number.isNaN(volume) || volume < 0 || volume > 5)
2682
2770
  throw new PlayerError("Volume must be a number between 0 and 5.");
2683
2771
  this.data = { volume };
2684
2772
  this.filters.volume = volume !== 1;
2685
- await this.apply();
2686
- return this.filters.volume;
2773
+ return this.apply();
2687
2774
  }
2688
2775
  /**
2689
2776
  * Sets the audio output for the player.
2690
2777
  * @param {AudioOutput} output The audio output to set.
2691
- * @returns {Promise<AudioOutput>} A promise that resolves to the set audio output.
2778
+ * @returns {Promise<this>} A promise that resolves to the player instance.
2692
2779
  */
2693
2780
  async setAudioOutput(output) {
2694
2781
  const outputs = Object.values(AudioOutput);
2695
2782
  if (!outputs.includes(output)) throw new PlayerError(`Audio output must be one of the following: ${outputs.join(", ")}.`);
2696
2783
  this.filters.audioOutput = output;
2697
2784
  this.data.channelMix = AudioOutputData[output];
2698
- await this.apply();
2699
- return this.filters.audioOutput;
2785
+ return this.apply();
2700
2786
  }
2701
2787
  /**
2702
2788
  *
2703
2789
  * Sets the speed for the player.
2704
2790
  * @param {number} speed The speed to set (default is 1).
2705
- * @returns {Promise<boolean>} A promise that resolves to true if a custom filter is active, false otherwise.
2791
+ * @returns {Promise<this>} A promise that resolves to the player instance.
2706
2792
  */
2707
2793
  async setSpeed(speed = 1) {
2708
2794
  if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
@@ -2717,14 +2803,13 @@ var FilterManager = class {
2717
2803
  this.filters.vaporwave = false;
2718
2804
  }
2719
2805
  this.data.timescale.speed = speed;
2720
- await this.apply();
2721
- return this.filters.custom;
2806
+ return this.apply();
2722
2807
  }
2723
2808
  /**
2724
2809
  *
2725
2810
  * Sets the rate for the player.
2726
2811
  * @param {number} rate The rate to set (default is 1).
2727
- * @returns {Promise<boolean>} A promise that resolves to true if a custom filter is active, false otherwise.
2812
+ * @returns {Promise<this>} A promise that resolves to the player instance.
2728
2813
  */
2729
2814
  async setRate(rate = 1) {
2730
2815
  if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
@@ -2739,14 +2824,13 @@ var FilterManager = class {
2739
2824
  this.filters.vaporwave = false;
2740
2825
  }
2741
2826
  this.data.timescale.rate = rate;
2742
- await this.apply();
2743
- return this.filters.custom;
2827
+ return this.apply();
2744
2828
  }
2745
2829
  /**
2746
2830
  *
2747
2831
  * Sets the pitch for the player.
2748
2832
  * @param {number} pitch The pitch
2749
- * @returns {Promise<boolean>} A promise that resolves to true if a custom filter is active, false otherwise.
2833
+ * @returns {Promise<this>} A promise that resolves to the player instance.
2750
2834
  */
2751
2835
  async setPitch(pitch = 1) {
2752
2836
  if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
@@ -2761,8 +2845,7 @@ var FilterManager = class {
2761
2845
  this.filters.vaporwave = false;
2762
2846
  }
2763
2847
  this.data.timescale.pitch = pitch;
2764
- await this.apply();
2765
- return this.filters.custom;
2848
+ return this.apply();
2766
2849
  }
2767
2850
  /**
2768
2851
  *
@@ -2775,8 +2858,7 @@ var FilterManager = class {
2775
2858
  if (!bands.length || !bands.every((band) => typeof band.band === "number" && typeof band.gain === "number"))
2776
2859
  throw new PlayerError("Bands must be a non-empty object array containing 'band' and 'gain' properties.");
2777
2860
  for (const { band, gain } of bands) this.bands[band] = { band, gain };
2778
- await this.apply();
2779
- return this;
2861
+ return this.apply();
2780
2862
  }
2781
2863
  /**
2782
2864
  *
@@ -2790,7 +2872,7 @@ var FilterManager = class {
2790
2872
  *
2791
2873
  * Set the vibrato filter with the given settings.
2792
2874
  * @param {TremoloSettings} [settings=DefaultFilterPreset.Vibrato] The settings for the vibrato filter.
2793
- * @returns {Promise<boolean>} Whether the filter is now active.
2875
+ * @returns {Promise<this>} The instance of the filter manager.
2794
2876
  */
2795
2877
  async setVibrato(settings = DefaultFilterPreset.Vibrato) {
2796
2878
  if (!this.player.node.info?.filters?.includes("vibrato" /* Vibrato */))
@@ -2800,14 +2882,13 @@ var FilterManager = class {
2800
2882
  depth: this.filters.vibrato ? 0 : settings.depth
2801
2883
  };
2802
2884
  this.filters.vibrato = !this.filters.vibrato;
2803
- await this.apply();
2804
- return this.filters.vibrato;
2885
+ return this.apply();
2805
2886
  }
2806
2887
  /**
2807
2888
  *
2808
2889
  * Set the tremolo filter with the given settings.
2809
2890
  * @param {TremoloSettings} [settings=DefaultFilterPreset.Tremolo] The settings for the tremolo filter.
2810
- * @returns {Promise<boolean>} Whether the filter is now active.
2891
+ * @returns {Promise<this>} The instance of the filter manager.
2811
2892
  */
2812
2893
  async setTremolo(settings = DefaultFilterPreset.Tremolo) {
2813
2894
  if (!this.player.node.info?.filters?.includes("tremolo" /* Tremolo */))
@@ -2817,27 +2898,25 @@ var FilterManager = class {
2817
2898
  depth: this.filters.tremolo ? 0 : settings.depth
2818
2899
  };
2819
2900
  this.filters.tremolo = !this.filters.tremolo;
2820
- await this.apply();
2821
- return this.filters.tremolo;
2901
+ return this.apply();
2822
2902
  }
2823
2903
  /**
2824
2904
  *
2825
2905
  * Set the low-pass filter with the given settings.
2826
2906
  * @param {LowPassSettings} [settings=DefaultFilterPreset.Lowpass] The settings for the low-pass filter.
2827
- * @returns {Promise<boolean>} Whether the filter is now active.
2907
+ * @returns {Promise<this>} The instance of the filter manager.
2828
2908
  */
2829
2909
  async setLowPass(settings = DefaultFilterPreset.Lowpass) {
2830
2910
  if (!this.player.node.info?.filters?.includes("lowPass" /* LowPass */))
2831
2911
  throw new PlayerError("Node filters does not include the 'lowPass' filter. (Or the node doesn't have it enabled)");
2832
2912
  this.data.lowPass = { smoothing: this.filters.lowPass ? 0 : settings.smoothing };
2833
2913
  this.filters.lowPass = !this.filters.lowPass;
2834
- await this.apply();
2835
- return this.filters.lowPass;
2914
+ return this.apply();
2836
2915
  }
2837
2916
  /**
2838
2917
  * Set the nightcore filter with the given settings.
2839
2918
  * @param {Partial<TimescaleSettings>} [settings=DefaultFilterPreset.Nightcore] The settings for the nightcore filter.
2840
- * @returns {Promise<boolean>} Whether the filter is now active.
2919
+ * @returns {Promise<this>} The instance of the filter manager.
2841
2920
  */
2842
2921
  async setNightcore(settings = DefaultFilterPreset.Nightcore) {
2843
2922
  if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
@@ -2850,14 +2929,13 @@ var FilterManager = class {
2850
2929
  this.filters.nightcore = !this.filters.nightcore;
2851
2930
  this.filters.vaporwave = false;
2852
2931
  this.filters.custom = false;
2853
- await this.apply();
2854
- return this.filters.nightcore;
2932
+ return this.apply();
2855
2933
  }
2856
2934
  /**
2857
2935
  *
2858
2936
  * Set the vaporwave filter with the given settings.
2859
2937
  * @param {Partial<TimescaleSettings>} [settings=DefaultFilterPreset.Vaporwave] The settings for the vaporwave filter.
2860
- * @returns {Promise<boolean>} Whether the filter is now active.
2938
+ * @returns {Promise<this>} The instance of the filter manager.
2861
2939
  */
2862
2940
  async setVaporwave(settings = DefaultFilterPreset.Vaporwave) {
2863
2941
  if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
@@ -2870,14 +2948,13 @@ var FilterManager = class {
2870
2948
  this.filters.vaporwave = !this.filters.vaporwave;
2871
2949
  this.filters.nightcore = false;
2872
2950
  this.filters.custom = false;
2873
- await this.apply();
2874
- return this.filters.vaporwave;
2951
+ return this.apply();
2875
2952
  }
2876
2953
  /**
2877
2954
  *
2878
2955
  * Set the karaoke filter with the given settings.
2879
2956
  * @param {KaraokeSettings} [settings=DefaultFilterPreset.Karaoke] The settings for the karaoke filter.
2880
- * @returns {Promise<boolean>} Whether the filter is now active.
2957
+ * @returns {Promise<this>} The instance of the filter manager.
2881
2958
  */
2882
2959
  async setKaraoke(settings = DefaultFilterPreset.Karaoke) {
2883
2960
  if (!this.player.node.info?.filters?.includes("karaoke" /* Karaoke */))
@@ -2889,14 +2966,13 @@ var FilterManager = class {
2889
2966
  filterWidth: this.data.karaoke.filterWidth ? 0 : settings.filterWidth
2890
2967
  };
2891
2968
  this.filters.karaoke = !this.filters.karaoke;
2892
- await this.apply();
2893
- return this.filters.karaoke;
2969
+ return this.apply();
2894
2970
  }
2895
2971
  /**
2896
2972
  *
2897
2973
  * Set the distortion filter with the given settings.
2898
2974
  * @param {Partial<DistortionSettings>} [settings=DefaultFilterPreset.Distortion] The settings for the distortion filter.
2899
- * @returns {Promise<boolean>} Whether the filter is now active.
2975
+ * @returns {Promise<this>} The instance of the filter manager.
2900
2976
  */
2901
2977
  async setDistortion(settings = DefaultFilterPreset.Distortion) {
2902
2978
  if (!this.player.node.info?.filters?.includes("distortion" /* Distortion */))
@@ -2911,13 +2987,12 @@ var FilterManager = class {
2911
2987
  scale: this.filters.distortion ? 1 : settings.scale
2912
2988
  };
2913
2989
  this.filters.distortion = !this.filters.distortion;
2914
- await this.apply();
2915
- return this.filters.distortion;
2990
+ return this.apply();
2916
2991
  }
2917
2992
  /**
2918
2993
  * Set the timescale filter with the given settings.
2919
2994
  * @param {Partial<TimescaleSettings>} settings The timescale settings to set.
2920
- * @returns {Promise<boolean>} Whether the filter is now active.
2995
+ * @returns {Promise<this>} The instance of the filter manager.
2921
2996
  */
2922
2997
  async setTimescale(settings) {
2923
2998
  if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
@@ -2928,8 +3003,7 @@ var FilterManager = class {
2928
3003
  speed: settings.speed ?? 1
2929
3004
  };
2930
3005
  this.filters.timescale = !this.filters.timescale;
2931
- await this.apply();
2932
- return this.filters.timescale;
3006
+ return this.apply();
2933
3007
  }
2934
3008
  };
2935
3009
 
@@ -3689,7 +3763,7 @@ var QueueUtils = class {
3689
3763
  this.queue.player.manager.emit(
3690
3764
  "debug" /* Debug */,
3691
3765
  5 /* Queue */,
3692
- `[Queue] -> [Adapter] Saving queue for ${this.queue.player.guildId} | Object: ${JSON.stringify(json)}`
3766
+ `[Queue] -> [Adapter] Saving queue for ${this.queue.player.guildId} | Object: ${stringify(json)}`
3693
3767
  );
3694
3768
  return this.store.set(this.queue.player.guildId, json);
3695
3769
  }
@@ -3731,7 +3805,7 @@ var QueueUtils = class {
3731
3805
  this.queue.player.manager.emit(
3732
3806
  "debug" /* Debug */,
3733
3807
  5 /* Queue */,
3734
- `[Queue] -> [Adapter] Syncing queue for ${this.queue.player.guildId} | Object: ${JSON.stringify(data)}`
3808
+ `[Queue] -> [Adapter] Syncing queue for ${this.queue.player.guildId} | Object: ${stringify(data)}`
3735
3809
  );
3736
3810
  await this.save();
3737
3811
  }
@@ -4485,7 +4559,7 @@ var Hoshimi = class extends import_node_events.EventEmitter {
4485
4559
  this.emit(
4486
4560
  "debug" /* Debug */,
4487
4561
  1 /* Manager */,
4488
- `[Manager] -> [Search] Searching for: ${options.query} (${options.engine ?? "unknown"}) | Result: ${JSON.stringify(res)}`
4562
+ `[Manager] -> [Search] Searching for: ${options.query} (${options.engine ?? "unknown"}) | Result: ${stringify(res)}`
4489
4563
  );
4490
4564
  switch (res.loadType) {
4491
4565
  case "empty" /* Empty */: {
@@ -4570,6 +4644,7 @@ function createHoshimi(...args) {
4570
4644
  Queue,
4571
4645
  ResolveError,
4572
4646
  Rest,
4647
+ RestPathType,
4573
4648
  SearchEngines,
4574
4649
  Severity,
4575
4650
  SourceNames,