fixed channelnames

This commit is contained in:
Flummi 2016-09-09 08:32:35 +00:00
parent a98395ac2c
commit d5f99d1293
4 changed files with 12 additions and 12 deletions

View File

@ -25,14 +25,16 @@ Lib.prototype.debug = false;
Lib.prototype.getUserlevel = (user, network, channel, cb) => {
bot.whois(user, network, (err, data) => {
var host = data.username+'@'+data.hostname;
var lvl_channel = (data.nick in channel)? cfg.level[ channel[data.nick] ] : 0;
var lvl_db = 0;
if(host in Lib.prototype.admins)
lvl_db = (Lib.prototype.admins[host].server == network)? Lib.prototype.admins[host].level : 0;
cb({
'channel': lvl_channel,
'db': lvl_db,
'level': Math.max(lvl_channel, lvl_db)
bot.names(channel, network, (names) => {
var lvl_channel = (data.nick in names)? cfg.level[ names[data.nick] ] : 0;
var lvl_db = 0;
if(host in Lib.prototype.admins)
lvl_db = (Lib.prototype.admins[host].server == network)? Lib.prototype.admins[host].level : 0;
cb({
'channel': lvl_channel,
'db': lvl_db,
'level': Math.max(lvl_channel, lvl_db)
});
});
});
};

View File

@ -44,7 +44,7 @@ bot.on('message', (e) => {
trigger.trigger.forEach((entry,i,a) => {
if(e.message.match(entry.call) && entry.active == 1) {
lib.log('trigger: '+entry.name);
lib.getUserlevel(e.user.getNick(), e.network, e.channel.names, (cb) => {
lib.getUserlevel(e.user.getNick(), e.network, e.channel.getName(), (cb) => {
if(cb.level >= entry.level)
entry.func(e, cb.level);
else

View File

@ -49,7 +49,7 @@ module.exports = (bot, trigger, lib) => {
user = e.user.getNick();
else
user = user.trim();
lib.getUserlevel(user, e.network, e.channel.names, cb => {
lib.getUserlevel(user, e.network, e.channel.getName(), cb => {
e.reply("level from "+user+": "+cb.level+" (Channel: "+cb.channel+" DB: "+cb.db+")");
});
}

View File

@ -76,8 +76,6 @@ module.exports = (bot, trigger, lib) => {
else
e.reply('f0ck! your file is too big (~'+lib.formatSize(length)+'), max '+lib.formatSize(cfg.maxFileSize)+' allowed');
}
else
e.reply('lol, go f0ck yourself');
}
});
}