music: fix missed ytdl call

This commit is contained in:
Cynthia Foxwell 2022-12-10 14:58:41 -07:00
parent 8d47c64fd8
commit c7fe95623c
1 changed files with 6 additions and 10 deletions

View File

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