From 7398dba27139055523c3da0cabe7fa6c0a96fc43 Mon Sep 17 00:00:00 2001 From: Flummi Date: Fri, 30 Dec 2016 19:08:52 +0100 Subject: [PATCH] damn --- src/trigger/parser.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/trigger/parser.js b/src/trigger/parser.js index 6013b86..ff10cbc 100644 --- a/src/trigger/parser.js +++ b/src/trigger/parser.js @@ -20,7 +20,7 @@ module.exports = (lib, userlevel) => { var tmp = e.message.match(/https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi); // get links tmp.forEach((entry,i,a) => { if(!entry.match(/f0ck\.me/i) && !entry.match(/\.onion/i)) { - getLink(entry, (e.message.match(/(!|-)force/i)?true:false), (cb) => { + getLink(entry, ((e.message.match(/(!|-)force/i) && userlevel >= 100)?true:false), (cb) => { if(cb.success === true) { fs.move(cb.file, cb.file + '.' + cb.info.ext, (err) => { if(!err) { @@ -72,7 +72,6 @@ module.exports = (lib, userlevel) => { if(cbcr === true) { var dat = fs.createWriteStream('./b/' + tmpdest); var info; - if(url.match(yt)) { // ytdl ytdl.getInfo(url, (err, inf) => { if(!err) { @@ -81,7 +80,7 @@ module.exports = (lib, userlevel) => { try { ytdl.downloadFromInfo(inf, { filter: (format) => { return format.container === 'webm'; } }) .on('response', (res) => { - if( ( res.headers['content-length'] <= lib.cfg.main.maxFileSize ) || ( userlevel >= 100 && force ) ) { + if( ( res.headers['content-length'] <= lib.cfg.main.maxFileSize ) || force ) { info = { type: 'youtube', title: title, @@ -141,7 +140,7 @@ module.exports = (lib, userlevel) => { lib.log('MimeType: '+type); var length = res.headers['content-length']; if(lib.cfg.main.allowedMimes.hasOwnProperty(type)) { - if( ( data.length <= lib.cfg.main.maxFileSize ) || ( userlevel >= 100 && force ) ) { + if( ( data.length <= lib.cfg.main.maxFileSize ) || force ) { var s = new Readable s.push(data); s.push(null);