modified: src/lib.js

modified:   src/websrv.js
This commit is contained in:
Flummi 2016-09-11 13:33:15 +02:00
parent 2710189d2e
commit 2d1fa04d2a
2 changed files with 5 additions and 7 deletions

View File

@ -4,7 +4,6 @@ var https = require('https');
var exec = require('child_process').exec;
var crypto = require('crypto');
var Mime = require('mime');
var cfg;
var bot, sql;
@ -28,9 +27,9 @@ module.exports = Lib;
function Lib(tbot, tsql) {
this.bot = bot = tbot;
Lib.prototype.sql = tsql;
this.cfg = cfg = require('../cfg/main.json');
Lib.prototype.cfg = require('../cfg/main.json');
Lib.prototype.debug = cfg.debug;
Lib.prototype.debug = Lib.prototype.cfg.debug;
Lib.prototype.loadUser((cb) => {
console.log((cb)?"Admins wurden geladen":"Admins konnten nicht geladen werden");
@ -44,7 +43,7 @@ Lib.prototype.getUserlevel = (user, network, channel, cb) => {
bot.whois(user, network, (err, data) => {
var host = data.username+'@'+data.hostname;
bot.names(channel, network, (names) => {
var lvl_channel = (data.nick in names)? cfg.level[ names[data.nick] ] : 0;
var lvl_channel = (data.nick in names)? Lib.prototype.cfg.level[ names[data.nick] ] : 0;
var lvl_db = 0;
if(host in Lib.prototype.admins)
lvl_db = (Lib.prototype.admins[host].server == network)? Lib.prototype.admins[host].level : 0;
@ -124,7 +123,7 @@ Lib.prototype.generateThumbs = () => {
};
Lib.prototype.log = (msg) => {
if(Lib.prototype.debug)
bot.send(cfg.debugchannel, msg, 'n0xy');
bot.send(Lib.prototype.cfg.debugchannel, msg, 'n0xy');
};
Lib.prototype.loadTrigger = () => {

View File

@ -42,8 +42,7 @@ function Websrv(tbot, tsql, tlib) {
catch(ex) {
commit = body.commits[body.commits.length-2].message.replace('\n','').trim();
}
lib.log( eventname + ' from ' + autor + ' ('+commit+')' );
bot.send( lib.cfg.debugchannel, eventname + ' from ' + autor + ' ('+commit+')', 'n0xy' );
});
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end('muh', 'utf-8');