music: fix urls not working

This commit is contained in:
Cynthia Foxwell 2022-12-10 15:20:19 -07:00
parent 07eacf747b
commit 29b13b3d1f

View file

@ -423,11 +423,12 @@ command.usage = "help";
command.callback = async function ( command.callback = async function (
msg, msg,
line, line,
[subcommand, ...args], args,
{shuffle = false, limit = -1, offset = 0, next = false} {shuffle = false, limit = -1, offset = 0, next = false}
) { ) {
if (!msg.guildID) return "This command can only be used in guilds."; if (!msg.guildID) return "This command can only be used in guilds.";
const subcommand = args.shift();
let argStr = args.join(" "); let argStr = args.join(" ");
switch (subcommand) { switch (subcommand) {
@ -539,7 +540,7 @@ command.callback = async function (
}); });
} }
} else { } else {
if (argStr.match(/https?:\/\//)) { if (argStr.match(/^https?:\/\//)) {
const contentType = await fetch(argStr).then((res) => const contentType = await fetch(argStr).then((res) =>
res.headers.get("Content-Type") res.headers.get("Content-Type")
); );