forked from Supositware/Haha-Yes
Don't allow downloading of files bigger than 50 mb
This commit is contained in:
parent
aa0555fcc5
commit
535e623ff2
1 changed files with 7 additions and 1 deletions
|
@ -124,12 +124,18 @@ class ytpCommand extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (url) {
|
if (url) {
|
||||||
return youtubedl.exec(url, ['--format=mp4', '-o', `./asset/ytp/userVid/${message.id}.mp4`], {}, function(err) {
|
return youtubedl.exec(url, ['--max-filesize', '50m', '--format=mp4', '-o', `./asset/ytp/userVid/${message.id}.mp4`], {}, function(err, output) {
|
||||||
|
console.log(output[2]);
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
loadingmsg.delete();
|
loadingmsg.delete();
|
||||||
return message.channel.send('An error has occured, I can\'t download from the link you provided. Is it an mp4?');
|
return message.channel.send('An error has occured, I can\'t download from the link you provided. Is it an mp4?');
|
||||||
} else {
|
} else {
|
||||||
|
if (output[2].includes('File is larger than max-filesize')) {
|
||||||
|
loadingmsg.delete();
|
||||||
|
return message.channel.send(output[2]);
|
||||||
|
}
|
||||||
|
|
||||||
let mp4 = [];
|
let mp4 = [];
|
||||||
fs.readdirSync('./asset/ytp/userVid/').forEach(file => {
|
fs.readdirSync('./asset/ytp/userVid/').forEach(file => {
|
||||||
if (file.endsWith('mp4')) {
|
if (file.endsWith('mp4')) {
|
||||||
|
|
Loading…
Reference in a new issue