hm
This commit is contained in:
parent
6f6d4309e0
commit
eecee1f123
34
src/lib.js
34
src/lib.js
@ -8,18 +8,6 @@ var cfg;
|
||||
|
||||
var bot, sql;
|
||||
|
||||
module.exports = Lib;
|
||||
function Lib(tbot, tsql) {
|
||||
this.bot = bot = tbot;
|
||||
this.sql = sql = tsql;
|
||||
this.cfg = cfg = require('../cfg/main.json');
|
||||
|
||||
Lib.prototype.loadUser((cb) => {
|
||||
console.log((cb)?"Admins wurden geladen":"Admins konnten nicht geladen werden");
|
||||
});
|
||||
Lib.prototype.loadTrigger();
|
||||
}
|
||||
|
||||
Lib.prototype.admins = [];
|
||||
Lib.prototype.debug = false;
|
||||
Lib.prototype.trigger = {
|
||||
@ -36,6 +24,20 @@ Lib.prototype.trigger = {
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = Lib;
|
||||
function Lib(tbot, tsql) {
|
||||
this.bot = bot = tbot;
|
||||
Lib.prototype.sql = tsql;
|
||||
this.cfg = cfg = require('../cfg/main.json');
|
||||
|
||||
Lib.prototype.loadUser((cb) => {
|
||||
console.log((cb)?"Admins wurden geladen":"Admins konnten nicht geladen werden");
|
||||
});
|
||||
Lib.prototype.loadTrigger();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Lib.prototype.getUserlevel = (user, network, channel, cb) => {
|
||||
bot.whois(user, network, (err, data) => {
|
||||
var host = data.username+'@'+data.hostname;
|
||||
@ -54,7 +56,7 @@ Lib.prototype.getUserlevel = (user, network, channel, cb) => {
|
||||
};
|
||||
Lib.prototype.loadUser = (cb) => {
|
||||
Lib.prototype.admins = [];
|
||||
sql.query("select * from `f0ck`.`user`", (err, rows, fields) => {
|
||||
Lib.prototype.sql.query("select * from `f0ck`.`user`", (err, rows, fields) => {
|
||||
rows.forEach(e => {
|
||||
Lib.prototype.admins.push(e.vhost);
|
||||
Lib.prototype.admins[e.vhost] = {
|
||||
@ -71,12 +73,12 @@ Lib.prototype.loadUser = (cb) => {
|
||||
});
|
||||
}
|
||||
Lib.prototype.checkRepost = (url, cbcr) => {
|
||||
sql.query("select count(id) as count, id from `f0ck`.`items` where `src` = ?", url, (err, rows, fields) => {
|
||||
Lib.prototype.sql.query("select count(id) as count, id from `f0ck`.`items` where `src` = ?", url, (err, rows, fields) => {
|
||||
cbcr((rows[0].count == 0)?true:rows[0].id);
|
||||
});
|
||||
};
|
||||
Lib.prototype.checkRepostCheckSum = (cs, cbcrcs) => {
|
||||
sql.query("select count(id) as count, id from `f0ck`.`items` where `checksum` = ?", cs, (err, rows, fields) => {
|
||||
Lib.prototype.sql.query("select count(id) as count, id from `f0ck`.`items` where `checksum` = ?", cs, (err, rows, fields) => {
|
||||
cbcrcs((rows[0].count == 0)?true:rows[0].id);
|
||||
});
|
||||
};
|
||||
@ -96,7 +98,7 @@ Lib.prototype.getCheckSum = (file, cbcs) => {
|
||||
};
|
||||
Lib.prototype.generateThumbs = () => {
|
||||
var outdir = './t/';
|
||||
sql.query("select * from `f0ck`.`items`", (err, rows, fields) => {
|
||||
Lib.prototype.sql.query("select * from `f0ck`.`items`", (err, rows, fields) => {
|
||||
rows.forEach((e,i,a) => {
|
||||
var thumbnail = outdir+e.id+'.png';
|
||||
if(!fs.existsSync(thumbnail)) {
|
||||
|
Loading…
Reference in New Issue
Block a user