27 lines
891 B
JavaScript
27 lines
891 B
JavaScript
module.exports = (lib) => {
|
|
lib.trigger.add({
|
|
name: 'sync',
|
|
call: /^!sync$/i,
|
|
level: 100,
|
|
active: 0,
|
|
func: (e) => {
|
|
lib.bot.names(e.channel, e.network, names => {
|
|
Object.keys(names).forEach(key => {
|
|
if(key === lib.bot.me.nick) {
|
|
return;
|
|
}
|
|
lib.bot.whois(key, e.network, (err, data) => {
|
|
if(data.channels[e.channel]) {
|
|
var h = lib.modesToString(data.channels[e.channel]), q = "";
|
|
if(lib.admins[data.account])
|
|
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));
|
|
}
|
|
});
|
|
});
|
|
});
|
|
},
|
|
desc: 'sync'
|
|
});
|
|
}; |