This commit is contained in:
Flummi 2016-09-05 21:07:15 +00:00
parent c00e3b867c
commit c2cc4ab85b

View File

@ -1,17 +1,18 @@
module.exports = (bot, trigger, lib) => {
trigger.add({
name: 'umode',
call: /^\!umode (.*)/i,
call: /^\!umode .*/i,
level: 100,
active: 1,
func: (e) => {
var processModes = (modes) => {
var delta, modeList = [];
console.log(modes.split(''));
if(modes.split('').some((token) => {
if(token === '-') {delta = false; return;}
if(token === '+') {delta = true; return;}
if(token === ' ') return;
if(typeof delta !== "boolean") return true;
if(typeof delta === "undefined") return true;
modeList.push({
delta: delta,
mode: token
@ -22,8 +23,18 @@ module.exports = (bot, trigger, lib) => {
var allowedModes = [
'q','a','o','h','v'
];
var modes = processModes(e.message);
console.log(modes);
var tmp = e.message.trim().split(' ');
tmp.shift();
var user = tmp[tmp.length - 1];
if(user.match(/(\+|-)/))
user = e.user.getNick();
else
tmp.pop();
e.reply("input: "+JSON.stringify(tmp));
var modes = processModes(tmp.join(' '));
e.reply("output: "+JSON.stringify(modes));
e.reply("user: "+user);
return;
var user = modes[modes.length - 1];
if(user.toLowerCase() != bot.me.nick.toLowerCase()) {