music: fix youtube

This commit is contained in:
Cynthia Foxwell 2023-01-23 18:07:17 -07:00
parent ea21e71c10
commit f049e6f8fe

View file

@ -213,7 +213,7 @@ async function enqueue({
].url
.replace("vi_webp", "vi")
.replace(".webp", ".jpg");
media = await playdl.stream(url);
media = {url: info?.formats.sort((a, b) => b.bitrate - a.bitrate)[0].url};
} else if (type == "sc") {
if (url?.startsWith("sc:"))
url = url.replace(/^sc:/, "https://soundcloud.com/");
@ -577,7 +577,7 @@ command.callback = async function (
}
// TODO: skip lock checks
await connection.stopPlaying();
await connection.connection.stopPlaying();
return {reaction: "\u23ed"};
} else {
return "You are not in a voice channel.";
@ -596,6 +596,7 @@ command.callback = async function (
// TODO: skip lock checks
connection.queue = [];
connection.__leave = true;
await connection.connection.stopPlaying();
connection.onEnd();
await hf.bot.leaveVoiceChannel(msg.member.voiceState.channelID);
return {reaction: "\uD83D\uDC4B"};