can't stump the f0ck

This commit is contained in:
Flummi 2016-10-21 01:18:02 +02:00
parent a30b025fff
commit 683669bffd

View File

@ -12,42 +12,46 @@ module.exports = (lib) => {
var name = args[1].replace('@',''); var name = args[1].replace('@','');
var level = (args[2]>=100)?100:args[2]; var level = (args[2]>=100)?100:args[2];
if( name in e.channel.names ) { if(user.toLowerCase() != lib.bot.me.nick.toLowerCase()) {
lib.bot.whois(name.trim(), e.network, (err, data) => { if( name in e.channel.names ) {
if(!err) { lib.bot.whois(name.trim(), e.network, (err, data) => {
if(data.account !== null) { if(!err) {
var userstring = (data.nick === data.account)?data.nick:(data.nick+' ('+data.account+')'); if(data.account !== null) {
if(data.account in lib.admins) { var userstring = (data.nick === data.account)?data.nick:(data.nick+' ('+data.account+')');
if(level <= 0) { if(data.account in lib.admins) {
lib.sql.query('delete from `f0ck`.`user` where `id` = ? limit 1', [lib.admins[data.account].id], () => { if(level <= 0) {
lib.loadUser(); lib.sql.query('delete from `f0ck`.`user` where `id` = ? limit 1', [lib.admins[data.account].id], () => {
applyModes(lib, data.channels[e.channel], level, e.channel, data.nick); lib.loadUser();
e.reply('deleted user '+userstring); applyModes(lib, data.channels[e.channel], level, e.channel, data.nick);
}); e.reply('deleted user '+userstring);
});
}
else {
lib.sql.query('update `f0ck`.`user` set `level` = ? where `id` = ?', [level, lib.admins[data.account].id], () => {
lib.loadUser();
applyModes(lib, data.channels[e.channel], level, e.channel, data.nick);
e.reply('changed user '+userstring+' to level '+level);
});
}
} }
else { else {
lib.sql.query('update `f0ck`.`user` set `level` = ? where `id` = ?', [level, lib.admins[data.account].id], () => { lib.sql.query('insert into `f0ck`.`user` (`account`,`level`,`network`) values (?,?,?)', [data.account, level, e.network], () => {
lib.loadUser(); lib.loadUser();
applyModes(lib, data.channels[e.channel], level, e.channel, data.nick); applyModes(lib, data.channels[e.channel], level, e.channel, data.nick);
e.reply('changed user '+userstring+' to level '+level); e.reply('added new user '+userstring+' with level '+level);
}); });
} }
} }
else { else
lib.sql.query('insert into `f0ck`.`user` (`account`,`level`,`network`) values (?,?,?)', [data.account, level, e.network], () => { e.reply('user '+data.nick+' isn\'t registered');
lib.loadUser();
applyModes(lib, data.channels[e.channel], level, e.channel, data.nick);
e.reply('added new user '+userstring+' with level '+level);
});
}
} }
else });
e.reply('user '+data.nick+' isn\'t registered'); }
} else
}); e.reply('user '+name+' not found');
} }
else else
e.reply('user '+name+' not found'); e.reply('f0ck you hard');
} }
else else
e.reply('no permission, min level 100 required'); e.reply('no permission, min level 100 required');