This commit is contained in:
Flummi 2016-09-14 20:07:10 +02:00
parent 2e4d132963
commit a23a4ac903

35
src/trigger/sync.js Normal file
View File

@ -0,0 +1,35 @@
module.exports = (bot, lib) => {
lib.trigger.add({
name: 'sync',
call: /^!sync$/i,
level: 100,
active: 1,
func: (e) => {
bot.names(e.channel, e.network, (names) => {
Object.keys(names).forEach(key => {
bot.whois(key, e.network, (err, data) => {
if(data.nick != bot.me.nick) {
bot.mode(e.channel, '-qaohv' + (' '+data.nick).repeat(5), e.network);
var level = 0;
var modes = false;
if((data.username+'@'+data.hostname) in lib.admins) {
level = lib.admins[data.username+'@'+data.hostname].level;
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)
bot.mode(e.channel, modes + (' '+data.nick).repeat(modes.length-1), e.network);
}
});
});
});
},
desc: 'sync'
});
};