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.d.mts
CHANGED
|
@@ -983,9 +983,10 @@ declare class Queue extends DisTubeBase {
|
|
|
983
983
|
seek(time: number): Queue;
|
|
984
984
|
/**
|
|
985
985
|
* Add a related song of the playing song to the queue
|
|
986
|
+
* @param song - The song to get related songs from. Defaults to the current playing song.
|
|
986
987
|
* @returns The added song
|
|
987
988
|
*/
|
|
988
|
-
addRelatedSong(): Promise<Song>;
|
|
989
|
+
addRelatedSong(song?: Song): Promise<Song>;
|
|
989
990
|
/**
|
|
990
991
|
* Stop the guild stream and delete the queue
|
|
991
992
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -983,9 +983,10 @@ declare class Queue extends DisTubeBase {
|
|
|
983
983
|
seek(time: number): Queue;
|
|
984
984
|
/**
|
|
985
985
|
* Add a related song of the playing song to the queue
|
|
986
|
+
* @param song - The song to get related songs from. Defaults to the current playing song.
|
|
986
987
|
* @returns The added song
|
|
987
988
|
*/
|
|
988
|
-
addRelatedSong(): Promise<Song>;
|
|
989
|
+
addRelatedSong(song?: Song): Promise<Song>;
|
|
989
990
|
/**
|
|
990
991
|
* Stop the guild stream and delete the queue
|
|
991
992
|
*/
|
package/dist/index.js
CHANGED
|
@@ -81,7 +81,7 @@ __export(index_exports, {
|
|
|
81
81
|
module.exports = __toCommonJS(index_exports);
|
|
82
82
|
|
|
83
83
|
// src/constant.ts
|
|
84
|
-
var version = "5.1.
|
|
84
|
+
var version = "5.1.2";
|
|
85
85
|
var defaultFilters = {
|
|
86
86
|
"3d": "apulsator=hz=0.125",
|
|
87
87
|
bassboost: "bass=g=10",
|
|
@@ -1073,10 +1073,11 @@ var Queue = class extends DisTubeBase {
|
|
|
1073
1073
|
}
|
|
1074
1074
|
/**
|
|
1075
1075
|
* Add a related song of the playing song to the queue
|
|
1076
|
+
* @param song - The song to get related songs from. Defaults to the current playing song.
|
|
1076
1077
|
* @returns The added song
|
|
1077
1078
|
*/
|
|
1078
|
-
async addRelatedSong() {
|
|
1079
|
-
const current = this.songs?.[0];
|
|
1079
|
+
async addRelatedSong(song) {
|
|
1080
|
+
const current = song ?? this.songs?.[0];
|
|
1080
1081
|
if (!current) throw new DisTubeError("NO_PLAYING_SONG");
|
|
1081
1082
|
const prevIds = this.previousSongs.map((p) => p.id);
|
|
1082
1083
|
const relatedSongs = (await this.#getRelatedSong(current)).filter((s) => !prevIds.includes(s.id));
|
|
@@ -1086,12 +1087,12 @@ var Queue = class extends DisTubeBase {
|
|
|
1086
1087
|
if (altSong) relatedSongs.push(...(await this.#getRelatedSong(altSong)).filter((s) => !prevIds.includes(s.id)));
|
|
1087
1088
|
this.debug(`[${this.id}] Getting related songs from streamed song: ${altSong}`);
|
|
1088
1089
|
}
|
|
1089
|
-
const
|
|
1090
|
-
if (!
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
this.addToQueue(
|
|
1094
|
-
return
|
|
1090
|
+
const nextSong = relatedSongs[0];
|
|
1091
|
+
if (!nextSong) throw new DisTubeError("NO_RELATED");
|
|
1092
|
+
nextSong.metadata = current.metadata;
|
|
1093
|
+
nextSong.member = this.clientMember;
|
|
1094
|
+
this.addToQueue(nextSong);
|
|
1095
|
+
return nextSong;
|
|
1095
1096
|
}
|
|
1096
1097
|
/**
|
|
1097
1098
|
* Stop the guild stream and delete the queue
|
|
@@ -1998,7 +1999,7 @@ var QueueManager = class extends GuildIdManager {
|
|
|
1998
1999
|
if (queue.songs.length === 0 && queue.autoplay) {
|
|
1999
2000
|
try {
|
|
2000
2001
|
this.debug(`[QueueManager] Adding related song: ${queue.id}`);
|
|
2001
|
-
await queue.addRelatedSong();
|
|
2002
|
+
await queue.addRelatedSong(song);
|
|
2002
2003
|
} catch (e) {
|
|
2003
2004
|
this.debug(`[${queue.id}] Add related song error: ${e.message}`);
|
|
2004
2005
|
this.emit("noRelated" /* NO_RELATED */, queue, e);
|
|
@@ -2070,6 +2071,7 @@ var QueueManager = class extends GuildIdManager {
|
|
|
2070
2071
|
},
|
|
2071
2072
|
seek: willPlaySong.duration ? queue._beginTime : void 0
|
|
2072
2073
|
};
|
|
2074
|
+
queue._beginTime = 0;
|
|
2073
2075
|
const dtStream = new DisTubeStream(stream.url, streamOptions);
|
|
2074
2076
|
dtStream.on("debug", (data) => this.emit("ffmpegDebug" /* FFMPEG_DEBUG */, `[${queue.id}] ${data}`));
|
|
2075
2077
|
this.debug(`[${queue.id}] Started playing: ${willPlaySong}`);
|