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.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.3",
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.25.0+sha512.5e82639027af37cf832061bcc6d639c219634488e0f2baebe785028a793de7b525ffcd3f7ff574f5e9860654e098fe852ba8ac5dd5cefe1767d23a020a92f501",
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": "^25.0.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
@@ -812,7 +818,10 @@ function validatePlayerData(data) {
812
818
  player.playing = !data.playerOptions.paused;
813
819
  }
814
820
  if (typeof data.playerOptions.volume === "number") player.volume = data.playerOptions.volume;
815
- if (typeof data.playerOptions.position === "number") player.position = data.playerOptions.position;
821
+ if (typeof data.playerOptions.position === "number") {
822
+ player.lastPosition = data.playerOptions.position;
823
+ player.lastPositionUpdate = Date.now();
824
+ }
816
825
  }
817
826
  }
818
827
  function validateNodePlugins(node, plugins) {
@@ -853,6 +862,24 @@ function isUnresolvedTrack(track) {
853
862
  function isValid(value) {
854
863
  return typeof value !== "undefined" && value !== null;
855
864
  }
865
+ function stringify(value, space) {
866
+ const seen = /* @__PURE__ */ new WeakSet();
867
+ return JSON.stringify(
868
+ value,
869
+ (_, value2) => {
870
+ if (typeof value2 === "function") return void 0;
871
+ if (typeof value2 === "symbol") return void 0;
872
+ if (typeof value2 === "bigint") return value2.toString();
873
+ if (typeof value2 === "object" && value2 !== null) {
874
+ if (seen.has(value2)) return void 0;
875
+ seen.add(value2);
876
+ return value2;
877
+ }
878
+ return value2;
879
+ },
880
+ space
881
+ );
882
+ }
856
883
  function isNode(options) {
857
884
  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
885
  }
@@ -1086,7 +1113,7 @@ var NodeManager = class {
1086
1113
  /**
1087
1114
  *
1088
1115
  * Delete the node.
1089
- * @param {string} id The id of the node to delete.
1116
+ * @param {NodeIdentifier} node The node or node id to delete.
1090
1117
  * @returns {boolean} If the node was deleted.
1091
1118
  * @example
1092
1119
  * ```ts
@@ -1094,23 +1121,122 @@ var NodeManager = class {
1094
1121
  * if (node) manager.nodeManager.delete(node.id); // true if the node was deleted
1095
1122
  * ```
1096
1123
  */
1097
- delete(id) {
1124
+ delete(node) {
1125
+ const id = typeof node === "string" ? node : node.id;
1098
1126
  return this.nodes.delete(id);
1099
1127
  }
1100
1128
  /**
1101
1129
  *
1102
1130
  * Get the node by id.
1103
- * @param {string} id The id of the node.
1131
+ * @param {NodeIdentifier} node The node or node id to get.
1104
1132
  * @returns {NodeStructure | undefined} The node or undefined if not found.
1105
1133
  * @example
1106
1134
  * ```ts
1107
1135
  * const node = manager.nodeManager.get("node1");
1108
- * if (node) console.log(node.id); // node1
1136
+ * if (node) {
1137
+ * console.log(node.id); // node1
1138
+ * } else {
1139
+ * console.log("Node not found");
1140
+ * }
1109
1141
  * ```
1110
1142
  */
1111
- get(id) {
1143
+ get(node) {
1144
+ const id = typeof node === "string" ? node : node.id;
1112
1145
  return this.nodes.get(id);
1113
1146
  }
1147
+ /**
1148
+ *
1149
+ * Create a new node.
1150
+ * @param {NodeOptions} options The options for the node.
1151
+ * @returns {NodeStructure} The created node.
1152
+ * @example
1153
+ * ```ts
1154
+ * const node = manager.nodeManager.create({
1155
+ * host: "localhost",
1156
+ * port: 2333,
1157
+ * password: "password",
1158
+ * secure: false,
1159
+ * });
1160
+ *
1161
+ * console.log(node.id); // localhost:2333
1162
+ */
1163
+ create(options) {
1164
+ options.id ??= `${options.host}:${options.port}`;
1165
+ const oldNode = this.nodes.get(options.id);
1166
+ if (oldNode) return oldNode;
1167
+ const node = Structures.Node(this, options);
1168
+ this.nodes.set(node.id, node);
1169
+ this.manager.emit("nodeCreate" /* NodeCreate */, node);
1170
+ return node;
1171
+ }
1172
+ /**
1173
+ *
1174
+ * Destroy a node.
1175
+ * @param {NodeIdentifier} node The node or node id to destroy.
1176
+ * @returns {void}
1177
+ * @example
1178
+ * ```ts
1179
+ * const node = manager.nodeManager.get("node1");
1180
+ * if (node) node.destroy();
1181
+ * ```
1182
+ */
1183
+ destroy(node) {
1184
+ const id = typeof node === "string" ? node : node.id;
1185
+ const target = this.nodes.get(id);
1186
+ if (!target) return;
1187
+ target.destroy();
1188
+ }
1189
+ /**
1190
+ *
1191
+ * Reconnect a node.
1192
+ * @param {NodeIdentifier} node The node or node id to reconnect.
1193
+ * @returns {void}
1194
+ * @example
1195
+ * ```ts
1196
+ * const node = manager.nodeManager.get("node1");
1197
+ * if (node) node.reconnect();
1198
+ * ```
1199
+ */
1200
+ reconnect(node) {
1201
+ const id = typeof node === "string" ? node : node.id;
1202
+ const target = this.nodes.get(id);
1203
+ if (!target) return;
1204
+ target.reconnect();
1205
+ }
1206
+ /**
1207
+ *
1208
+ * Disconnect a node.
1209
+ * @param {NodeIdentifier} node The node or node id to disconnect.
1210
+ * @returns {void}
1211
+ * @example
1212
+ * ```ts
1213
+ * const node = manager.nodeManager.get("node1");
1214
+ * if (node) node.disconnect();
1215
+ * ```
1216
+ */
1217
+ disconnect(node) {
1218
+ const id = typeof node === "string" ? node : node.id;
1219
+ const target = this.nodes.get(id);
1220
+ if (!target) return;
1221
+ target.disconnect();
1222
+ }
1223
+ /**
1224
+ *
1225
+ * Connect a node.
1226
+ * @param {NodeIdentifier} node The node or node id to connect.
1227
+ * @returns {void}
1228
+ * @example
1229
+ * ```ts
1230
+ * const node = manager.nodeManager.get("node1");
1231
+ * if (node) node.connect();
1232
+ * ```
1233
+ */
1234
+ connect(node) {
1235
+ const id = typeof node === "string" ? node : node.id;
1236
+ const target = this.nodes.get(id);
1237
+ if (!target) return;
1238
+ target.connect();
1239
+ }
1114
1240
  /**
1115
1241
  *
1116
1242
  * Get the least used node.
@@ -1153,31 +1279,6 @@ var NodeManager = class {
1153
1279
  });
1154
1280
  }
1155
1281
  }
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
1282
  /**
1182
1283
  *
1183
1284
  * Reconnect the nodes.
@@ -1185,10 +1286,10 @@ var NodeManager = class {
1185
1286
  * @example
1186
1287
  * ```ts
1187
1288
  * const node = manager.nodeManager.get("node1");
1188
- * if (node) node.reconnect();
1289
+ * if (node) node.reconnectAll();
1189
1290
  * ```
1190
1291
  */
1191
- reconnect() {
1292
+ reconnectAll() {
1192
1293
  if (!this.nodes.size) return;
1193
1294
  for (const node of this.nodes.filter((node2) => node2.state !== 2 /* Connected */)) {
1194
1295
  node.reconnect();
@@ -1200,10 +1301,10 @@ var NodeManager = class {
1200
1301
  * @example
1201
1302
  * ```ts
1202
1303
  * const node = manager.nodeManager.get("node1");
1203
- * if (node) node.disconnect();
1304
+ * if (node) node.disconnectAll();
1204
1305
  * ```
1205
1306
  */
1206
- disconnect() {
1307
+ disconnectAll() {
1207
1308
  if (!this.nodes.size) return;
1208
1309
  for (const node of this.nodes.filter((node2) => node2.state !== 3 /* Disconnected */)) {
1209
1310
  node.disconnect();
@@ -1218,7 +1319,7 @@ var NodeManager = class {
1218
1319
  * if (node) node.connect();
1219
1320
  * ```
1220
1321
  */
1221
- connect() {
1322
+ connectAll() {
1222
1323
  if (!this.nodes.size) return;
1223
1324
  for (const node of this.nodes.filter((node2) => node2.state !== 2 /* Connected */)) {
1224
1325
  node.connect();
@@ -1233,7 +1334,7 @@ var NodeManager = class {
1233
1334
  * if (node) node.destroy();
1234
1335
  * ```
1235
1336
  */
1236
- destroy() {
1337
+ destroyAll() {
1237
1338
  if (!this.nodes.size) return;
1238
1339
  for (const node of this.nodes.values()) {
1239
1340
  node.destroy();
@@ -1394,12 +1495,13 @@ async function playerUpdate(payload) {
1394
1495
  player.ping = payload.state.ping;
1395
1496
  player.connected = payload.state.connected;
1396
1497
  player.createdTimestamp = payload.state.time;
1397
- player.position = payload.state.position;
1498
+ player.lastPosition = payload.state.position || 0;
1499
+ player.lastPositionUpdate = Date.now();
1398
1500
  this.nodeManager.manager.emit("playerUpdate" /* PlayerUpdate */, player, oldPlayer, payload);
1399
1501
  this.nodeManager.manager.emit(
1400
1502
  "debug" /* Debug */,
1401
1503
  2 /* Node */,
1402
- `[Player] -> [Update] Player updated: ${player.guildId} | Payload: ${JSON.stringify(payload)}`
1504
+ `[Player] -> [Update] Player updated: ${player.guildId} | Payload: ${stringify(payload)}`
1403
1505
  );
1404
1506
  }
1405
1507
  async function lyricsFound(track, payload) {
@@ -1407,7 +1509,7 @@ async function lyricsFound(track, payload) {
1407
1509
  this.manager.emit(
1408
1510
  "debug" /* Debug */,
1409
1511
  3 /* Player */,
1410
- `[Player] -> [Lyrics] The lyrics have been found: ${this.guildId} | Payload: ${JSON.stringify(payload)}`
1512
+ `[Player] -> [Lyrics] The lyrics have been found: ${this.guildId} | Payload: ${stringify(payload)}`
1411
1513
  );
1412
1514
  }
1413
1515
  async function lyricsLine(track, payload) {
@@ -1415,7 +1517,7 @@ async function lyricsLine(track, payload) {
1415
1517
  this.manager.emit(
1416
1518
  "debug" /* Debug */,
1417
1519
  3 /* Player */,
1418
- `[Player] -> [Lyrics] The lyrics line has been found: ${this.guildId} | Payload: ${JSON.stringify(payload)}`
1520
+ `[Player] -> [Lyrics] The lyrics line has been found: ${this.guildId} | Payload: ${stringify(payload)}`
1419
1521
  );
1420
1522
  }
1421
1523
  async function lyricsNotFound(track, payload) {
@@ -1423,7 +1525,7 @@ async function lyricsNotFound(track, payload) {
1423
1525
  this.manager.emit(
1424
1526
  "debug" /* Debug */,
1425
1527
  3 /* Player */,
1426
- `[Player] -> [Lyrics] The lyrics were not found: ${this.guildId} | Payload: ${JSON.stringify(payload)}`
1528
+ `[Player] -> [Lyrics] The lyrics were not found: ${this.guildId} | Payload: ${stringify(payload)}`
1427
1529
  );
1428
1530
  }
1429
1531
  async function socketClosed(payload) {
@@ -1431,7 +1533,7 @@ async function socketClosed(payload) {
1431
1533
  this.manager.emit(
1432
1534
  "debug" /* Debug */,
1433
1535
  3 /* Player */,
1434
- `[Player] -> [Socket] The socket has closed: ${this.guildId} | Payload: ${JSON.stringify(payload)}`
1536
+ `[Player] -> [Socket] The socket has closed: ${this.guildId} | Payload: ${stringify(payload)}`
1435
1537
  );
1436
1538
  }
1437
1539
 
@@ -1581,11 +1683,7 @@ async function onMessage(message) {
1581
1683
  break;
1582
1684
  }
1583
1685
  }
1584
- this.nodeManager.manager.emit(
1585
- "debug" /* Debug */,
1586
- 2 /* Node */,
1587
- `[Socket] -> [${this.id}]: Received payload: ${JSON.stringify(payload)}`
1588
- );
1686
+ this.nodeManager.manager.emit("debug" /* Debug */, 2 /* Node */, `[Socket] -> [${this.id}]: Received payload: ${stringify(payload)}`);
1589
1687
  } catch (error) {
1590
1688
  this.nodeManager.manager.emit("nodeError" /* NodeError */, this, error);
1591
1689
  }
@@ -1720,7 +1818,7 @@ var Node = class {
1720
1818
  const raw = await this.rest.request({
1721
1819
  endpoint: "/decodetracks",
1722
1820
  method: "POST" /* Post */,
1723
- body: JSON.stringify(tracks)
1821
+ body: stringify(tracks)
1724
1822
  }) ?? [];
1725
1823
  return raw.map((track) => new Track(track, requester));
1726
1824
  }
@@ -1817,6 +1915,7 @@ var Node = class {
1817
1915
  * ```
1818
1916
  */
1819
1917
  connect() {
1918
+ if (this.state === 2 /* Connected */ || this.state === 1 /* Connecting */) return;
1820
1919
  if (!this.nodeManager.manager.options.client)
1821
1920
  throw new NodeError({
1822
1921
  message: "No valid client data provided.",
@@ -1851,7 +1950,7 @@ var Node = class {
1851
1950
  this.nodeManager.manager.emit(
1852
1951
  "debug" /* Debug */,
1853
1952
  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)}`
1953
+ `[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
1954
  );
1856
1955
  }
1857
1956
  /**
@@ -1992,6 +2091,7 @@ var Node = class {
1992
2091
  * ```
1993
2092
  */
1994
2093
  reconnect() {
2094
+ if (this.state === 3 /* Disconnected */ || this.state === 6 /* Destroyed */) return;
1995
2095
  this.state = 7 /* Idle */;
1996
2096
  this.nodeManager.manager.emit("nodeReconnecting" /* NodeReconnecting */, this, this.retryAmount, this.retryDelay);
1997
2097
  this.reconnectTimeout = setTimeout(() => {
@@ -2128,7 +2228,7 @@ var Rest = class {
2128
2228
  */
2129
2229
  constructor(node) {
2130
2230
  const manager = node.nodeManager.manager;
2131
- this.url = `${node.options.secure ? "https" : "http"}://${node.options.host}:${node.options.port}/${this.version}`;
2231
+ this.url = `${node.options.secure ? "https" : "http"}://${node.options.host}:${node.options.port}`;
2132
2232
  this.restTimeout = node.options.restTimeout ?? manager.options.restOptions.resumeTimeout ?? 1e4;
2133
2233
  this.userAgent = manager.options.nodeOptions.userAgent ?? HoshimiAgent;
2134
2234
  this.node = node;
@@ -2161,7 +2261,9 @@ var Rest = class {
2161
2261
  Authorization: this.node.options.password
2162
2262
  };
2163
2263
  options.method ??= "GET" /* Get */;
2164
- const url = new URL(`${this.url}${options.endpoint}`);
2264
+ options.pathType ??= "/v4" /* V4 */;
2265
+ const path = `${options.pathType}${options.endpoint}`.replace(/\/+/g, "/");
2266
+ const url = new URL(`${this.url}${path}`);
2165
2267
  if (options.params) {
2166
2268
  for (const [key, value] of Object.entries(options.params)) {
2167
2269
  url.searchParams.append(key, value);
@@ -2177,12 +2279,12 @@ var Rest = class {
2177
2279
  };
2178
2280
  if (!["GET" /* Get */, "HEAD" /* Head */].includes(options.method) && options.body) {
2179
2281
  if (typeof options.body === "string") fetchOptions.body = options.body;
2180
- else fetchOptions.body = JSON.stringify(options.body);
2282
+ else fetchOptions.body = stringify(options.body);
2181
2283
  }
2182
2284
  this.node.nodeManager.manager.emit(
2183
2285
  "debug" /* Debug */,
2184
2286
  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)}`
2287
+ `[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
2288
  );
2187
2289
  const response = await fetch(url.toString(), fetchOptions).finally(() => clearTimeout(timeout));
2188
2290
  if (!response.ok) {
@@ -2224,7 +2326,7 @@ var Rest = class {
2224
2326
  this.node.nodeManager.manager.emit(
2225
2327
  "debug" /* Debug */,
2226
2328
  4 /* Rest */,
2227
- `[Rest] -> [${this.node.id}]: Updated player data for guild: ${data.guildId} | Payload: ${JSON.stringify(data)}`
2329
+ `[Rest] -> [${this.node.id}]: Updated player data for guild: ${data.guildId} | Payload: ${stringify(data)}`
2228
2330
  );
2229
2331
  validatePlayerData.call(this.node, data);
2230
2332
  return this.request({
@@ -2329,7 +2431,7 @@ var DSPXPluginFilter = class {
2329
2431
  *
2330
2432
  * Set the low-pass filter with the given settings.
2331
2433
  * @param {FilterPluginPassSettings} [settings=DefaultFilter.DSPXLowPass] The settings for the low-pass filter.
2332
- * @returns {Promise<boolean>} Whether the filter is now active.
2434
+ * @returns {Promise<this>} The instance of the filter manager.
2333
2435
  */
2334
2436
  async setLowPass(settings = DefaultFilterPreset.DSPXLowPass) {
2335
2437
  validateNodePlugins(this.manager.player.node, ["lavadspx-plugin" /* LavaDspx */]);
@@ -2345,13 +2447,13 @@ var DSPXPluginFilter = class {
2345
2447
  }
2346
2448
  this.manager.filters.lavalinkLavaDspxPlugin.lowPass = !this.manager.filters.lavalinkLavaDspxPlugin.lowPass;
2347
2449
  await this.manager.apply();
2348
- return this.manager.filters.lavalinkLavaDspxPlugin.lowPass;
2450
+ return this;
2349
2451
  }
2350
2452
  /**
2351
2453
  *
2352
2454
  * Set the high-pass filter with the given settings.
2353
2455
  * @param {FilterPluginPassSettings} [settings=DefaultFilter.DSPXHighPass] The settings for the high-pass filter.
2354
- * @returns {Promise<boolean>} Whether the filter is now active.
2456
+ * @returns {Promise<this>} The instance of the filter manager.
2355
2457
  */
2356
2458
  async setHighPass(settings = DefaultFilterPreset.DSPXHighPass) {
2357
2459
  validateNodePlugins(this.manager.player.node, ["lavadspx-plugin" /* LavaDspx */]);
@@ -2367,13 +2469,13 @@ var DSPXPluginFilter = class {
2367
2469
  }
2368
2470
  this.manager.filters.lavalinkLavaDspxPlugin.highPass = !this.manager.filters.lavalinkLavaDspxPlugin.highPass;
2369
2471
  await this.manager.apply();
2370
- return this.manager.filters.lavalinkLavaDspxPlugin.highPass;
2472
+ return this;
2371
2473
  }
2372
2474
  /**
2373
2475
  *
2374
2476
  * Set the normalization filter with the given settings.
2375
2477
  * @param {NormalizationSettings} [settings=DefaultFilter.DSPXNormalization] The settings for the normalization filter.
2376
- * @returns {Promise<boolean>} Whether the filter is now active.
2478
+ * @returns {Promise<this>} The instance of the filter manager.
2377
2479
  */
2378
2480
  async setNormalization(settings = DefaultFilterPreset.DSPXNormalization) {
2379
2481
  validateNodePlugins(this.manager.player.node, ["lavadspx-plugin" /* LavaDspx */]);
@@ -2389,13 +2491,13 @@ var DSPXPluginFilter = class {
2389
2491
  }
2390
2492
  this.manager.filters.lavalinkLavaDspxPlugin.normalization = !this.manager.filters.lavalinkLavaDspxPlugin.normalization;
2391
2493
  await this.manager.apply();
2392
- return this.manager.filters.lavalinkLavaDspxPlugin.normalization;
2494
+ return this;
2393
2495
  }
2394
2496
  /**
2395
2497
  *
2396
2498
  * Set the echo filter with the given settings.
2397
2499
  * @param {EchoSettings} [settings=DefaultFilter.DSPXEcho] The settings for the echo filter.
2398
- * @returns {Promise<boolean>} Whether the filter is now active.
2500
+ * @returns {Promise<this>} The instance of the filter manager.
2399
2501
  */
2400
2502
  async setEcho(settings = DefaultFilterPreset.DSPXEcho) {
2401
2503
  validateNodePlugins(this.manager.player.node, ["lavadspx-plugin" /* LavaDspx */]);
@@ -2411,7 +2513,7 @@ var DSPXPluginFilter = class {
2411
2513
  }
2412
2514
  this.manager.filters.lavalinkLavaDspxPlugin.echo = !this.manager.filters.lavalinkLavaDspxPlugin.echo;
2413
2515
  await this.manager.apply();
2414
- return this.manager.filters.lavalinkLavaDspxPlugin.echo;
2516
+ return this;
2415
2517
  }
2416
2518
  };
2417
2519
 
@@ -2435,7 +2537,7 @@ var LavalinkPluginFilter = class {
2435
2537
  *
2436
2538
  * Set the echo filter with the given settings.
2437
2539
  * @param {Omit<EchoSettings, "echoLength">} [settings=DefaultFilter.PluginEcho] The settings for the echo filter.
2438
- * @returns {Promise<boolean>} Whether the filter is now active.
2540
+ * @returns {Promise<this>} The instance of the filter manager.
2439
2541
  */
2440
2542
  async setEcho(settings = DefaultFilterPreset.PluginEcho) {
2441
2543
  validateNodePlugins(this.manager.player.node, ["lavalink-filter-plugin" /* FilterPlugin */]);
@@ -2451,13 +2553,13 @@ var LavalinkPluginFilter = class {
2451
2553
  this.manager.data.pluginFilters["lavalink-filter-plugin"].echo.decay = this.manager.filters.lavalinkFilterPlugin.echo ? 0 : settings.decay;
2452
2554
  this.manager.filters.lavalinkFilterPlugin.echo = !this.manager.filters.lavalinkFilterPlugin.echo;
2453
2555
  await this.manager.apply();
2454
- return this.manager.filters.lavalinkFilterPlugin.echo;
2556
+ return this;
2455
2557
  }
2456
2558
  /**
2457
2559
  *
2458
2560
  * Set the reverb filter with the given settings.
2459
2561
  * @param {Partial<LavalinkFilterPluginReverbSettings>} [settings=DefaultFilter.PluginReverb] The settings for the reverb filter.
2460
- * @returns {Promise<boolean>} Whether the filter is now active.
2562
+ * @returns {Promise<this>} The instance of the filter manager.
2461
2563
  */
2462
2564
  async setReverb(settings = DefaultFilterPreset.PluginReverb) {
2463
2565
  validateNodePlugins(this.manager.player.node, ["lavalink-filter-plugin" /* FilterPlugin */]);
@@ -2473,7 +2575,7 @@ var LavalinkPluginFilter = class {
2473
2575
  this.manager.data.pluginFilters["lavalink-filter-plugin"].reverb.gains = this.manager.filters.lavalinkFilterPlugin.reverb ? [] : settings.gains;
2474
2576
  this.manager.filters.lavalinkFilterPlugin.reverb = !this.manager.filters.lavalinkFilterPlugin.reverb;
2475
2577
  await this.manager.apply();
2476
- return this.manager.filters.lavalinkFilterPlugin.reverb;
2578
+ return this;
2477
2579
  }
2478
2580
  };
2479
2581
 
@@ -2548,18 +2650,9 @@ var FilterManager = class {
2548
2650
  this.plugin = new LavalinkPluginFilter(this);
2549
2651
  this.dspx = new DSPXPluginFilter(this);
2550
2652
  }
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
2653
  /**
2561
2654
  * Resets all filters to their default values.
2562
- * @returns {Promise<void>} A promise that resolves when the filters have been reset.
2655
+ * @returns {Promise<this>} A promise that resolves to the instance of the filter manager.
2563
2656
  */
2564
2657
  async reset() {
2565
2658
  this.filters = {
@@ -2586,20 +2679,17 @@ var FilterManager = class {
2586
2679
  echo: false
2587
2680
  }
2588
2681
  };
2589
- for (const [key, value] of Object.entries(DefaultPlayerFilters)) {
2590
- this.data[key] = value;
2591
- }
2592
- await this.apply();
2682
+ this.data = { ...DefaultPlayerFilters };
2683
+ return this.apply();
2593
2684
  }
2594
2685
  /**
2595
2686
  *
2596
2687
  * Applies the current filters to the player.
2597
- * @returns {Promise<void>} A promise that resolves when the filters have been applied.
2688
+ * @returns {Promise<this>} A promise that resolves to the instance of the filter manager.
2598
2689
  */
2599
2690
  async apply() {
2600
- if (!this.player.node.sessionId) return;
2691
+ if (!this.player.node.sessionId) return this;
2601
2692
  this.check();
2602
- this.isCustom();
2603
2693
  const filters = { ...this.data };
2604
2694
  if (!this.filters.volume) delete filters.volume;
2605
2695
  if (!this.filters.tremolo) delete filters.tremolo;
@@ -2626,6 +2716,7 @@ var FilterManager = class {
2626
2716
  if (!this.player.node.info?.filters?.includes(key)) delete filters[key];
2627
2717
  }
2628
2718
  await this.player.updatePlayer({ playerOptions: { filters } });
2719
+ return this;
2629
2720
  }
2630
2721
  /**
2631
2722
  * Checks if the current filters are active.
@@ -2647,6 +2738,7 @@ var FilterManager = class {
2647
2738
  this.filters.karaoke = Object.values(this.data.karaoke ?? {}).some((v) => v !== 0);
2648
2739
  this.filters.distortion = Object.values(this.data.distortion ?? {}).some((v) => v !== 0 && v !== 1);
2649
2740
  this.filters.timescale = Object.values(this.data.timescale ?? {}).some((v) => v !== 1);
2741
+ this.filters.custom = !this.filters.nightcore && !this.filters.vaporwave && Object.values(this.data.timescale ?? {}).some((d) => d !== 1);
2650
2742
  if ((this.filters.nightcore || this.filters.vaporwave) && timescale) {
2651
2743
  if (timescale.pitch !== this.data.timescale?.pitch || timescale.rate !== this.data.timescale?.rate || timescale.speed !== this.data.timescale?.speed) {
2652
2744
  this.filters.custom = Object.values(this.data.timescale ?? {}).some((v) => v !== 1);
@@ -2675,34 +2767,32 @@ var FilterManager = class {
2675
2767
  *
2676
2768
  * Sets the volume for the player.
2677
2769
  * @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.
2770
+ * @returns {Promise<this>} A promise that resolves to the player instance.
2679
2771
  */
2680
2772
  async setVolume(volume) {
2681
2773
  if (typeof volume !== "number" || Number.isNaN(volume) || volume < 0 || volume > 5)
2682
2774
  throw new PlayerError("Volume must be a number between 0 and 5.");
2683
2775
  this.data = { volume };
2684
2776
  this.filters.volume = volume !== 1;
2685
- await this.apply();
2686
- return this.filters.volume;
2777
+ return this.apply();
2687
2778
  }
2688
2779
  /**
2689
2780
  * Sets the audio output for the player.
2690
2781
  * @param {AudioOutput} output The audio output to set.
2691
- * @returns {Promise<AudioOutput>} A promise that resolves to the set audio output.
2782
+ * @returns {Promise<this>} A promise that resolves to the player instance.
2692
2783
  */
2693
2784
  async setAudioOutput(output) {
2694
2785
  const outputs = Object.values(AudioOutput);
2695
2786
  if (!outputs.includes(output)) throw new PlayerError(`Audio output must be one of the following: ${outputs.join(", ")}.`);
2696
2787
  this.filters.audioOutput = output;
2697
2788
  this.data.channelMix = AudioOutputData[output];
2698
- await this.apply();
2699
- return this.filters.audioOutput;
2789
+ return this.apply();
2700
2790
  }
2701
2791
  /**
2702
2792
  *
2703
2793
  * Sets the speed for the player.
2704
2794
  * @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.
2795
+ * @returns {Promise<this>} A promise that resolves to the player instance.
2706
2796
  */
2707
2797
  async setSpeed(speed = 1) {
2708
2798
  if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
@@ -2717,14 +2807,13 @@ var FilterManager = class {
2717
2807
  this.filters.vaporwave = false;
2718
2808
  }
2719
2809
  this.data.timescale.speed = speed;
2720
- await this.apply();
2721
- return this.filters.custom;
2810
+ return this.apply();
2722
2811
  }
2723
2812
  /**
2724
2813
  *
2725
2814
  * Sets the rate for the player.
2726
2815
  * @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.
2816
+ * @returns {Promise<this>} A promise that resolves to the player instance.
2728
2817
  */
2729
2818
  async setRate(rate = 1) {
2730
2819
  if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
@@ -2739,14 +2828,13 @@ var FilterManager = class {
2739
2828
  this.filters.vaporwave = false;
2740
2829
  }
2741
2830
  this.data.timescale.rate = rate;
2742
- await this.apply();
2743
- return this.filters.custom;
2831
+ return this.apply();
2744
2832
  }
2745
2833
  /**
2746
2834
  *
2747
2835
  * Sets the pitch for the player.
2748
2836
  * @param {number} pitch The pitch
2749
- * @returns {Promise<boolean>} A promise that resolves to true if a custom filter is active, false otherwise.
2837
+ * @returns {Promise<this>} A promise that resolves to the player instance.
2750
2838
  */
2751
2839
  async setPitch(pitch = 1) {
2752
2840
  if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
@@ -2761,8 +2849,7 @@ var FilterManager = class {
2761
2849
  this.filters.vaporwave = false;
2762
2850
  }
2763
2851
  this.data.timescale.pitch = pitch;
2764
- await this.apply();
2765
- return this.filters.custom;
2852
+ return this.apply();
2766
2853
  }
2767
2854
  /**
2768
2855
  *
@@ -2775,8 +2862,7 @@ var FilterManager = class {
2775
2862
  if (!bands.length || !bands.every((band) => typeof band.band === "number" && typeof band.gain === "number"))
2776
2863
  throw new PlayerError("Bands must be a non-empty object array containing 'band' and 'gain' properties.");
2777
2864
  for (const { band, gain } of bands) this.bands[band] = { band, gain };
2778
- await this.apply();
2779
- return this;
2865
+ return this.apply();
2780
2866
  }
2781
2867
  /**
2782
2868
  *
@@ -2790,7 +2876,7 @@ var FilterManager = class {
2790
2876
  *
2791
2877
  * Set the vibrato filter with the given settings.
2792
2878
  * @param {TremoloSettings} [settings=DefaultFilterPreset.Vibrato] The settings for the vibrato filter.
2793
- * @returns {Promise<boolean>} Whether the filter is now active.
2879
+ * @returns {Promise<this>} The instance of the filter manager.
2794
2880
  */
2795
2881
  async setVibrato(settings = DefaultFilterPreset.Vibrato) {
2796
2882
  if (!this.player.node.info?.filters?.includes("vibrato" /* Vibrato */))
@@ -2800,14 +2886,13 @@ var FilterManager = class {
2800
2886
  depth: this.filters.vibrato ? 0 : settings.depth
2801
2887
  };
2802
2888
  this.filters.vibrato = !this.filters.vibrato;
2803
- await this.apply();
2804
- return this.filters.vibrato;
2889
+ return this.apply();
2805
2890
  }
2806
2891
  /**
2807
2892
  *
2808
2893
  * Set the tremolo filter with the given settings.
2809
2894
  * @param {TremoloSettings} [settings=DefaultFilterPreset.Tremolo] The settings for the tremolo filter.
2810
- * @returns {Promise<boolean>} Whether the filter is now active.
2895
+ * @returns {Promise<this>} The instance of the filter manager.
2811
2896
  */
2812
2897
  async setTremolo(settings = DefaultFilterPreset.Tremolo) {
2813
2898
  if (!this.player.node.info?.filters?.includes("tremolo" /* Tremolo */))
@@ -2817,27 +2902,25 @@ var FilterManager = class {
2817
2902
  depth: this.filters.tremolo ? 0 : settings.depth
2818
2903
  };
2819
2904
  this.filters.tremolo = !this.filters.tremolo;
2820
- await this.apply();
2821
- return this.filters.tremolo;
2905
+ return this.apply();
2822
2906
  }
2823
2907
  /**
2824
2908
  *
2825
2909
  * Set the low-pass filter with the given settings.
2826
2910
  * @param {LowPassSettings} [settings=DefaultFilterPreset.Lowpass] The settings for the low-pass filter.
2827
- * @returns {Promise<boolean>} Whether the filter is now active.
2911
+ * @returns {Promise<this>} The instance of the filter manager.
2828
2912
  */
2829
2913
  async setLowPass(settings = DefaultFilterPreset.Lowpass) {
2830
2914
  if (!this.player.node.info?.filters?.includes("lowPass" /* LowPass */))
2831
2915
  throw new PlayerError("Node filters does not include the 'lowPass' filter. (Or the node doesn't have it enabled)");
2832
2916
  this.data.lowPass = { smoothing: this.filters.lowPass ? 0 : settings.smoothing };
2833
2917
  this.filters.lowPass = !this.filters.lowPass;
2834
- await this.apply();
2835
- return this.filters.lowPass;
2918
+ return this.apply();
2836
2919
  }
2837
2920
  /**
2838
2921
  * Set the nightcore filter with the given settings.
2839
2922
  * @param {Partial<TimescaleSettings>} [settings=DefaultFilterPreset.Nightcore] The settings for the nightcore filter.
2840
- * @returns {Promise<boolean>} Whether the filter is now active.
2923
+ * @returns {Promise<this>} The instance of the filter manager.
2841
2924
  */
2842
2925
  async setNightcore(settings = DefaultFilterPreset.Nightcore) {
2843
2926
  if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
@@ -2850,14 +2933,13 @@ var FilterManager = class {
2850
2933
  this.filters.nightcore = !this.filters.nightcore;
2851
2934
  this.filters.vaporwave = false;
2852
2935
  this.filters.custom = false;
2853
- await this.apply();
2854
- return this.filters.nightcore;
2936
+ return this.apply();
2855
2937
  }
2856
2938
  /**
2857
2939
  *
2858
2940
  * Set the vaporwave filter with the given settings.
2859
2941
  * @param {Partial<TimescaleSettings>} [settings=DefaultFilterPreset.Vaporwave] The settings for the vaporwave filter.
2860
- * @returns {Promise<boolean>} Whether the filter is now active.
2942
+ * @returns {Promise<this>} The instance of the filter manager.
2861
2943
  */
2862
2944
  async setVaporwave(settings = DefaultFilterPreset.Vaporwave) {
2863
2945
  if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
@@ -2870,14 +2952,13 @@ var FilterManager = class {
2870
2952
  this.filters.vaporwave = !this.filters.vaporwave;
2871
2953
  this.filters.nightcore = false;
2872
2954
  this.filters.custom = false;
2873
- await this.apply();
2874
- return this.filters.vaporwave;
2955
+ return this.apply();
2875
2956
  }
2876
2957
  /**
2877
2958
  *
2878
2959
  * Set the karaoke filter with the given settings.
2879
2960
  * @param {KaraokeSettings} [settings=DefaultFilterPreset.Karaoke] The settings for the karaoke filter.
2880
- * @returns {Promise<boolean>} Whether the filter is now active.
2961
+ * @returns {Promise<this>} The instance of the filter manager.
2881
2962
  */
2882
2963
  async setKaraoke(settings = DefaultFilterPreset.Karaoke) {
2883
2964
  if (!this.player.node.info?.filters?.includes("karaoke" /* Karaoke */))
@@ -2889,14 +2970,13 @@ var FilterManager = class {
2889
2970
  filterWidth: this.data.karaoke.filterWidth ? 0 : settings.filterWidth
2890
2971
  };
2891
2972
  this.filters.karaoke = !this.filters.karaoke;
2892
- await this.apply();
2893
- return this.filters.karaoke;
2973
+ return this.apply();
2894
2974
  }
2895
2975
  /**
2896
2976
  *
2897
2977
  * Set the distortion filter with the given settings.
2898
2978
  * @param {Partial<DistortionSettings>} [settings=DefaultFilterPreset.Distortion] The settings for the distortion filter.
2899
- * @returns {Promise<boolean>} Whether the filter is now active.
2979
+ * @returns {Promise<this>} The instance of the filter manager.
2900
2980
  */
2901
2981
  async setDistortion(settings = DefaultFilterPreset.Distortion) {
2902
2982
  if (!this.player.node.info?.filters?.includes("distortion" /* Distortion */))
@@ -2911,13 +2991,12 @@ var FilterManager = class {
2911
2991
  scale: this.filters.distortion ? 1 : settings.scale
2912
2992
  };
2913
2993
  this.filters.distortion = !this.filters.distortion;
2914
- await this.apply();
2915
- return this.filters.distortion;
2994
+ return this.apply();
2916
2995
  }
2917
2996
  /**
2918
2997
  * Set the timescale filter with the given settings.
2919
2998
  * @param {Partial<TimescaleSettings>} settings The timescale settings to set.
2920
- * @returns {Promise<boolean>} Whether the filter is now active.
2999
+ * @returns {Promise<this>} The instance of the filter manager.
2921
3000
  */
2922
3001
  async setTimescale(settings) {
2923
3002
  if (!this.player.node.info?.filters?.includes("timescale" /* Timescale */))
@@ -2928,8 +3007,14 @@ var FilterManager = class {
2928
3007
  speed: settings.speed ?? 1
2929
3008
  };
2930
3009
  this.filters.timescale = !this.filters.timescale;
2931
- await this.apply();
2932
- return this.filters.timescale;
3010
+ return this.apply();
3011
+ }
3012
+ /**
3013
+ * Convert the filter settings to a JSON object.
3014
+ * @returns {FilterSettings} The filter settings as a JSON object.
3015
+ */
3016
+ toJSON() {
3017
+ return { ...this.data };
2933
3018
  }
2934
3019
  };
2935
3020
 
@@ -3123,10 +3208,23 @@ var Player = class {
3123
3208
  */
3124
3209
  createdTimestamp = 0;
3125
3210
  /**
3126
- * The position of the player.
3211
+ * The last position received from Lavalink.
3127
3212
  * @type {number}
3128
3213
  */
3129
- position = 0;
3214
+ lastPosition = 0;
3215
+ /**
3216
+ * The timestamp when the last position change update happened.
3217
+ * @type {number | null}
3218
+ */
3219
+ lastPositionUpdate = null;
3220
+ /**
3221
+ * The current calculated position of the player.
3222
+ * @type {number}
3223
+ * @readonly
3224
+ */
3225
+ get position() {
3226
+ return this.lastPosition + (this.lastPositionUpdate ? Date.now() - this.lastPositionUpdate : 0);
3227
+ }
3130
3228
  /**
3131
3229
  * The voice connection details.
3132
3230
  * @type {PlayerVoice}
@@ -3248,6 +3346,8 @@ var Player = class {
3248
3346
  if (typeof position !== "number" || Number.isNaN(position) || position < 0)
3249
3347
  throw new PlayerError("Position must be a positive number.");
3250
3348
  this.manager.emit("debug" /* Debug */, 3 /* Player */, `[Player] -> [Seek] Seeking to ${position} for guild: ${this.guildId}`);
3349
+ this.lastPosition = position;
3350
+ this.lastPositionUpdate = Date.now();
3251
3351
  await this.updatePlayer({ playerOptions: { position } });
3252
3352
  }
3253
3353
  /**
@@ -3321,10 +3421,15 @@ var Player = class {
3321
3421
  if (!isTrack(this.queue.current) && !isUnresolvedTrack(this.queue.current))
3322
3422
  throw new PlayerError("The track must be a valid Track or UnresolvedTrack instance.");
3323
3423
  this.manager.emit("debug" /* Debug */, 3 /* Player */, `[Player] -> [Play] A new track is playing: ${this.queue.current.info.title}`);
3424
+ const position = options.position ?? 0;
3425
+ this.lastPosition = position;
3426
+ this.lastPositionUpdate = Date.now();
3324
3427
  await this.updatePlayer({
3325
3428
  noReplace: options.noReplace,
3326
3429
  playerOptions: {
3327
3430
  ...options,
3431
+ position,
3432
+ // Ensure position is sent to Lavalink
3328
3433
  track: {
3329
3434
  userData: this.queue.current.userData,
3330
3435
  encoded: this.queue.current.encoded
@@ -3374,7 +3479,8 @@ var Player = class {
3374
3479
  this.manager.emit("debug" /* Debug */, 3 /* Player */, `[Player] -> [Stop] Player stopped for guild: ${this.guildId}`);
3375
3480
  this.playing = false;
3376
3481
  this.paused = false;
3377
- this.position = 0;
3482
+ this.lastPosition = 0;
3483
+ this.lastPositionUpdate = null;
3378
3484
  this.queue.current = null;
3379
3485
  return;
3380
3486
  }
@@ -3394,6 +3500,12 @@ var Player = class {
3394
3500
  3 /* Player */,
3395
3501
  `[Player] -> [Pause] Player is now ${paused ? "paused" : "resumed"} for guild: ${this.guildId}`
3396
3502
  );
3503
+ if (paused) {
3504
+ this.lastPositionUpdate = null;
3505
+ } else {
3506
+ this.lastPosition = this.position;
3507
+ this.lastPositionUpdate = Date.now();
3508
+ }
3397
3509
  await this.updatePlayer({ playerOptions: { paused } });
3398
3510
  return paused;
3399
3511
  }
@@ -3561,6 +3673,13 @@ var Player = class {
3561
3673
  selfDeaf: this.selfDeaf,
3562
3674
  options: this.options,
3563
3675
  voice: this.voice,
3676
+ textId: this.textId,
3677
+ lastPosition: this.lastPosition,
3678
+ lastPositionUpdate: this.lastPositionUpdate,
3679
+ position: this.position,
3680
+ createdTimestamp: this.createdTimestamp,
3681
+ ping: this.ping,
3682
+ filters: this.filterManager.toJSON(),
3564
3683
  queue: this.queue.toJSON(),
3565
3684
  node: this.node.toJSON()
3566
3685
  };
@@ -3689,7 +3808,7 @@ var QueueUtils = class {
3689
3808
  this.queue.player.manager.emit(
3690
3809
  "debug" /* Debug */,
3691
3810
  5 /* Queue */,
3692
- `[Queue] -> [Adapter] Saving queue for ${this.queue.player.guildId} | Object: ${JSON.stringify(json)}`
3811
+ `[Queue] -> [Adapter] Saving queue for ${this.queue.player.guildId} | Object: ${stringify(json)}`
3693
3812
  );
3694
3813
  return this.store.set(this.queue.player.guildId, json);
3695
3814
  }
@@ -3731,7 +3850,7 @@ var QueueUtils = class {
3731
3850
  this.queue.player.manager.emit(
3732
3851
  "debug" /* Debug */,
3733
3852
  5 /* Queue */,
3734
- `[Queue] -> [Adapter] Syncing queue for ${this.queue.player.guildId} | Object: ${JSON.stringify(data)}`
3853
+ `[Queue] -> [Adapter] Syncing queue for ${this.queue.player.guildId} | Object: ${stringify(data)}`
3735
3854
  );
3736
3855
  await this.save();
3737
3856
  }
@@ -4485,7 +4604,7 @@ var Hoshimi = class extends import_node_events.EventEmitter {
4485
4604
  this.emit(
4486
4605
  "debug" /* Debug */,
4487
4606
  1 /* Manager */,
4488
- `[Manager] -> [Search] Searching for: ${options.query} (${options.engine ?? "unknown"}) | Result: ${JSON.stringify(res)}`
4607
+ `[Manager] -> [Search] Searching for: ${options.query} (${options.engine ?? "unknown"}) | Result: ${stringify(res)}`
4489
4608
  );
4490
4609
  switch (res.loadType) {
4491
4610
  case "empty" /* Empty */: {
@@ -4570,6 +4689,7 @@ function createHoshimi(...args) {
4570
4689
  Queue,
4571
4690
  ResolveError,
4572
4691
  Rest,
4692
+ RestPathType,
4573
4693
  SearchEngines,
4574
4694
  Severity,
4575
4695
  SourceNames,