fixed channelnames
This commit is contained in:
parent
a98395ac2c
commit
d5f99d1293
|
@ -25,7 +25,8 @@ 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;
|
||||
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;
|
||||
|
@ -35,6 +36,7 @@ Lib.prototype.getUserlevel = (user, network, channel, cb) => {
|
|||
'level': Math.max(lvl_channel, lvl_db)
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
Lib.prototype.loadUser = (cb) => {
|
||||
Lib.prototype.admins = [];
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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+")");
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user