formatting

This commit is contained in:
Snowflake107 2021-05-09 18:09:20 +05:45
parent 892fc29a18
commit 3a09c17248

View file

@ -177,27 +177,29 @@ export class Player extends EventEmitter {
} }
break; break;
case 'spotify_album': case 'spotify_album':
case 'spotify_playlist': { case 'spotify_playlist': {
this.emit(PlayerEvents.PLAYLIST_PARSE_START, null, message); this.emit(PlayerEvents.PLAYLIST_PARSE_START, null, message);
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);
const tracks = await Promise.all<Track>(playlist.tracks.items.map(async (item: any) => { const tracks = await Promise.all<Track>(
const sq = playlist.tracks.items.map(async (item: any) => {
queryType === 'spotify_album' const sq =
? `${item.artists[0].name} - ${item.name}` queryType === 'spotify_album'
: `${item.track.artists[0].name} - ${item.name}`; ? `${item.artists[0].name} - ${item.name}`
: `${item.track.artists[0].name} - ${item.name}`;
const data = await Util.ytSearch(sq, { const data = await Util.ytSearch(sq, {
limit: 1, limit: 1,
player: this, player: this,
user: message.author, user: message.author,
pl: true pl: true
}); });
return data[0]; return 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);