hoshimi 0.2.5 → 0.3.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/index.mjs CHANGED
@@ -250,6 +250,11 @@ var HttpMethods = /* @__PURE__ */ ((HttpMethods2) => {
250
250
  HttpMethods2["Head"] = "HEAD";
251
251
  return HttpMethods2;
252
252
  })(HttpMethods || {});
253
+ var RestPathType = /* @__PURE__ */ ((RestPathType2) => {
254
+ RestPathType2["Raw"] = "/";
255
+ RestPathType2["V4"] = "/v4";
256
+ return RestPathType2;
257
+ })(RestPathType || {});
253
258
  var HttpStatusCodes = /* @__PURE__ */ ((HttpStatusCodes2) => {
254
259
  HttpStatusCodes2[HttpStatusCodes2["OK"] = 200] = "OK";
255
260
  HttpStatusCodes2[HttpStatusCodes2["Created"] = 201] = "Created";
@@ -459,12 +464,12 @@ var UnresolvedTrack = class {
459
464
  // package.json
460
465
  var package_default = {
461
466
  name: "hoshimi",
462
- version: "0.2.5",
467
+ version: "0.3.3",
463
468
  description: "A lavalink@v4 client easy to use, up-to-date and all ears.",
464
469
  main: "./dist/index.js",
465
470
  module: "./dist/index.mjs",
466
471
  types: "./dist/index.d.ts",
467
- packageManager: "pnpm@10.20.0+sha512.cf9998222162dd85864d0a8102e7892e7ba4ceadebbf5a31f9c2fce48dfce317a9c53b9f6464d1ef9042cba2e02ae02a9f7c143a2b438cd93c91840f0192b9dd",
472
+ packageManager: "pnpm@10.25.0+sha512.5e82639027af37cf832061bcc6d639c219634488e0f2baebe785028a793de7b525ffcd3f7ff574f5e9860654e098fe852ba8ac5dd5cefe1767d23a020a92f501",
468
473
  files: [
469
474
  "dist"
470
475
  ],
@@ -500,13 +505,13 @@ var package_default = {
500
505
  author: "Ganyu Studios",
501
506
  license: "MIT",
502
507
  devDependencies: {
503
- "@biomejs/biome": "^2.3.2",
504
- "@types/node": "^24.9.2",
508
+ "@biomejs/biome": "^2.3.8",
509
+ "@types/node": "^25.0.1",
505
510
  "@types/ws": "^8.18.1",
506
511
  husky: "^9.1.7",
507
- "lint-staged": "^16.2.6",
508
- tsup: "^8.5.0",
509
- tsx: "^4.20.6",
512
+ "lint-staged": "^16.2.7",
513
+ tsup: "^8.5.1",
514
+ tsx: "^4.21.0",
510
515
  typescript: "^5.9.3"
511
516
  },
512
517
  dependencies: {
@@ -572,7 +577,7 @@ var ValidSources = new Map(
572
577
  ["pornhub" /* PornHub */]: "phsearch" /* PornHub */
573
578
  })
574
579
  );
575
- var AudioOutputData = {
580
+ var AudioOutputData = Object.freeze({
576
581
  ["mono" /* Mono */]: {
577
582
  leftToLeft: 0.5,
578
583
  leftToRight: 0.5,
@@ -597,7 +602,7 @@ var AudioOutputData = {
597
602
  rightToLeft: 0,
598
603
  rightToRight: 1
599
604
  }
600
- };
605
+ });
601
606
  var DefaultFilterPreset = Object.freeze({
602
607
  Karaoke: { level: 1, monoLevel: 1, filterBand: 220, filterWidth: 100 },
603
608
  Vaporwave: { speed: 0.8500000238418579, pitch: 0.800000011920929, rate: 1 },
@@ -615,6 +620,8 @@ var DefaultFilterPreset = Object.freeze({
615
620
  });
616
621
  var DefaultPlayerFilters = Object.freeze({
617
622
  volume: 1,
623
+ equalizer: [],
624
+ channelMix: AudioOutputData.mono,
618
625
  lowPass: {
619
626
  smoothing: 0
620
627
  },
@@ -669,7 +676,6 @@ var DefaultPlayerFilters = Object.freeze({
669
676
  maxAmplitude: 0
670
677
  }
671
678
  },
672
- equalizer: [],
673
679
  distortion: {
674
680
  cosOffset: 0,
675
681
  sinOffset: 0,
@@ -679,8 +685,7 @@ var DefaultPlayerFilters = Object.freeze({
679
685
  cosScale: 1,
680
686
  sinScale: 1,
681
687
  tanScale: 1
682
- },
683
- channelMix: AudioOutputData.mono
688
+ }
684
689
  });
685
690
 
686
691
  // src/util/functions/utils.ts
@@ -746,7 +751,10 @@ function validatePlayerData(data) {
746
751
  player.playing = !data.playerOptions.paused;
747
752
  }
748
753
  if (typeof data.playerOptions.volume === "number") player.volume = data.playerOptions.volume;
749
- if (typeof data.playerOptions.position === "number") player.position = data.playerOptions.position;
754
+ if (typeof data.playerOptions.position === "number") {
755
+ player.lastPosition = data.playerOptions.position;
756
+ player.lastPositionUpdate = Date.now();
757
+ }
750
758
  }
751
759
  }
752
760
  function validateNodePlugins(node, plugins) {
@@ -787,6 +795,24 @@ function isUnresolvedTrack(track) {
787
795
  function isValid(value) {
788
796
  return typeof value !== "undefined" && value !== null;
789
797
  }
798
+ function stringify(value, space) {
799
+ const seen = /* @__PURE__ */ new WeakSet();
800
+ return JSON.stringify(
801
+ value,
802
+ (_, value2) => {
803
+ if (typeof value2 === "function") return void 0;
804
+ if (typeof value2 === "symbol") return void 0;
805
+ if (typeof value2 === "bigint") return value2.toString();
806
+ if (typeof value2 === "object" && value2 !== null) {
807
+ if (seen.has(value2)) return void 0;
808
+ seen.add(value2);
809
+ return value2;
810
+ }
811
+ return value2;
812
+ },
813
+ space
814
+ );
815
+ }
790
816
  function isNode(options) {
791
817
  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");
792
818
  }
@@ -1020,7 +1046,7 @@ var NodeManager = class {
1020
1046
  /**
1021
1047
  *
1022
1048
  * Delete the node.
1023
- * @param {string} id The id of the node to delete.
1049
+ * @param {NodeIdentifier} node The node or node id to delete.
1024
1050
  * @returns {boolean} If the node was deleted.
1025
1051
  * @example
1026
1052
  * ```ts
@@ -1028,23 +1054,122 @@ var NodeManager = class {
1028
1054
  * if (node) manager.nodeManager.delete(node.id); // true if the node was deleted
1029
1055
  * ```
1030
1056
  */
1031
- delete(id) {
1057
+ delete(node) {
1058
+ const id = typeof node === "string" ? node : node.id;
1032
1059
  return this.nodes.delete(id);
1033
1060
  }
1034
1061
  /**
1035
1062
  *
1036
1063
  * Get the node by id.
1037
- * @param {string} id The id of the node.
1064
+ * @param {NodeIdentifier} node The node or node id to get.
1038
1065
  * @returns {NodeStructure | undefined} The node or undefined if not found.
1039
1066
  * @example
1040
1067
  * ```ts
1041
1068
  * const node = manager.nodeManager.get("node1");
1042
- * if (node) console.log(node.id); // node1
1069
+ * if (node) {
1070
+ * console.log(node.id); // node1
1071
+ * } else {
1072
+ * console.log("Node not found");
1073
+ * }
1043
1074
  * ```
1044
1075
  */
1045
- get(id) {
1076
+ get(node) {
1077
+ const id = typeof node === "string" ? node : node.id;
1046
1078
  return this.nodes.get(id);
1047
1079
  }
1080
+ /**
1081
+ *
1082
+ * Create a new node.
1083
+ * @param {NodeOptions} options The options for the node.
1084
+ * @returns {NodeStructure} The created node.
1085
+ * @example
1086
+ * ```ts
1087
+ * const node = manager.nodeManager.create({
1088
+ * host: "localhost",
1089
+ * port: 2333,
1090
+ * password: "password",
1091
+ * secure: false,
1092
+ * });
1093
+ *
1094
+ * console.log(node.id); // localhost:2333
1095
+ */
1096
+ create(options) {
1097
+ options.id ??= `${options.host}:${options.port}`;
1098
+ const oldNode = this.nodes.get(options.id);
1099
+ if (oldNode) return oldNode;
1100
+ const node = Structures.Node(this, options);
1101
+ this.nodes.set(node.id, node);
1102
+ this.manager.emit("nodeCreate" /* NodeCreate */, node);
1103
+ return node;
1104
+ }
1105
+ /**
1106
+ *
1107
+ * Destroy a node.
1108
+ * @param {NodeIdentifier} node The node or node id to destroy.
1109
+ * @returns {void}
1110
+ * @example
1111
+ * ```ts
1112
+ * const node = manager.nodeManager.get("node1");
1113
+ * if (node) node.destroy();
1114
+ * ```
1115
+ */
1116
+ destroy(node) {
1117
+ const id = typeof node === "string" ? node : node.id;
1118
+ const target = this.nodes.get(id);
1119
+ if (!target) return;
1120
+ target.destroy();
1121
+ }
1122
+ /**
1123
+ *
1124
+ * Reconnect a node.
1125
+ * @param {NodeIdentifier} node The node or node id to reconnect.
1126
+ * @returns {void}
1127
+ * @example
1128
+ * ```ts
1129
+ * const node = manager.nodeManager.get("node1");
1130
+ * if (node) node.reconnect();
1131
+ * ```
1132
+ */
1133
+ reconnect(node) {
1134
+ const id = typeof node === "string" ? node : node.id;
1135
+ const target = this.nodes.get(id);
1136
+ if (!target) return;
1137
+ target.reconnect();
1138
+ }
1139
+ /**
1140
+ *
1141
+ * Disconnect a node.
1142
+ * @param {NodeIdentifier} node The node or node id to disconnect.
1143
+ * @returns {void}
1144
+ * @example
1145
+ * ```ts
1146
+ * const node = manager.nodeManager.get("node1");
1147
+ * if (node) node.disconnect();
1148
+ * ```
1149
+ */
1150
+ disconnect(node) {
1151
+ const id = typeof node === "string" ? node : node.id;
1152
+ const target = this.nodes.get(id);
1153
+ if (!target) return;
1154
+ target.disconnect();
1155
+ }
1156
+ /**
1157
+ *
1158
+ * Connect a node.
1159
+ * @param {NodeIdentifier} node The node or node id to connect.
1160
+ * @returns {void}
1161
+ * @example
1162
+ * ```ts
1163
+ * const node = manager.nodeManager.get("node1");
1164
+ * if (node) node.connect();
1165
+ * ```
1166
+ */
1167
+ connect(node) {
1168
+ const id = typeof node === "string" ? node : node.id;
1169
+ const target = this.nodes.get(id);
1170
+ if (!target) return;
1171
+ target.connect();
1172
+ }
1048
1173
  /**
1049
1174
  *
1050
1175
  * Get the least used node.
@@ -1087,31 +1212,6 @@ var NodeManager = class {
1087
1212
  });
1088
1213
  }
1089
1214
  }
1090
- /**
1091
- *
1092
- * Create a new node.
1093
- * @param {NodeOptions} options The options for the node.
1094
- * @returns {NodeStructure} The created node.
1095
- * @example
1096
- * ```ts
1097
- * const node = manager.nodeManager.create({
1098
- * host: "localhost",
1099
- * port: 2333,
1100
- * password: "password",
1101
- * secure: false,
1102
- * });
1103
- *
1104
- * console.log(node.id); // localhost:2333
1105
- */
1106
- create(options) {
1107
- options.id ??= `${options.host}:${options.port}`;
1108
- const oldNode = this.nodes.get(options.id);
1109
- if (oldNode) return oldNode;
1110
- const node = Structures.Node(this, options);
1111
- this.nodes.set(node.id, node);
1112
- this.manager.emit("nodeCreate" /* NodeCreate */, node);
1113
- return node;
1114
- }
1115
1215
  /**
1116
1216
  *
1117
1217
  * Reconnect the nodes.
@@ -1119,10 +1219,10 @@ var NodeManager = class {
1119
1219
  * @example
1120
1220
  * ```ts
1121
1221
  * const node = manager.nodeManager.get("node1");
1122
- * if (node) node.reconnect();
1222
+ * if (node) node.reconnectAll();
1123
1223
  * ```
1124
1224
  */
1125
- reconnect() {
1225
+ reconnectAll() {
1126
1226
  if (!this.nodes.size) return;
1127
1227
  for (const node of this.nodes.filter((node2) => node2.state !== 2 /* Connected */)) {
1128
1228
  node.reconnect();
@@ -1134,10 +1234,10 @@ var NodeManager = class {
1134
1234
  * @example
1135
1235
  * ```ts
1136
1236
  * const node = manager.nodeManager.get("node1");
1137
- * if (node) node.disconnect();
1237
+ * if (node) node.disconnectAll();
1138
1238
  * ```
1139
1239
  */
1140
- disconnect() {
1240
+ disconnectAll() {
1141
1241
  if (!this.nodes.size) return;
1142
1242
  for (const node of this.nodes.filter((node2) => node2.state !== 3 /* Disconnected */)) {
1143
1243
  node.disconnect();
@@ -1152,7 +1252,7 @@ var NodeManager = class {
1152
1252
  * if (node) node.connect();
1153
1253
  * ```
1154
1254
  */
1155
- connect() {
1255
+ connectAll() {
1156
1256
  if (!this.nodes.size) return;
1157
1257
  for (const node of this.nodes.filter((node2) => node2.state !== 2 /* Connected */)) {
1158
1258
  node.connect();
@@ -1167,7 +1267,7 @@ var NodeManager = class {
1167
1267
  * if (node) node.destroy();
1168
1268
  * ```
1169
1269
  */
1170
- destroy() {
1270
+ destroyAll() {
1171
1271
  if (!this.nodes.size) return;
1172
1272
  for (const node of this.nodes.values()) {
1173
1273
  node.destroy();
@@ -1328,12 +1428,13 @@ async function playerUpdate(payload) {
1328
1428
  player.ping = payload.state.ping;
1329
1429
  player.connected = payload.state.connected;
1330
1430
  player.createdTimestamp = payload.state.time;
1331
- player.position = payload.state.position;
1431
+ player.lastPosition = payload.state.position || 0;
1432
+ player.lastPositionUpdate = Date.now();
1332
1433
  this.nodeManager.manager.emit("playerUpdate" /* PlayerUpdate */, player, oldPlayer, payload);
1333
1434
  this.nodeManager.manager.emit(
1334
1435
  "debug" /* Debug */,
1335
1436
  2 /* Node */,
1336
- `[Player] -> [Update] Player updated: ${player.guildId} | Payload: ${JSON.stringify(payload)}`
1437
+ `[Player] -> [Update] Player updated: ${player.guildId} | Payload: ${stringify(payload)}`
1337
1438
  );
1338
1439
  }
1339
1440
  async function lyricsFound(track, payload) {
@@ -1341,7 +1442,7 @@ async function lyricsFound(track, payload) {
1341
1442
  this.manager.emit(
1342
1443
  "debug" /* Debug */,
1343
1444
  3 /* Player */,
1344
- `[Player] -> [Lyrics] The lyrics have been found: ${this.guildId} | Payload: ${JSON.stringify(payload)}`
1445
+ `[Player] -> [Lyrics] The lyrics have been found: ${this.guildId} | Payload: ${stringify(payload)}`
1345
1446
  );
1346
1447
  }
1347
1448
  async function lyricsLine(track, payload) {
@@ -1349,7 +1450,7 @@ async function lyricsLine(track, payload) {
1349
1450
  this.manager.emit(
1350
1451
  "debug" /* Debug */,
1351
1452
  3 /* Player */,
1352
- `[Player] -> [Lyrics] The lyrics line has been found: ${this.guildId} | Payload: ${JSON.stringify(payload)}`
1453
+ `[Player] -> [Lyrics] The lyrics line has been found: ${this.guildId} | Payload: ${stringify(payload)}`
1353
1454
  );
1354
1455
  }
1355
1456
  async function lyricsNotFound(track, payload) {
@@ -1357,7 +1458,7 @@ async function lyricsNotFound(track, payload) {
1357
1458
  this.manager.emit(
1358
1459
  "debug" /* Debug */,
1359
1460
  3 /* Player */,
1360
- `[Player] -> [Lyrics] The lyrics were not found: ${this.guildId} | Payload: ${JSON.stringify(payload)}`
1461
+ `[Player] -> [Lyrics] The lyrics were not found: ${this.guildId} | Payload: ${stringify(payload)}`
1361
1462
  );
1362
1463
  }
1363
1464
  async function socketClosed(payload) {
@@ -1365,7 +1466,7 @@ async function socketClosed(payload) {
1365
1466
  this.manager.emit(
1366
1467
  "debug" /* Debug */,
1367
1468
  3 /* Player */,
1368
- `[Player] -> [Socket] The socket has closed: ${this.guildId} | Payload: ${JSON.stringify(payload)}`
1469
+ `[Player] -> [Socket] The socket has closed: ${this.guildId} | Payload: ${stringify(payload)}`
1369
1470
  );
1370
1471
  }
1371
1472
 
@@ -1515,11 +1616,7 @@ async function onMessage(message) {
1515
1616
  break;
1516
1617
  }
1517
1618
  }
1518
- this.nodeManager.manager.emit(
1519
- "debug" /* Debug */,
1520
- 2 /* Node */,
1521
- `[Socket] -> [${this.id}]: Received payload: ${JSON.stringify(payload)}`
1522
- );
1619
+ this.nodeManager.manager.emit("debug" /* Debug */, 2 /* Node */, `[Socket] -> [${this.id}]: Received payload: ${stringify(payload)}`);
1523
1620
  } catch (error) {
1524
1621
  this.nodeManager.manager.emit("nodeError" /* NodeError */, this, error);
1525
1622
  }
@@ -1654,7 +1751,7 @@ var Node = class {
1654
1751
  const raw = await this.rest.request({
1655
1752
  endpoint: "/decodetracks",
1656
1753
  method: "POST" /* Post */,
1657
- body: JSON.stringify(tracks)
1754
+ body: stringify(tracks)
1658
1755
  }) ?? [];
1659
1756
  return raw.map((track) => new Track(track, requester));
1660
1757
  }
@@ -1751,6 +1848,7 @@ var Node = class {
1751
1848
  * ```
1752
1849
  */
1753
1850
  connect() {
1851
+ if (this.state === 2 /* Connected */ || this.state === 1 /* Connecting */) return;
1754
1852
  if (!this.nodeManager.manager.options.client)
1755
1853
  throw new NodeError({
1756
1854
  message: "No valid client data provided.",
@@ -1785,7 +1883,7 @@ var Node = class {
1785
1883
  this.nodeManager.manager.emit(
1786
1884
  "debug" /* Debug */,
1787
1885
  2 /* Node */,
1788
- `[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)}`
1886
+ `[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)}`
1789
1887
  );
1790
1888
  }
1791
1889
  /**
@@ -1926,6 +2024,7 @@ var Node = class {
1926
2024
  * ```
1927
2025
  */
1928
2026
  reconnect() {
2027
+ if (this.state === 3 /* Disconnected */ || this.state === 6 /* Destroyed */) return;
1929
2028
  this.state = 7 /* Idle */;
1930
2029
  this.nodeManager.manager.emit("nodeReconnecting" /* NodeReconnecting */, this, this.retryAmount, this.retryDelay);
1931
2030
  this.reconnectTimeout = setTimeout(() => {
@@ -2062,7 +2161,7 @@ var Rest = class {
2062
2161
  */
2063
2162
  constructor(node) {
2064
2163
  const manager = node.nodeManager.manager;
2065
- this.url = `${node.options.secure ? "https" : "http"}://${node.options.host}:${node.options.port}/${this.version}`;
2164
+ this.url = `${node.options.secure ? "https" : "http"}://${node.options.host}:${node.options.port}`;
2066
2165
  this.restTimeout = node.options.restTimeout ?? manager.options.restOptions.resumeTimeout ?? 1e4;
2067
2166
  this.userAgent = manager.options.nodeOptions.userAgent ?? HoshimiAgent;
2068
2167
  this.node = node;
@@ -2095,7 +2194,9 @@ var Rest = class {
2095
2194
  Authorization: this.node.options.password
2096
2195
  };
2097
2196
  options.method ??= "GET" /* Get */;
2098
- const url = new URL(`${this.url}${options.endpoint}`);
2197
+ options.pathType ??= "/v4" /* V4 */;
2198
+ const path = `${options.pathType}${options.endpoint}`.replace(/\/+/g, "/");
2199
+ const url = new URL(`${this.url}${path}`);
2099
2200
  if (options.params) {
2100
2201
  for (const [key, value] of Object.entries(options.params)) {
2101
2202
  url.searchParams.append(key, value);
@@ -2111,12 +2212,12 @@ var Rest = class {
2111
2212
  };
2112
2213
  if (!["GET" /* Get */, "HEAD" /* Head */].includes(options.method) && options.body) {
2113
2214
  if (typeof options.body === "string") fetchOptions.body = options.body;
2114
- else fetchOptions.body = JSON.stringify(options.body);
2215
+ else fetchOptions.body = stringify(options.body);
2115
2216
  }
2116
2217
  this.node.nodeManager.manager.emit(
2117
2218
  "debug" /* Debug */,
2118
2219
  4 /* Rest */,
2119
- `[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)}`
2220
+ `[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)}`
2120
2221
  );
2121
2222
  const response = await fetch(url.toString(), fetchOptions).finally(() => clearTimeout(timeout));
2122
2223
  if (!response.ok) {
@@ -2158,7 +2259,7 @@ var Rest = class {
2158
2259
  this.node.nodeManager.manager.emit(
2159
2260
  "debug" /* Debug */,
2160
2261
  4 /* Rest */,
2161
- `[Rest] -> [${this.node.id}]: Updated player data for guild: ${data.guildId} | Payload: ${JSON.stringify(data)}`
2262
+ `[Rest] -> [${this.node.id}]: Updated player data for guild: ${data.guildId} | Payload: ${stringify(data)}`
2162
2263
  );
2163
2264
  validatePlayerData.call(this.node, data);
2164
2265
  return this.request({
@@ -2263,7 +2364,7 @@ var DSPXPluginFilter = class {
2263
2364
  *
2264
2365
  * Set the low-pass filter with the given settings.
2265
2366
  * @param {FilterPluginPassSettings} [settings=DefaultFilter.DSPXLowPass] The settings for the low-pass filter.
2266
- * @returns {Promise<boolean>} Whether the filter is now active.
2367
+ * @returns {Promise<this>} The instance of the filter manager.
2267
2368
  */
2268
2369
  async setLowPass(settings = DefaultFilterPreset.DSPXLowPass) {
2269
2370
  validateNodePlugins(this.manager.player.node, ["lavadspx-plugin" /* LavaDspx */]);
@@ -2279,13 +2380,13 @@ var DSPXPluginFilter = class {
2279
2380
  }
2280
2381
  this.manager.filters.lavalinkLavaDspxPlugin.lowPass = !this.manager.filters.lavalinkLavaDspxPlugin.lowPass;
2281
2382
  await this.manager.apply();
2282
- return this.manager.filters.lavalinkLavaDspxPlugin.lowPass;
2383
+ return this;
2283
2384
  }
2284
2385
  /**
2285
2386
  *
2286
2387
  * Set the high-pass filter with the given settings.
2287
2388
  * @param {FilterPluginPassSettings} [settings=DefaultFilter.DSPXHighPass] The settings for the high-pass filter.
2288
- * @returns {Promise<boolean>} Whether the filter is now active.
2389
+ * @returns {Promise<this>} The instance of the filter manager.
2289
2390
  */
2290
2391
  async setHighPass(settings = DefaultFilterPreset.DSPXHighPass) {
2291
2392
  validateNodePlugins(this.manager.player.node, ["lavadspx-plugin" /* LavaDspx */]);
@@ -2301,13 +2402,13 @@ var DSPXPluginFilter = class {
2301
2402
  }
2302
2403
  this.manager.filters.lavalinkLavaDspxPlugin.highPass = !this.manager.filters.lavalinkLavaDspxPlugin.highPass;
2303
2404
  await this.manager.apply();
2304
- return this.manager.filters.lavalinkLavaDspxPlugin.highPass;
2405
+ return this;
2305
2406
  }
2306
2407
  /**
2307
2408
  *
2308
2409
  * Set the normalization filter with the given settings.
2309
2410
  * @param {NormalizationSettings} [settings=DefaultFilter.DSPXNormalization] The settings for the normalization filter.
2310
- * @returns {Promise<boolean>} Whether the filter is now active.
2411
+ * @returns {Promise<this>} The instance of the filter manager.
2311
2412
  */
2312
2413
  async setNormalization(settings = DefaultFilterPreset.DSPXNormalization) {
2313
2414
  validateNodePlugins(this.manager.player.node, ["lavadspx-plugin" /* LavaDspx */]);
@@ -2323,13 +2424,13 @@ var DSPXPluginFilter = class {
2323
2424
  }
2324
2425
  this.manager.filters.lavalinkLavaDspxPlugin.normalization = !this.manager.filters.lavalinkLavaDspxPlugin.normalization;
2325
2426
  await this.manager.apply();
2326
- return this.manager.filters.lavalinkLavaDspxPlugin.normalization;
2427
+ return this;
2327
2428
  }
2328
2429
  /**
2329
2430
  *
2330
2431
  * Set the echo filter with the given settings.
2331
2432
  * @param {EchoSettings} [settings=DefaultFilter.DSPXEcho] The settings for the echo filter.
2332
- * @returns {Promise<boolean>} Whether the filter is now active.
2433
+ * @returns {Promise<this>} The instance of the filter manager.
2333
2434
  */
2334
2435
  async setEcho(settings = DefaultFilterPreset.DSPXEcho) {
2335
2436
  validateNodePlugins(this.manager.player.node, ["lavadspx-plugin" /* LavaDspx */]);
@@ -2345,7 +2446,7 @@ var DSPXPluginFilter = class {
2345
2446
  }
2346
2447
  this.manager.filters.lavalinkLavaDspxPlugin.echo = !this.manager.filters.lavalinkLavaDspxPlugin.echo;
2347
2448
  await this.manager.apply();
2348
- return this.manager.filters.lavalinkLavaDspxPlugin.echo;
2449
+ return this;
2349
2450
  }
2350
2451
  };
2351
2452
 
@@ -2369,7 +2470,7 @@ var LavalinkPluginFilter = class {
2369
2470
  *
2370
2471
  * Set the echo filter with the given settings.
2371
2472
  * @param {Omit<EchoSettings, "echoLength">} [settings=DefaultFilter.PluginEcho] The settings for the echo filter.
2372
- * @returns {Promise<boolean>} Whether the filter is now active.
2473
+ * @returns {Promise<this>} The instance of the filter manager.
2373
2474
  */
2374
2475
  async setEcho(settings = DefaultFilterPreset.PluginEcho) {
2375
2476
  validateNodePlugins(this.manager.player.node, ["lavalink-filter-plugin" /* FilterPlugin */]);
@@ -2385,13 +2486,13 @@ var LavalinkPluginFilter = class {
2385
2486
  this.manager.data.pluginFilters["lavalink-filter-plugin"].echo.decay = this.manager.filters.lavalinkFilterPlugin.echo ? 0 : settings.decay;
2386
2487
  this.manager.filters.lavalinkFilterPlugin.echo = !this.manager.filters.lavalinkFilterPlugin.echo;
2387
2488
  await this.manager.apply();
2388
- return this.manager.filters.lavalinkFilterPlugin.echo;
2489
+ return this;
2389
2490
  }
2390
2491
  /**
2391
2492
  *
2392
2493
  * Set the reverb filter with the given settings.
2393
2494
  * @param {Partial<LavalinkFilterPluginReverbSettings>} [settings=DefaultFilter.PluginReverb] The settings for the reverb filter.
2394
- * @returns {Promise<boolean>} Whether the filter is now active.
2495
+ * @returns {Promise<this>} The instance of the filter manager.
2395
2496
  */
2396
2497
  async setReverb(settings = DefaultFilterPreset.PluginReverb) {
2397
2498
  validateNodePlugins(this.manager.player.node, ["lavalink-filter-plugin" /* FilterPlugin */]);
@@ -2407,7 +2508,7 @@ var LavalinkPluginFilter = class {
2407
2508
  this.manager.data.pluginFilters["lavalink-filter-plugin"].reverb.gains = this.manager.filters.lavalinkFilterPlugin.reverb ? [] : settings.gains;
2408
2509
  this.manager.filters.lavalinkFilterPlugin.reverb = !this.manager.filters.lavalinkFilterPlugin.reverb;
2409
2510
  await this.manager.apply();
2410
- return this.manager.filters.lavalinkFilterPlugin.reverb;
2511
+ return this;
2411
2512
  }
2412
2513
  };
2413
2514
 
@@ -2482,18 +2583,9 @@ var FilterManager = class {
2482
2583
  this.plugin = new LavalinkPluginFilter(this);
2483
2584
  this.dspx = new DSPXPluginFilter(this);
2484
2585
  }
2485
- /**
2486
- *
2487
- * Checks if a custom filter is active.
2488
- * @returns {boolean} True if a custom filter is active, false otherwise.
2489
- */
2490
- isCustom() {
2491
- this.filters.custom = !this.filters.nightcore && !this.filters.vaporwave && Object.values(this.data.timescale ?? {}).some((d) => d !== 1);
2492
- return this.filters.custom;
2493
- }
2494
2586
  /**
2495
2587
  * Resets all filters to their default values.
2496
- * @returns {Promise<void>} A promise that resolves when the filters have been reset.
2588
+ * @returns {Promise<this>} A promise that resolves to the instance of the filter manager.
2497
2589
  */
2498
2590
  async reset() {
2499
2591
  this.filters = {
@@ -2520,20 +2612,17 @@ var FilterManager = class {
2520
2612
  echo: false
2521
2613
  }
2522
2614
  };
2523
- for (const [key, value] of Object.entries(DefaultPlayerFilters)) {
2524
- this.data[key] = value;
2525
- }
2526
- await this.apply();
2615
+ this.data = { ...DefaultPlayerFilters };
2616
+ return this.apply();
2527
2617
  }
2528
2618
  /**
2529
2619
  *
2530
2620
  * Applies the current filters to the player.
2531
- * @returns {Promise<void>} A promise that resolves when the filters have been applied.
2621
+ * @returns {Promise<this>} A promise that resolves to the instance of the filter manager.
2532
2622
  */
2533
2623
  async apply() {
2534
- if (!this.player.node.sessionId) return;
2624
+ if (!this.player.node.sessionId) return this;
2535
2625
  this.check();
2536
- this.isCustom();
2537
2626
  const filters = { ...this.data };
2538
2627
  if (!this.filters.volume) delete filters.volume;
2539
2628
  if (!this.filters.tremolo) delete filters.tremolo;
@@ -2560,6 +2649,7 @@ var FilterManager = class {
2560
2649
  if (!this.player.node.info?.filters?.includes(key)) delete filters[key];
2561
2650
  }
2562
2651
  await this.player.updatePlayer({ playerOptions: { filters } });
2652
+ return this;
2563
2653
  }
2564
2654
  /**
2565
2655
  * Checks if the current filters are active.
@@ -2581,6 +2671,7 @@ var FilterManager = class {
2581
2671
  this.filters.karaoke = Object.values(this.data.karaoke ?? {}).some((v) => v !== 0);
2582
2672
  this.filters.distortion = Object.values(this.data.distortion ?? {}).some((v) => v !== 0 && v !== 1);
2583
2673
  this.filters.timescale = Object.values(this.data.timescale ?? {}).some((v) => v !== 1);
2674
+ this.filters.custom = !this.filters.nightcore && !this.filters.vaporwave && Object.values(this.data.timescale ?? {}).some((d) => d !== 1);
2584
2675
  if ((this.filters.nightcore || this.filters.vaporwave) && timescale) {
2585
2676
  if (timescale.pitch !== this.data.timescale?.pitch || timescale.rate !== this.data.timescale?.rate || timescale.speed !== this.data.timescale?.speed) {
2586
2677
  this.filters.custom = Object.values(this.data.timescale ?? {}).some((v) => v !== 1);
@@ -2609,34 +2700,32 @@ var FilterManager = class {
2609
2700
  *
2610
2701
  * Sets the volume for the player.
2611
2702
  * @param {number} volume The volume level to set (between 0 and 5).
2612
- * @returns {Promise<boolean>} A promise that resolves to true if the volume was changed, false otherwise.
2703
+ * @returns {Promise<this>} A promise that resolves to the player instance.
2613
2704
  */
2614
2705
  async setVolume(volume) {
2615
2706
  if (typeof volume !== "number" || Number.isNaN(volume) || volume < 0 || volume > 5)
2616
2707
  throw new PlayerError("Volume must be a number between 0 and 5.");
2617
2708
  this.data = { volume };
2618
2709
  this.filters.volume = volume !== 1;
2619
- await this.apply();
2620
- return this.filters.volume;
2710
+ return this.apply();
2621
2711
  }
2622
2712
  /**
2623
2713
  * Sets the audio output for the player.
2624
2714
  * @param {AudioOutput} output The audio output to set.
2625
- * @returns {Promise<AudioOutput>} A promise that resolves to the set audio output.
2715
+ * @returns {Promise<this>} A promise that resolves to the player instance.
2626
2716
  */
2627
2717
  async setAudioOutput(output) {
2628
2718
  const outputs = Object.values(AudioOutput);
2629
2719
  if (!outputs.includes(output)) throw new PlayerError(`Audio output must be one of the following: ${outputs.join(", ")}.`);
2630
2720
  this.filters.audioOutput = output;
2631
2721
  this.data.channelMix = AudioOutputData[output];
2632
- await this.apply();
2633
- return this.filters.audioOutput;
2722
+ return this.apply();
2634
2723
  }
2635
2724
  /**
2636
2725
  *
2637
2726
  * Sets the speed for the player.
2638
2727
  * @param {number} speed The speed to set (default is 1).
2639
- * @returns {Promise<boolean>} A promise that resolves to true if a custom filter is active, false otherwise.
2728
+ * @returns {Promise<this>} A promise that resolves to the player instance.
2640
2729
  */
2641
2730
  async setSpeed(speed = 1) {
2642
2731
  if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
@@ -2651,14 +2740,13 @@ var FilterManager = class {
2651
2740
  this.filters.vaporwave = false;
2652
2741
  }
2653
2742
  this.data.timescale.speed = speed;
2654
- await this.apply();
2655
- return this.filters.custom;
2743
+ return this.apply();
2656
2744
  }
2657
2745
  /**
2658
2746
  *
2659
2747
  * Sets the rate for the player.
2660
2748
  * @param {number} rate The rate to set (default is 1).
2661
- * @returns {Promise<boolean>} A promise that resolves to true if a custom filter is active, false otherwise.
2749
+ * @returns {Promise<this>} A promise that resolves to the player instance.
2662
2750
  */
2663
2751
  async setRate(rate = 1) {
2664
2752
  if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
@@ -2673,14 +2761,13 @@ var FilterManager = class {
2673
2761
  this.filters.vaporwave = false;
2674
2762
  }
2675
2763
  this.data.timescale.rate = rate;
2676
- await this.apply();
2677
- return this.filters.custom;
2764
+ return this.apply();
2678
2765
  }
2679
2766
  /**
2680
2767
  *
2681
2768
  * Sets the pitch for the player.
2682
2769
  * @param {number} pitch The pitch
2683
- * @returns {Promise<boolean>} A promise that resolves to true if a custom filter is active, false otherwise.
2770
+ * @returns {Promise<this>} A promise that resolves to the player instance.
2684
2771
  */
2685
2772
  async setPitch(pitch = 1) {
2686
2773
  if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
@@ -2695,8 +2782,7 @@ var FilterManager = class {
2695
2782
  this.filters.vaporwave = false;
2696
2783
  }
2697
2784
  this.data.timescale.pitch = pitch;
2698
- await this.apply();
2699
- return this.filters.custom;
2785
+ return this.apply();
2700
2786
  }
2701
2787
  /**
2702
2788
  *
@@ -2709,8 +2795,7 @@ var FilterManager = class {
2709
2795
  if (!bands.length || !bands.every((band) => typeof band.band === "number" && typeof band.gain === "number"))
2710
2796
  throw new PlayerError("Bands must be a non-empty object array containing 'band' and 'gain' properties.");
2711
2797
  for (const { band, gain } of bands) this.bands[band] = { band, gain };
2712
- await this.apply();
2713
- return this;
2798
+ return this.apply();
2714
2799
  }
2715
2800
  /**
2716
2801
  *
@@ -2724,7 +2809,7 @@ var FilterManager = class {
2724
2809
  *
2725
2810
  * Set the vibrato filter with the given settings.
2726
2811
  * @param {TremoloSettings} [settings=DefaultFilterPreset.Vibrato] The settings for the vibrato filter.
2727
- * @returns {Promise<boolean>} Whether the filter is now active.
2812
+ * @returns {Promise<this>} The instance of the filter manager.
2728
2813
  */
2729
2814
  async setVibrato(settings = DefaultFilterPreset.Vibrato) {
2730
2815
  if (!this.player.node.info?.filters?.includes("vibrato" /* Vibrato */))
@@ -2734,14 +2819,13 @@ var FilterManager = class {
2734
2819
  depth: this.filters.vibrato ? 0 : settings.depth
2735
2820
  };
2736
2821
  this.filters.vibrato = !this.filters.vibrato;
2737
- await this.apply();
2738
- return this.filters.vibrato;
2822
+ return this.apply();
2739
2823
  }
2740
2824
  /**
2741
2825
  *
2742
2826
  * Set the tremolo filter with the given settings.
2743
2827
  * @param {TremoloSettings} [settings=DefaultFilterPreset.Tremolo] The settings for the tremolo filter.
2744
- * @returns {Promise<boolean>} Whether the filter is now active.
2828
+ * @returns {Promise<this>} The instance of the filter manager.
2745
2829
  */
2746
2830
  async setTremolo(settings = DefaultFilterPreset.Tremolo) {
2747
2831
  if (!this.player.node.info?.filters?.includes("tremolo" /* Tremolo */))
@@ -2751,27 +2835,25 @@ var FilterManager = class {
2751
2835
  depth: this.filters.tremolo ? 0 : settings.depth
2752
2836
  };
2753
2837
  this.filters.tremolo = !this.filters.tremolo;
2754
- await this.apply();
2755
- return this.filters.tremolo;
2838
+ return this.apply();
2756
2839
  }
2757
2840
  /**
2758
2841
  *
2759
2842
  * Set the low-pass filter with the given settings.
2760
2843
  * @param {LowPassSettings} [settings=DefaultFilterPreset.Lowpass] The settings for the low-pass filter.
2761
- * @returns {Promise<boolean>} Whether the filter is now active.
2844
+ * @returns {Promise<this>} The instance of the filter manager.
2762
2845
  */
2763
2846
  async setLowPass(settings = DefaultFilterPreset.Lowpass) {
2764
2847
  if (!this.player.node.info?.filters?.includes("lowPass" /* LowPass */))
2765
2848
  throw new PlayerError("Node filters does not include the 'lowPass' filter. (Or the node doesn't have it enabled)");
2766
2849
  this.data.lowPass = { smoothing: this.filters.lowPass ? 0 : settings.smoothing };
2767
2850
  this.filters.lowPass = !this.filters.lowPass;
2768
- await this.apply();
2769
- return this.filters.lowPass;
2851
+ return this.apply();
2770
2852
  }
2771
2853
  /**
2772
2854
  * Set the nightcore filter with the given settings.
2773
2855
  * @param {Partial<TimescaleSettings>} [settings=DefaultFilterPreset.Nightcore] The settings for the nightcore filter.
2774
- * @returns {Promise<boolean>} Whether the filter is now active.
2856
+ * @returns {Promise<this>} The instance of the filter manager.
2775
2857
  */
2776
2858
  async setNightcore(settings = DefaultFilterPreset.Nightcore) {
2777
2859
  if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
@@ -2784,14 +2866,13 @@ var FilterManager = class {
2784
2866
  this.filters.nightcore = !this.filters.nightcore;
2785
2867
  this.filters.vaporwave = false;
2786
2868
  this.filters.custom = false;
2787
- await this.apply();
2788
- return this.filters.nightcore;
2869
+ return this.apply();
2789
2870
  }
2790
2871
  /**
2791
2872
  *
2792
2873
  * Set the vaporwave filter with the given settings.
2793
2874
  * @param {Partial<TimescaleSettings>} [settings=DefaultFilterPreset.Vaporwave] The settings for the vaporwave filter.
2794
- * @returns {Promise<boolean>} Whether the filter is now active.
2875
+ * @returns {Promise<this>} The instance of the filter manager.
2795
2876
  */
2796
2877
  async setVaporwave(settings = DefaultFilterPreset.Vaporwave) {
2797
2878
  if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
@@ -2804,14 +2885,13 @@ var FilterManager = class {
2804
2885
  this.filters.vaporwave = !this.filters.vaporwave;
2805
2886
  this.filters.nightcore = false;
2806
2887
  this.filters.custom = false;
2807
- await this.apply();
2808
- return this.filters.vaporwave;
2888
+ return this.apply();
2809
2889
  }
2810
2890
  /**
2811
2891
  *
2812
2892
  * Set the karaoke filter with the given settings.
2813
2893
  * @param {KaraokeSettings} [settings=DefaultFilterPreset.Karaoke] The settings for the karaoke filter.
2814
- * @returns {Promise<boolean>} Whether the filter is now active.
2894
+ * @returns {Promise<this>} The instance of the filter manager.
2815
2895
  */
2816
2896
  async setKaraoke(settings = DefaultFilterPreset.Karaoke) {
2817
2897
  if (!this.player.node.info?.filters?.includes("karaoke" /* Karaoke */))
@@ -2823,14 +2903,13 @@ var FilterManager = class {
2823
2903
  filterWidth: this.data.karaoke.filterWidth ? 0 : settings.filterWidth
2824
2904
  };
2825
2905
  this.filters.karaoke = !this.filters.karaoke;
2826
- await this.apply();
2827
- return this.filters.karaoke;
2906
+ return this.apply();
2828
2907
  }
2829
2908
  /**
2830
2909
  *
2831
2910
  * Set the distortion filter with the given settings.
2832
2911
  * @param {Partial<DistortionSettings>} [settings=DefaultFilterPreset.Distortion] The settings for the distortion filter.
2833
- * @returns {Promise<boolean>} Whether the filter is now active.
2912
+ * @returns {Promise<this>} The instance of the filter manager.
2834
2913
  */
2835
2914
  async setDistortion(settings = DefaultFilterPreset.Distortion) {
2836
2915
  if (!this.player.node.info?.filters?.includes("distortion" /* Distortion */))
@@ -2845,13 +2924,12 @@ var FilterManager = class {
2845
2924
  scale: this.filters.distortion ? 1 : settings.scale
2846
2925
  };
2847
2926
  this.filters.distortion = !this.filters.distortion;
2848
- await this.apply();
2849
- return this.filters.distortion;
2927
+ return this.apply();
2850
2928
  }
2851
2929
  /**
2852
2930
  * Set the timescale filter with the given settings.
2853
2931
  * @param {Partial<TimescaleSettings>} settings The timescale settings to set.
2854
- * @returns {Promise<boolean>} Whether the filter is now active.
2932
+ * @returns {Promise<this>} The instance of the filter manager.
2855
2933
  */
2856
2934
  async setTimescale(settings) {
2857
2935
  if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
@@ -2862,8 +2940,14 @@ var FilterManager = class {
2862
2940
  speed: settings.speed ?? 1
2863
2941
  };
2864
2942
  this.filters.timescale = !this.filters.timescale;
2865
- await this.apply();
2866
- return this.filters.timescale;
2943
+ return this.apply();
2944
+ }
2945
+ /**
2946
+ * Convert the filter settings to a JSON object.
2947
+ * @returns {FilterSettings} The filter settings as a JSON object.
2948
+ */
2949
+ toJSON() {
2950
+ return { ...this.data };
2867
2951
  }
2868
2952
  };
2869
2953
 
@@ -3057,10 +3141,23 @@ var Player = class {
3057
3141
  */
3058
3142
  createdTimestamp = 0;
3059
3143
  /**
3060
- * The position of the player.
3144
+ * The last position received from Lavalink.
3061
3145
  * @type {number}
3062
3146
  */
3063
- position = 0;
3147
+ lastPosition = 0;
3148
+ /**
3149
+ * The timestamp when the last position change update happened.
3150
+ * @type {number | null}
3151
+ */
3152
+ lastPositionUpdate = null;
3153
+ /**
3154
+ * The current calculated position of the player.
3155
+ * @type {number}
3156
+ * @readonly
3157
+ */
3158
+ get position() {
3159
+ return this.lastPosition + (this.lastPositionUpdate ? Date.now() - this.lastPositionUpdate : 0);
3160
+ }
3064
3161
  /**
3065
3162
  * The voice connection details.
3066
3163
  * @type {PlayerVoice}
@@ -3182,6 +3279,8 @@ var Player = class {
3182
3279
  if (typeof position !== "number" || Number.isNaN(position) || position < 0)
3183
3280
  throw new PlayerError("Position must be a positive number.");
3184
3281
  this.manager.emit("debug" /* Debug */, 3 /* Player */, `[Player] -> [Seek] Seeking to ${position} for guild: ${this.guildId}`);
3282
+ this.lastPosition = position;
3283
+ this.lastPositionUpdate = Date.now();
3185
3284
  await this.updatePlayer({ playerOptions: { position } });
3186
3285
  }
3187
3286
  /**
@@ -3255,10 +3354,15 @@ var Player = class {
3255
3354
  if (!isTrack(this.queue.current) && !isUnresolvedTrack(this.queue.current))
3256
3355
  throw new PlayerError("The track must be a valid Track or UnresolvedTrack instance.");
3257
3356
  this.manager.emit("debug" /* Debug */, 3 /* Player */, `[Player] -> [Play] A new track is playing: ${this.queue.current.info.title}`);
3357
+ const position = options.position ?? 0;
3358
+ this.lastPosition = position;
3359
+ this.lastPositionUpdate = Date.now();
3258
3360
  await this.updatePlayer({
3259
3361
  noReplace: options.noReplace,
3260
3362
  playerOptions: {
3261
3363
  ...options,
3364
+ position,
3365
+ // Ensure position is sent to Lavalink
3262
3366
  track: {
3263
3367
  userData: this.queue.current.userData,
3264
3368
  encoded: this.queue.current.encoded
@@ -3308,7 +3412,8 @@ var Player = class {
3308
3412
  this.manager.emit("debug" /* Debug */, 3 /* Player */, `[Player] -> [Stop] Player stopped for guild: ${this.guildId}`);
3309
3413
  this.playing = false;
3310
3414
  this.paused = false;
3311
- this.position = 0;
3415
+ this.lastPosition = 0;
3416
+ this.lastPositionUpdate = null;
3312
3417
  this.queue.current = null;
3313
3418
  return;
3314
3419
  }
@@ -3328,6 +3433,12 @@ var Player = class {
3328
3433
  3 /* Player */,
3329
3434
  `[Player] -> [Pause] Player is now ${paused ? "paused" : "resumed"} for guild: ${this.guildId}`
3330
3435
  );
3436
+ if (paused) {
3437
+ this.lastPositionUpdate = null;
3438
+ } else {
3439
+ this.lastPosition = this.position;
3440
+ this.lastPositionUpdate = Date.now();
3441
+ }
3331
3442
  await this.updatePlayer({ playerOptions: { paused } });
3332
3443
  return paused;
3333
3444
  }
@@ -3495,6 +3606,13 @@ var Player = class {
3495
3606
  selfDeaf: this.selfDeaf,
3496
3607
  options: this.options,
3497
3608
  voice: this.voice,
3609
+ textId: this.textId,
3610
+ lastPosition: this.lastPosition,
3611
+ lastPositionUpdate: this.lastPositionUpdate,
3612
+ position: this.position,
3613
+ createdTimestamp: this.createdTimestamp,
3614
+ ping: this.ping,
3615
+ filters: this.filterManager.toJSON(),
3498
3616
  queue: this.queue.toJSON(),
3499
3617
  node: this.node.toJSON()
3500
3618
  };
@@ -3623,7 +3741,7 @@ var QueueUtils = class {
3623
3741
  this.queue.player.manager.emit(
3624
3742
  "debug" /* Debug */,
3625
3743
  5 /* Queue */,
3626
- `[Queue] -> [Adapter] Saving queue for ${this.queue.player.guildId} | Object: ${JSON.stringify(json)}`
3744
+ `[Queue] -> [Adapter] Saving queue for ${this.queue.player.guildId} | Object: ${stringify(json)}`
3627
3745
  );
3628
3746
  return this.store.set(this.queue.player.guildId, json);
3629
3747
  }
@@ -3665,7 +3783,7 @@ var QueueUtils = class {
3665
3783
  this.queue.player.manager.emit(
3666
3784
  "debug" /* Debug */,
3667
3785
  5 /* Queue */,
3668
- `[Queue] -> [Adapter] Syncing queue for ${this.queue.player.guildId} | Object: ${JSON.stringify(data)}`
3786
+ `[Queue] -> [Adapter] Syncing queue for ${this.queue.player.guildId} | Object: ${stringify(data)}`
3669
3787
  );
3670
3788
  await this.save();
3671
3789
  }
@@ -4419,7 +4537,7 @@ var Hoshimi = class extends EventEmitter {
4419
4537
  this.emit(
4420
4538
  "debug" /* Debug */,
4421
4539
  1 /* Manager */,
4422
- `[Manager] -> [Search] Searching for: ${options.query} (${options.engine ?? "unknown"}) | Result: ${JSON.stringify(res)}`
4540
+ `[Manager] -> [Search] Searching for: ${options.query} (${options.engine ?? "unknown"}) | Result: ${stringify(res)}`
4423
4541
  );
4424
4542
  switch (res.loadType) {
4425
4543
  case "empty" /* Empty */: {
@@ -4503,6 +4621,7 @@ export {
4503
4621
  Queue,
4504
4622
  ResolveError,
4505
4623
  Rest,
4624
+ RestPathType,
4506
4625
  SearchEngines,
4507
4626
  Severity,
4508
4627
  SourceNames,