bugfix
This commit is contained in:
parent
c7a48d4fae
commit
91a2edcce7
|
@ -18,15 +18,23 @@ module.exports = (bot, trigger, lib) => {
|
|||
lib.checkRepost(entry, (cbcr) => {
|
||||
if(cbcr) {
|
||||
var dat = fs.createWriteStream('./b/'+tmpdest+'.webm');
|
||||
ytdl(entry, { filter: (format) => { return format.container === 'webm'; } })
|
||||
.on('response', (res) => {
|
||||
if(res.headers['content-length'] > lib.cfg.maxFileSize) {
|
||||
res.destroy();
|
||||
dl = false;
|
||||
e.reply('f0ck! your file is too big (~'+lib.formatSize(res.headers['content-length'])+'), max '+lib.formatSize(lib.cfg.maxFileSize)+' allowed');
|
||||
}
|
||||
})
|
||||
.pipe( dat );
|
||||
try {
|
||||
ytdl(entry, { filter: (format) => { return format.container === 'webm'; } })
|
||||
.on('response', (res) => {
|
||||
if(res.headers['content-length'] > lib.cfg.maxFileSize) {
|
||||
res.destroy();
|
||||
dl = false;
|
||||
e.reply('f0ck! your file is too big (~'+lib.formatSize(res.headers['content-length'])+'), max '+lib.formatSize(lib.cfg.maxFileSize)+' allowed');
|
||||
}
|
||||
})
|
||||
.pipe( dat );
|
||||
}
|
||||
catch(ex) {
|
||||
dat.close();
|
||||
fs.unlink('./b/'+tmpdest+'.webm');
|
||||
e.reply("noep");
|
||||
dl = false;
|
||||
}
|
||||
dat.on('finish', () => {
|
||||
if(dl) {
|
||||
dat.close();
|
||||
|
|
Loading…
Reference in New Issue
Block a user