🐛 Fix fromPlaylist again
This commit is contained in:
parent
daa3d023a6
commit
d443652c8c
2 changed files with 3 additions and 8 deletions
|
@ -315,12 +315,7 @@ class Player extends EventEmitter {
|
||||||
async _handlePlaylist (message, query) {
|
async _handlePlaylist (message, query) {
|
||||||
const playlist = await ytsr.getPlaylist(query)
|
const playlist = await ytsr.getPlaylist(query)
|
||||||
if (!playlist) return this.emit('noResults', message, query)
|
if (!playlist) return this.emit('noResults', message, query)
|
||||||
playlist.tracks = playlist.videos.map((item) => new Track({
|
playlist.tracks = playlist.videos.map((item) => new Track(item, message.author, this, true))
|
||||||
...item,
|
|
||||||
...{
|
|
||||||
fromPlaylist: true
|
|
||||||
}
|
|
||||||
}, message.author))
|
|
||||||
playlist.duration = playlist.tracks.reduce((prev, next) => prev + next.duration, 0)
|
playlist.duration = playlist.tracks.reduce((prev, next) => prev + next.duration, 0)
|
||||||
playlist.thumbnail = playlist.tracks[0].thumbnail
|
playlist.thumbnail = playlist.tracks[0].thumbnail
|
||||||
playlist.requestedBy = message.author
|
playlist.requestedBy = message.author
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Track {
|
||||||
* @param {Discord.User | null} user The user who requested the track
|
* @param {Discord.User | null} user The user who requested the track
|
||||||
* @param {Player} player
|
* @param {Player} player
|
||||||
*/
|
*/
|
||||||
constructor (videoData, user, player) {
|
constructor (videoData, user, player, fromPlaylist = false) {
|
||||||
/**
|
/**
|
||||||
* The player instantiating the track
|
* The player instantiating the track
|
||||||
* @type {Player}
|
* @type {Player}
|
||||||
|
@ -66,7 +66,7 @@ class Track {
|
||||||
* Whether the track was added from a playlist
|
* Whether the track was added from a playlist
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
this.fromPlaylist = videoData.fromPlaylist || false
|
this.fromPlaylist = fromPlaylist
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue