music: fix youtube

This commit is contained in:
Cynthia Foxwell 2023-01-23 18:07:17 -07:00
parent ea21e71c10
commit f049e6f8fe
1 changed files with 3 additions and 2 deletions

View File

@ -213,7 +213,7 @@ async function enqueue({
].url ].url
.replace("vi_webp", "vi") .replace("vi_webp", "vi")
.replace(".webp", ".jpg"); .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") { } 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/");
@ -577,7 +577,7 @@ command.callback = async function (
} }
// TODO: skip lock checks // TODO: skip lock checks
await connection.stopPlaying(); await connection.connection.stopPlaying();
return {reaction: "\u23ed"}; return {reaction: "\u23ed"};
} else { } else {
return "You are not in a voice channel."; return "You are not in a voice channel.";
@ -596,6 +596,7 @@ command.callback = async function (
// TODO: skip lock checks // TODO: skip lock checks
connection.queue = []; connection.queue = [];
connection.__leave = true; connection.__leave = true;
await connection.connection.stopPlaying();
connection.onEnd(); connection.onEnd();
await hf.bot.leaveVoiceChannel(msg.member.voiceState.channelID); await hf.bot.leaveVoiceChannel(msg.member.voiceState.channelID);
return {reaction: "\uD83D\uDC4B"}; return {reaction: "\uD83D\uDC4B"};