2016-09-15 00:05:18 +02:00
|
|
|
module.exports = (lib) => {
|
2016-09-14 20:07:10 +02:00
|
|
|
lib.trigger.add({
|
|
|
|
name: 'sync',
|
|
|
|
call: /^!sync$/i,
|
|
|
|
level: 100,
|
|
|
|
active: 1,
|
|
|
|
func: (e) => {
|
2016-09-15 00:05:18 +02:00
|
|
|
lib.bot.names(e.channel, e.network, (names) => {
|
2016-09-14 20:07:10 +02:00
|
|
|
Object.keys(names).forEach(key => {
|
2016-09-15 00:05:18 +02:00
|
|
|
lib.bot.whois(key, e.network, (err, data) => {
|
|
|
|
if(data.nick != lib.bot.me.nick) {
|
|
|
|
lib.bot.mode(e.channel, '-qaohv' + (' '+data.nick).repeat(5), e.network);
|
2016-09-14 20:07:10 +02:00
|
|
|
var level = 0;
|
|
|
|
var modes = false;
|
2016-09-15 00:05:18 +02:00
|
|
|
if(data.account in lib.admins) {
|
|
|
|
level = lib.admins[data.account].level;
|
2016-09-14 20:07:10 +02:00
|
|
|
if(level >= 70)
|
|
|
|
modes = "+ao";
|
|
|
|
else if(level >= 60)
|
|
|
|
modes = "+o";
|
|
|
|
else if(level >= 50)
|
|
|
|
modes = "+h";
|
|
|
|
else if(level >= 10)
|
|
|
|
modes = "+v";
|
|
|
|
}
|
|
|
|
if(modes !== false)
|
2016-09-15 00:05:18 +02:00
|
|
|
lib.bot.mode(e.channel, modes + (' '+data.nick).repeat(modes.length-1), e.network);
|
2016-09-14 20:07:10 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
desc: 'sync'
|
|
|
|
});
|
|
|
|
};
|