Make sure music search results aren't counted as playlists

This commit is contained in:
Essem 2021-09-14 22:40:44 -05:00
parent 4caad42240
commit 3b4b302634
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C

View file

@ -67,7 +67,8 @@ export async function play(client, sound, message, music = false) {
const oldQueue = queues.get(voiceChannel.guild.id); const oldQueue = queues.get(voiceChannel.guild.id);
if (!tracks || tracks.length === 0) return "I couldn't find that song!"; if (!tracks || tracks.length === 0) return "I couldn't find that song!";
if (music) { if (music) {
const playlistTracks = tracks.map((val) => { return val.track; }); const sortedTracks = tracks.map((val) => { return val.track; });
const playlistTracks = playlistInfo.selectedTrack !== undefined ? sortedTracks : [sortedTracks[0]];
queues.set(voiceChannel.guild.id, oldQueue ? [...oldQueue, ...playlistTracks] : playlistTracks); queues.set(voiceChannel.guild.id, oldQueue ? [...oldQueue, ...playlistTracks] : playlistTracks);
} }
const connection = await manager.join({ const connection = await manager.join({