distube 5.1.0 → 5.1.2
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +12 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -6
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
4
|
// src/constant.ts
|
|
5
|
-
var version = "5.1.
|
|
5
|
+
var version = "5.1.2";
|
|
6
6
|
var defaultFilters = {
|
|
7
7
|
"3d": "apulsator=hz=0.125",
|
|
8
8
|
bassboost: "bass=g=10",
|
|
@@ -1001,10 +1001,11 @@ var Queue = class extends DisTubeBase {
|
|
|
1001
1001
|
}
|
|
1002
1002
|
/**
|
|
1003
1003
|
* Add a related song of the playing song to the queue
|
|
1004
|
+
* @param song - The song to get related songs from. Defaults to the current playing song.
|
|
1004
1005
|
* @returns The added song
|
|
1005
1006
|
*/
|
|
1006
|
-
async addRelatedSong() {
|
|
1007
|
-
const current = this.songs?.[0];
|
|
1007
|
+
async addRelatedSong(song) {
|
|
1008
|
+
const current = song ?? this.songs?.[0];
|
|
1008
1009
|
if (!current) throw new DisTubeError("NO_PLAYING_SONG");
|
|
1009
1010
|
const prevIds = this.previousSongs.map((p) => p.id);
|
|
1010
1011
|
const relatedSongs = (await this.#getRelatedSong(current)).filter((s) => !prevIds.includes(s.id));
|
|
@@ -1014,12 +1015,12 @@ var Queue = class extends DisTubeBase {
|
|
|
1014
1015
|
if (altSong) relatedSongs.push(...(await this.#getRelatedSong(altSong)).filter((s) => !prevIds.includes(s.id)));
|
|
1015
1016
|
this.debug(`[${this.id}] Getting related songs from streamed song: ${altSong}`);
|
|
1016
1017
|
}
|
|
1017
|
-
const
|
|
1018
|
-
if (!
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
this.addToQueue(
|
|
1022
|
-
return
|
|
1018
|
+
const nextSong = relatedSongs[0];
|
|
1019
|
+
if (!nextSong) throw new DisTubeError("NO_RELATED");
|
|
1020
|
+
nextSong.metadata = current.metadata;
|
|
1021
|
+
nextSong.member = this.clientMember;
|
|
1022
|
+
this.addToQueue(nextSong);
|
|
1023
|
+
return nextSong;
|
|
1023
1024
|
}
|
|
1024
1025
|
/**
|
|
1025
1026
|
* Stop the guild stream and delete the queue
|
|
@@ -1926,7 +1927,7 @@ var QueueManager = class extends GuildIdManager {
|
|
|
1926
1927
|
if (queue.songs.length === 0 && queue.autoplay) {
|
|
1927
1928
|
try {
|
|
1928
1929
|
this.debug(`[QueueManager] Adding related song: ${queue.id}`);
|
|
1929
|
-
await queue.addRelatedSong();
|
|
1930
|
+
await queue.addRelatedSong(song);
|
|
1930
1931
|
} catch (e) {
|
|
1931
1932
|
this.debug(`[${queue.id}] Add related song error: ${e.message}`);
|
|
1932
1933
|
this.emit("noRelated" /* NO_RELATED */, queue, e);
|
|
@@ -1998,6 +1999,7 @@ var QueueManager = class extends GuildIdManager {
|
|
|
1998
1999
|
},
|
|
1999
2000
|
seek: willPlaySong.duration ? queue._beginTime : void 0
|
|
2000
2001
|
};
|
|
2002
|
+
queue._beginTime = 0;
|
|
2001
2003
|
const dtStream = new DisTubeStream(stream.url, streamOptions);
|
|
2002
2004
|
dtStream.on("debug", (data) => this.emit("ffmpegDebug" /* FFMPEG_DEBUG */, `[${queue.id}] ${data}`));
|
|
2003
2005
|
this.debug(`[${queue.id}] Started playing: ${willPlaySong}`);
|