modified: src/trigger/umode.js

This commit is contained in:
Flummi 2016-09-05 18:23:31 +00:00
parent e90aaf0cb6
commit 619e225544

View File

@ -5,18 +5,27 @@ module.exports = (bot, trigger, lib) => {
level: 100,
active: 1,
func: (e) => {
var allowedModes = [
'q','a','o','h','v'
];
var modes = e.message.trim().split(' ');
var user = modes[modes.length - 1];
if(user.toLowerCase() != bot.me.nick.toLowerCase()) {
if(user.match(/(\+|-)/))
user = e.user.getNick();
else
modes.pop();
modes.shift();
if(modes.length > 0)
modes.forEach((entry,i,a) => {
var tmp = [];
modes.forEach((entry,i,a) => {
if(entry.match(/((\+|-)[a-z]{1}$)/))
tmp.push(entry);
});
if(tmp.length > 0) {
e.reply('modes: '+JSON.stringify(tmp) + ' to user: '+user);
tmp.forEach((entry,i,a) => {
bot.mode(e.channel, entry+' '+user, e.network);
});
}
else
e.reply('no modes given');
}