forked from Supositware/Haha-Yes
Don't make bot crash
This commit is contained in:
parent
66afd649a6
commit
5c81b5ddab
1 changed files with 10 additions and 5 deletions
|
@ -37,12 +37,17 @@ class DownloadCommand extends Command {
|
||||||
message.channel.send('An error has occured, I can\'t download from the link you provided.');
|
message.channel.send('An error has occured, I can\'t download from the link you provided.');
|
||||||
});
|
});
|
||||||
video.on('info', function(info) {
|
video.on('info', function(info) {
|
||||||
let duration = info.duration.replace(/:/g, '');
|
let duration = info.duration;
|
||||||
if (duration > 500) {
|
if (duration) {
|
||||||
video.pause();
|
duration = duration.replace(/:/g, '');
|
||||||
video.unpipe();
|
|
||||||
return message.channel.send('Can\'t download video longer than 5 minutes');
|
if (duration > 500) {
|
||||||
|
video.pause();
|
||||||
|
video.unpipe();
|
||||||
|
return message.channel.send('Can\'t download video longer than 5 minutes');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Download started');
|
console.log('Download started');
|
||||||
console.log('filename: ' + info._filename);
|
console.log('filename: ' + info._filename);
|
||||||
console.log('size: ' + info.size);
|
console.log('size: ' + info.size);
|
||||||
|
|
Loading…
Reference in a new issue