This commit is contained in:
Flummi 2016-08-24 07:51:26 +00:00
parent 91a2edcce7
commit b34e63ce0e

View File

@ -18,8 +18,15 @@ module.exports = (bot, trigger, lib) => {
lib.checkRepost(entry, (cbcr) => {
if(cbcr) {
var dat = fs.createWriteStream('./b/'+tmpdest+'.webm');
try {
ytdl(entry, { filter: (format) => { return format.container === 'webm'; } })
ytdl(entry, { filter: (format) => {
try {
return format.container === 'webm';
}
catch(ex) {
dl = false;
e.reply("noep D:");
}
} })
.on('response', (res) => {
if(res.headers['content-length'] > lib.cfg.maxFileSize) {
res.destroy();
@ -28,13 +35,6 @@ module.exports = (bot, trigger, lib) => {
}
})
.pipe( dat );
}
catch(ex) {
dat.close();
fs.unlink('./b/'+tmpdest+'.webm');
e.reply("noep");
dl = false;
}
dat.on('finish', () => {
if(dl) {
dat.close();