toggable debug
This commit is contained in:
parent
e4481b65cc
commit
8b5ccd54d3
23
src/main.js
23
src/main.js
|
@ -12,6 +12,7 @@ var exec = require('child_process').exec;
|
|||
var swig = require('swig');
|
||||
|
||||
var templates = {};
|
||||
var debug = false;
|
||||
|
||||
var sql;
|
||||
var haDC = () => {
|
||||
|
@ -40,6 +41,11 @@ cfg.server.forEach((e,i,a) => {
|
|||
console.log("Server "+e.name+" wurde geladen");
|
||||
});
|
||||
|
||||
var log = (msg) => {
|
||||
if(debug)
|
||||
bot.send("#f0ck", msg, 'n0xy');
|
||||
};
|
||||
|
||||
bot.on('motd', (e) => {
|
||||
console.log("motd von "+e.network+" erhalten");
|
||||
bot.write('MODE f0ck +B', e.network, (c)=>{}); // Botflag
|
||||
|
@ -99,6 +105,16 @@ bot.on('message', (e) => {
|
|||
getTpls();
|
||||
e.reply("templates reloaded");
|
||||
}
|
||||
else if(orig.match(/^\!toggle debug$/)) {
|
||||
if(debug) {
|
||||
debug = false;
|
||||
e.reply("debugmessages deactivated");
|
||||
}
|
||||
else {
|
||||
debug = true;
|
||||
e.reply("debugmessages activated");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var getUser = (u, n) => {
|
||||
|
@ -344,13 +360,12 @@ var generateThumbs = () => {
|
|||
if(!fs.existsSync(outdir+e.id+'.png')) {
|
||||
exec('ffmpegthumbnailer -i'+e.dest+' -o'+outdir+e.id+'.png -a', (error) => {
|
||||
if(error) {
|
||||
bot.send("#f0ck", "failed thumbnail for "+e.id+" ("+e.mime+")", 'n0xy');
|
||||
log("failed thumbnail for "+e.id+" ("+e.mime+")");
|
||||
fs.unlink(outdir+e.id+'.png'); //
|
||||
fs.copySync('./s/mp3.png', outdir+e.id+'.png'); // copy standardthumbnail
|
||||
}
|
||||
else {
|
||||
bot.send("#f0ck", "generated thumbnail for "+e.id+" ("+e.mime+")", 'n0xy');
|
||||
}
|
||||
else
|
||||
log("generated thumbnail for "+e.id+" ("+e.mime+")");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user