music: support urls if they dont have extensions based on content type
This commit is contained in:
parent
7c29a4e983
commit
65c9898ee5
1 changed files with 36 additions and 11 deletions
|
@ -215,7 +215,7 @@ async function enqueue(
|
||||||
highWaterMark: 1 << 25,
|
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/");
|
||||||
const client_id = await getSoundcloudClientID();
|
const client_id = await getSoundcloudClientID();
|
||||||
|
|
||||||
|
@ -538,18 +538,43 @@ command.callback = async function (msg, line) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const url = await youtubeSearch(msg, argStr);
|
if (argStr.match(/https?:\/\//)) {
|
||||||
if (url.startsWith("https://youtu.be/")) {
|
const contentType = await fetch(argStr).then((res) =>
|
||||||
await enqueue(
|
res.headers.get("Content-Type")
|
||||||
msg.guildID,
|
|
||||||
msg.member.voiceState.channelID,
|
|
||||||
msg.channel.id,
|
|
||||||
url,
|
|
||||||
"yt",
|
|
||||||
msg.author.id
|
|
||||||
);
|
);
|
||||||
|
if (
|
||||||
|
contentType.startsWith("audio/") ||
|
||||||
|
contentType.startsWith("video/")
|
||||||
|
) {
|
||||||
|
await enqueue(
|
||||||
|
msg.guildID,
|
||||||
|
msg.member.voiceState.channelID,
|
||||||
|
msg.channel.id,
|
||||||
|
argStr,
|
||||||
|
"file",
|
||||||
|
msg.author.id,
|
||||||
|
false,
|
||||||
|
queueNext
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return "Unsupported content type.";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return url;
|
const url = await youtubeSearch(msg, argStr);
|
||||||
|
if (url?.startsWith("https://youtu.be/")) {
|
||||||
|
await enqueue(
|
||||||
|
msg.guildID,
|
||||||
|
msg.member.voiceState.channelID,
|
||||||
|
msg.channel.id,
|
||||||
|
url,
|
||||||
|
"yt",
|
||||||
|
msg.author.id,
|
||||||
|
false,
|
||||||
|
queueNext
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue