Fixed downloading message and now delete the compression message
This commit is contained in:
parent
40ec4ab9f5
commit
d9f6a89049
1 changed files with 29 additions and 23 deletions
|
@ -36,6 +36,13 @@ class DownloadCommand extends Command {
|
||||||
console.log('error 2:', err);
|
console.log('error 2:', err);
|
||||||
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.');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
message.channel.send('Downloading <a:loadingmin:527579785212329984>').then(msg => {
|
||||||
|
video.on('end', function () {
|
||||||
|
msg.delete();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
video.on('info', function(info) {
|
video.on('info', function(info) {
|
||||||
let duration = info.duration;
|
let duration = info.duration;
|
||||||
if (duration) {
|
if (duration) {
|
||||||
|
@ -69,31 +76,30 @@ class DownloadCommand extends Command {
|
||||||
preset: 'General/Gmail Small 10 Minutes 288p30'
|
preset: 'General/Gmail Small 10 Minutes 288p30'
|
||||||
};
|
};
|
||||||
//Compress vid if bigger than 8MB
|
//Compress vid if bigger than 8MB
|
||||||
hbjs.spawn(options)
|
let handbrake = hbjs.spawn(options);
|
||||||
.on('start', function() {
|
handbrake.on('start', function() {
|
||||||
message.channel.send('Video bigger than 8MB compressing now (This can take a long time!)\nWant it to go faster? Donate to the dev with the donate command, so i can get a better server and do it faster!');
|
message.channel.send('Video bigger than 8MB compressing now <a:loadingmin:527579785212329984> (This can take a long time!)\nWant it to go faster? Donate to the dev with the donate command, so i can get a better server and do it faster!').then(msg => {
|
||||||
})
|
handbrake.on('end', function () {
|
||||||
.on('error', err => {
|
msg.delete();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
handbrake.on('error', err => {
|
||||||
message.channel.send('An error has occured while compressing the video');
|
message.channel.send('An error has occured while compressing the video');
|
||||||
console.error(err);
|
console.error(err);
|
||||||
})
|
});
|
||||||
.on('progress', progress => {
|
handbrake.on('progress', progress => {
|
||||||
console.log(
|
console.log(
|
||||||
'Percent complete: %s, ETA: %s',
|
'Percent complete: %s, ETA: %s',
|
||||||
progress.percentComplete,
|
progress.percentComplete,
|
||||||
progress.eta
|
progress.eta
|
||||||
);
|
);
|
||||||
})
|
});
|
||||||
.on('end', function () {
|
handbrake.on('end', function () {
|
||||||
message.delete();
|
message.delete();
|
||||||
message.channel.send(`Downloaded by ${message.author.username}`, { files: ['./videoReady.mp4'] })
|
message.channel.send(`Downloaded by ${message.author.username}`, { files: ['./videoReady.mp4'] })
|
||||||
.catch(() => message.channel.send('File too big'));
|
.catch(() => message.channel.send('File too big'));
|
||||||
});
|
});
|
||||||
message.channel.send('Downloading <a:loadingmin:527579785212329984>').then(msg => {
|
|
||||||
video.on('end', function () {
|
|
||||||
msg.delete();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue