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