From edd5031a3ef6c0c5619b281f7bca39edf2f2d33a Mon Sep 17 00:00:00 2001 From: Flummi Date: Fri, 16 Sep 2016 00:14:11 +0200 Subject: [PATCH] fixed sync --- src/trigger/level.js | 7 ++++--- src/trigger/sync.js | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/trigger/level.js b/src/trigger/level.js index d548d0a..0df14db 100644 --- a/src/trigger/level.js +++ b/src/trigger/level.js @@ -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); }); } } diff --git a/src/trigger/sync.js b/src/trigger/sync.js index 68b63df..a69eba1 100644 --- a/src/trigger/sync.js +++ b/src/trigger/sync.js @@ -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)); }