Compare commits
2 commits
340727ae60
...
40052ac85d
Author | SHA1 | Date | |
---|---|---|---|
40052ac85d | |||
09eee1a0ca |
1 changed files with 6 additions and 3 deletions
|
@ -16,21 +16,24 @@ module.exports = {
|
||||||
let url;
|
let url;
|
||||||
|
|
||||||
if(args.length > 0){
|
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 {
|
try {
|
||||||
url = new URL(args[0]);
|
url = new URL(args[0]);
|
||||||
url = url.href;
|
url = url.href;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.cleanUp(downloadsDir);
|
this.cleanUp(downloadsDir);
|
||||||
message.channel.send("Invalid URL");
|
message.channel.send("Could not parse the provided argument as a URL.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.cleanUp(downloadsDir);
|
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){
|
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);
|
this.cleanUp(downloadsDir);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue