diff --git a/src/trigger/parser.js b/src/trigger/parser.js index 4a0f99d..6fcee70 100644 --- a/src/trigger/parser.js +++ b/src/trigger/parser.js @@ -81,7 +81,7 @@ module.exports = (lib) => { dlformat = { filter: (format) => { return format.container === 'webm'; } }; ytdl.downloadFromInfo(inf, dlformat) .on('response', (res) => { - if( ( res.headers['content-length'] <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 70 && res.headers['content-length'] >= (lib.cfg.main.maxFileSize * 2) ) ) { + if( ( res.headers['content-length'] <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 70 && res.headers['content-length'] <= (lib.cfg.main.maxFileSize * 2) ) ) { info = { type: 'youtube', title: title, @@ -93,7 +93,7 @@ module.exports = (lib) => { else { res.destroy(); dat.end(); - cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(res.headers['content-length'])+'), max '+lib.formatSize(lib.cfg.main.maxFileSize)+' allowed' }); + cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(res.headers['content-length'])+'), max '+lib.formatSize( ( userlevel >= 70?(lib.cfg.main.maxFileSize*2):lib.cfg.main.maxFileSize ) )+' allowed' }); } }) .on('error', (err) => { @@ -140,8 +140,8 @@ module.exports = (lib) => { var type = res.headers['content-type']; lib.log('MimeType: '+type); if(lib.cfg.main.allowedMimes.hasOwnProperty(type)) { - if( ( data.length <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 70 && data.length >= (lib.cfg.main.maxFileSize * 2) ) ) { - var s = new Readable + if( ( data.length <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 70 && data.length <= (lib.cfg.main.maxFileSize * 2) ) ) { + var s = new Readable; s.push(data); s.push(null); s.pipe(dat); @@ -155,7 +155,7 @@ module.exports = (lib) => { } else { dat.end(); - cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(data.length)+'), max '+lib.formatSize(lib.cfg.main.maxFileSize)+' allowed' }); + cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(data.length)+'), max '+lib.formatSize( ( userlevel >= 70?(lib.cfg.main.maxFileSize*2):lib.cfg.main.maxFileSize ) )+' allowed' }); } } else { @@ -197,7 +197,7 @@ module.exports = (lib) => { }); } else { - cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(size)+'), max '+lib.formatSize(lib.cfg.main.maxFileSize)+' allowed' }); + cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(size)+'), max '+lib.formatSize( ( userlevel >= 70?(lib.cfg.main.maxFileSize*2):lib.cfg.main.maxFileSize ) )+' allowed' }); } }) .on('error', (err) => {