music: fix playlists, fix search returning the url
This commit is contained in:
parent
72133d4fa7
commit
eb78747d36
1 changed files with 3 additions and 3 deletions
|
@ -230,7 +230,7 @@ async function enqueue({
|
||||||
length = info?.duration * 1000;
|
length = info?.duration * 1000;
|
||||||
thumbnail = info?.thumbnailUrl;
|
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") {
|
} 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/");
|
||||||
|
@ -506,7 +506,7 @@ command.callback = async function (
|
||||||
for (const track of playlist) {
|
for (const track of playlist) {
|
||||||
let url;
|
let url;
|
||||||
if (type == "yt") {
|
if (type == "yt") {
|
||||||
url = "https://youtu.be/" + track.snippet.resourceId.videoId;
|
url = "https://youtube.com" + track.url;
|
||||||
} else if (type == "sc") {
|
} else if (type == "sc") {
|
||||||
url = track.track
|
url = track.track
|
||||||
? track.track.permalink_url
|
? track.track.permalink_url
|
||||||
|
@ -566,7 +566,7 @@ command.callback = async function (
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const url = await youtubeSearch(msg, argStr);
|
const url = await youtubeSearch(msg, argStr);
|
||||||
if (url?.startsWith("https://youtu.be/")) {
|
if (url?.startsWith("https://youtube.com/")) {
|
||||||
await enqueue({
|
await enqueue({
|
||||||
guild_id: msg.guildID,
|
guild_id: msg.guildID,
|
||||||
voice_id: msg.member.voiceState.channelID,
|
voice_id: msg.member.voiceState.channelID,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue