fixed sync

This commit is contained in:
Flummi 2016-09-16 00:14:11 +02:00
parent 0f2ab86469
commit edd5031a3e
2 changed files with 5 additions and 4 deletions

View File

@ -16,19 +16,20 @@ module.exports = (lib) => {
lib.bot.whois(name.trim(), e.network, (err, data) => {
if(!err) {
if(data.account !== null) {
var userstring = (data.nick === data.account)?data.nick:(data.nick+' ('+data.account+')');
if(data.account in lib.admins) {
if(level <= 0) {
lib.sql.query('delete from `f0ck`.`user` where `id` = ? limit 1', [lib.admins[data.account].id], () => {
lib.loadUser();
applyModes(lib, data.channels[e.channel], level, e.channel, data.nick);
e.reply('deleted user '+data.nick+' ('+data.account+')');
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 '+data.nick+' ('+data.account+') to level '+level);
e.reply('changed user '+userstring+' to level '+level);
});
}
}
@ -36,7 +37,7 @@ module.exports = (lib) => {
lib.sql.query('insert into `f0ck`.`user` (`account`,`level`,`network`) values (?,?,?)', [data.account, level, e.network], () => {
lib.loadUser();
applyModes(lib, data.channels[e.channel], level, e.channel, data.nick);
e.reply('added new user '+data.nick+' ('+data.account+') with level '+level);
e.reply('added new user '+userstring+' with level '+level);
});
}
}

View File

@ -14,7 +14,7 @@ module.exports = (lib) => {
if(data.channels[e.channel]) {
var h = lib.modesToString(data.channels[e.channel]), q = "";
if(lib.admins[data.account])
q = levelToModes(lib.admins[data.account].level);
q = lib.levelToModes(lib.admins[data.account].level);
var diff = lib.groupUserModes(lib.userModeDiff(h, q));
diff.forEach(entry => lib.bot.mode(e.channel, entry + (' ' + key).repeat(entry.length - 1), e.network));
}