music: fix missed ytdl call

This commit is contained in:
Cynthia Foxwell 2022-12-10 14:58:41 -07:00
parent 8d47c64fd8
commit c7fe95623c

View file

@ -215,25 +215,21 @@ async function enqueue({
if (type == "yt") { if (type == "yt") {
let info; let info;
try { try {
info = await ytdl.getInfo(url, {}); info = await playdl.video_info(url);
} catch (err) { } catch (err) {
await textChannel.createMessage({ await textChannel.createMessage({
content: `:warning: Failed to get metadata: \`\`\`\n${err}\n\`\`\``, content: `:warning: Failed to get metadata: \`\`\`\n${err}\n\`\`\``,
}); });
} }
title = info?.videoDetails?.title; title = info?.video_details?.title;
length = info?.videoDetails?.lengthSeconds * 1000; length = info?.video_details?.durationInSec * 1000;
thumbnail = info?.videoDetails?.thumbnails?.[ thumbnail = info?.video_details?.thumbnails?.[
info.videoDetails.thumbnails.length - 1 info.video_details.thumbnails.length - 1
].url ].url
.replace("vi_webp", "vi") .replace("vi_webp", "vi")
.replace(".webp", ".jpg"); .replace(".webp", ".jpg");
media = await playdl.stream(url, { media = await playdl.stream(url);
quality: "highestaudio",
filter: "audioonly",
highWaterMark: 1 << 25,
});
} else if (type == "sc") { } else if (type == "sc") {
if (url?.startsWith("sc:")) if (url?.startsWith("sc:"))
url = url.replace(/^sc:/, "https://soundcloud.com/"); url = url.replace(/^sc:/, "https://soundcloud.com/");