buggsenfiggs
This commit is contained in:
		| @@ -19,7 +19,7 @@ var haDC = () => { | ||||
| haDC(); | ||||
|  | ||||
| var lib = new Lib(bot, sql, cfg); | ||||
| var websrv = new Websrv(bot, sql, cfg); | ||||
| var websrv = new Websrv(bot, sql, cfg, lib); | ||||
|  | ||||
| cfg.server.forEach((e,i,a) => { | ||||
|   bot.add({ | ||||
|   | ||||
| @@ -8,47 +8,49 @@ module.exports = (bot, trigger, lib) => { | ||||
|     call: new RegExp('https?:\\/\\/[\\w-]+(\\.[\\w-]+)+\\.?(:\\d+)?(\\/\\S*)?', 'gi'), | ||||
|     level: 0, | ||||
|     func: (e) => { | ||||
|       if(!e.message.match(/\!ignore$/)) { | ||||
|         var tmp = e.message.match(/https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi); // get links | ||||
|         tmp.forEach((entry,i,a) => { | ||||
|           var tmpdest = uuid.v1().split('-')[0]; | ||||
|           lib.dl(entry, "./b/"+tmpdest, (cb) => { // download item | ||||
|             if(cb.status === true) { | ||||
|               lib.getUser(e, (cbgu) => { | ||||
|                 lib.getCheckSum("./b/"+tmpdest+"."+cb.infos.ext, (cbcs) => { | ||||
|                   lib.checkRepostCheckSum(cbcs, (cbcrcs) => { | ||||
|                     if(cbcrcs) { | ||||
|                       lib.sql.query("insert into `f0ck`.`items` (`src`,`dest`,`mime`,`size`,`checksum`,`username`,`userchannel`,`usernetwork`,`stamp`,`active`) values (?,?,?,?,?,?,?,?,?,?)", [ | ||||
|                         entry, | ||||
|                         "./b/"+tmpdest+"."+cb.infos.ext, | ||||
|                         cb.infos.mime, | ||||
|                         cb.infos.size, | ||||
|                         cbcs, | ||||
|                         cbgu['nick'], | ||||
|                         e.channel.getName(), | ||||
|                         e.network, | ||||
|                         Math.floor(new Date() / 1000), | ||||
|                         0 | ||||
|                       ]).on('result', (result) => { | ||||
|                         lib.generateThumbs(); | ||||
|                         e.reply("https://f0ck.me/"+result.insertId+" - "+path.parse(entry).base+" ("+cb.infos.mime+", ~"+lib.formatSize(cb.infos.size)+") from "+cbgu['nick']+" ("+cbgu['username']+"@"+cbgu['hostname']+")"); | ||||
|                       }).on('error', (msg) => { | ||||
|                         e.reply(msg); | ||||
|                       }); | ||||
|                     } | ||||
|                     else { | ||||
|                       fs.unlink("./b/"+tmpdest+"."+cb.infos.ext); // delete repost | ||||
|                       e.reply("repost motherf0cker"); | ||||
|                     } | ||||
|       if(e.channel.getName() != '#f0ck') { | ||||
|         if(!e.message.match(/\!ignore$/)) { | ||||
|           var tmp = e.message.match(/https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi); // get links | ||||
|           tmp.forEach((entry,i,a) => { | ||||
|             var tmpdest = uuid.v1().split('-')[0]; | ||||
|             lib.dl(entry, "./b/"+tmpdest, (cb) => { // download item | ||||
|               if(cb.status === true) { | ||||
|                 lib.getUser(e, (cbgu) => { | ||||
|                   lib.getCheckSum("./b/"+tmpdest+"."+cb.infos.ext, (cbcs) => { | ||||
|                     lib.checkRepostCheckSum(cbcs, (cbcrcs) => { | ||||
|                       if(cbcrcs) { | ||||
|                         lib.sql.query("insert into `f0ck`.`items` (`src`,`dest`,`mime`,`size`,`checksum`,`username`,`userchannel`,`usernetwork`,`stamp`,`active`) values (?,?,?,?,?,?,?,?,?,?)", [ | ||||
|                           entry, | ||||
|                           "./b/"+tmpdest+"."+cb.infos.ext, | ||||
|                           cb.infos.mime, | ||||
|                           cb.infos.size, | ||||
|                           cbcs, | ||||
|                           cbgu['nick'], | ||||
|                           e.channel.getName(), | ||||
|                           e.network, | ||||
|                           Math.floor(new Date() / 1000), | ||||
|                           0 | ||||
|                         ]).on('result', (result) => { | ||||
|                           lib.generateThumbs(); | ||||
|                           e.reply("https://f0ck.me/"+result.insertId+" - "+path.parse(entry).base+" ("+cb.infos.mime+", ~"+lib.formatSize(cb.infos.size)+") from "+cbgu['nick']+" ("+cbgu['username']+"@"+cbgu['hostname']+")"); | ||||
|                         }).on('error', (msg) => { | ||||
|                           e.reply(msg); | ||||
|                         }); | ||||
|                       } | ||||
|                       else { | ||||
|                         fs.unlink("./b/"+tmpdest+"."+cb.infos.ext); // delete repost | ||||
|                         e.reply("repost motherf0cker"); | ||||
|                       } | ||||
|                     }); | ||||
|                   }); | ||||
|                 }); | ||||
|               }); | ||||
|             } | ||||
|             else | ||||
|               if(cb.type == 1) | ||||
|                 e.reply(cb.msg); | ||||
|               } | ||||
|               else | ||||
|                 if(cb.type == 1) | ||||
|                   e.reply(cb.msg); | ||||
|             }); | ||||
|           }); | ||||
|         }); | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     desc: 'muh' | ||||
|   | ||||
| @@ -4,13 +4,14 @@ var path = require('path'); | ||||
| var swig = require('swig'); | ||||
|  | ||||
| var templates = {}; | ||||
| var bot, sql, cfg; | ||||
| var bot, sql, cfg, lib; | ||||
|  | ||||
| module.exports = Websrv; | ||||
| function Websrv(tbot, tsql, tcfg) { | ||||
| function Websrv(tbot, tsql, tcfg, tlib) { | ||||
|   this.bot = bot = tbot; | ||||
|   this.sql = sql = tsql; | ||||
|   this.cfg = cfg = tcfg; | ||||
|   this.lib = lib = tlib; | ||||
|    | ||||
|   http.createServer((req, res) => { | ||||
|     if(cfg.wlip.hasOwnProperty(req.connection.remoteAddress)) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user