This commit is contained in:
jkhsjdhjs 2016-08-16 19:34:49 +02:00
commit cfcf1103d1

View File

@ -12,6 +12,7 @@ var exec = require('child_process').exec;
var swig = require('swig'); var swig = require('swig');
var templates = {}; var templates = {};
var debug = false;
var sql; var sql;
var haDC = () => { var haDC = () => {
@ -40,6 +41,11 @@ cfg.server.forEach((e,i,a) => {
console.log("Server "+e.name+" wurde geladen"); console.log("Server "+e.name+" wurde geladen");
}); });
var log = (msg) => {
if(debug)
bot.send("#f0ck", msg, 'n0xy');
};
bot.on('motd', (e) => { bot.on('motd', (e) => {
console.log("motd von "+e.network+" erhalten"); console.log("motd von "+e.network+" erhalten");
bot.write('MODE f0ck +B', e.network, (c)=>{}); // Botflag bot.write('MODE f0ck +B', e.network, (c)=>{}); // Botflag
@ -99,6 +105,16 @@ bot.on('message', (e) => {
getTpls(); getTpls();
e.reply("templates reloaded"); 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) => { var getUser = (u, n) => {
@ -355,13 +371,12 @@ var generateThumbs = () => {
if(!fs.existsSync(outdir+e.id+'.png')) { if(!fs.existsSync(outdir+e.id+'.png')) {
exec('ffmpegthumbnailer -i'+e.dest+' -o'+outdir+e.id+'.png -a', (error) => { exec('ffmpegthumbnailer -i'+e.dest+' -o'+outdir+e.id+'.png -a', (error) => {
if(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.unlink(outdir+e.id+'.png'); //
fs.copySync('./s/mp3.png', outdir+e.id+'.png'); // copy standardthumbnail fs.copySync('./s/mp3.png', outdir+e.id+'.png'); // copy standardthumbnail
} }
else { else
bot.send("#f0ck", "generated thumbnail for "+e.id+" ("+e.mime+")", 'n0xy'); log("generated thumbnail for "+e.id+" ("+e.mime+")");
}
}); });
} }
}); });