diff --git a/src/trigger/umode.js b/src/trigger/umode.js index 4a3977e..e7c936c 100644 --- a/src/trigger/umode.js +++ b/src/trigger/umode.js @@ -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'); }