Compare commits

...

2 commits

Author SHA1 Message Date
40052ac85d
Improve error messages
All checks were successful
CI / CI (push) Successful in 1m25s
2025-06-18 00:37:03 +02:00
09eee1a0ca
Add support for prepending URL with '<' and appending with '>' 2025-06-18 00:36:32 +02:00

View file

@ -16,21 +16,24 @@ module.exports = {
let url;
if(args.length > 0){
if(args[0].charAt(0) === '<' && args[0].charAt(args[0].length - 1) === '>'){
args[0] = args[0].slice(0, args[0].length - 1)
}
try {
url = new URL(args[0]);
url = url.href;
} catch (error) {
this.cleanUp(downloadsDir);
message.channel.send("Invalid URL");
message.channel.send("Could not parse the provided argument as a URL.");
return;
}
} else {
this.cleanUp(downloadsDir);
return message.channel.send("No url provided")
return message.channel.send("You have to provide a URL in an argument.")
}
if(this.executeCommand(`yt-dlp "${url}" -P ${downloadsDir} --cookies ${cookieFilepath}`).error){
message.channel.send("An error occured when executing the command");
message.channel.send("An error occured when downloading the video.");
this.cleanUp(downloadsDir);
return;
}