music: fix playlists, fix search returning the url

This commit is contained in:
Cynthia Foxwell 2023-09-12 22:39:11 -06:00
parent 72133d4fa7
commit eb78747d36
1 changed files with 3 additions and 3 deletions

View File

@ -230,7 +230,7 @@ async function enqueue({
length = info?.duration * 1000;
thumbnail = info?.thumbnailUrl;
media = info?.audioStreams?.sort((a, b) => a.bitrate - b.bitrate)?.[0];
media = info?.audioStreams?.sort((a, b) => a.bitrate - b.bitrate)?.[0]?.url;
} else if (type == "sc") {
if (url?.startsWith("sc:"))
url = url.replace(/^sc:/, "https://soundcloud.com/");
@ -506,7 +506,7 @@ command.callback = async function (
for (const track of playlist) {
let url;
if (type == "yt") {
url = "https://youtu.be/" + track.snippet.resourceId.videoId;
url = "https://youtube.com" + track.url;
} else if (type == "sc") {
url = track.track
? track.track.permalink_url
@ -566,7 +566,7 @@ command.callback = async function (
}
} else {
const url = await youtubeSearch(msg, argStr);
if (url?.startsWith("https://youtu.be/")) {
if (url?.startsWith("https://youtube.com/")) {
await enqueue({
guild_id: msg.guildID,
voice_id: msg.member.voiceState.channelID,