Update Player.ts

This commit is contained in:
watchdogsrox 2021-04-29 04:49:31 -04:00 committed by GitHub
parent c712f2d8c6
commit fd0450bf18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -182,7 +182,6 @@ export class Player extends EventEmitter {
const playlist = await spotify.getData(query); const playlist = await spotify.getData(query);
if (!playlist) return void this.emit(PlayerEvents.NO_RESULTS, message, query); if (!playlist) return void this.emit(PlayerEvents.NO_RESULTS, message, query);
//Much faster loading
const tracks = await Promise.all(playlist.tracks.items.map(async (track) => { const tracks = await Promise.all(playlist.tracks.items.map(async (track) => {
const sq = const sq =
queryType === 'spotify_album' queryType === 'spotify_album'
@ -198,24 +197,6 @@ export class Player extends EventEmitter {
return results[0]; return results[0];
})); }));
// // tslint:disable:no-shadowed-variable
// const tracks = [];
// for (const item of playlist.tracks.items) {
// const sq =
// queryType === 'spotify_album'
// ? `${item.artists[0].name} - ${item.name}`
// : `${item.track.artists[0].name} - ${item.name}`;
// const data = await Util.ytSearch(sq, {
// limit: 1,
// player: this,
// user: message.author,
// pl: true
// });
// if (data[0]) tracks.push(data[0]);
// }
if (!tracks.length) return void this.emit(PlayerEvents.NO_RESULTS, message, query); if (!tracks.length) return void this.emit(PlayerEvents.NO_RESULTS, message, query);
const pl = { const pl = {