muh
This commit is contained in:
parent
c00e3b867c
commit
c2cc4ab85b
|
@ -1,17 +1,18 @@
|
||||||
module.exports = (bot, trigger, lib) => {
|
module.exports = (bot, trigger, lib) => {
|
||||||
trigger.add({
|
trigger.add({
|
||||||
name: 'umode',
|
name: 'umode',
|
||||||
call: /^\!umode (.*)/i,
|
call: /^\!umode .*/i,
|
||||||
level: 100,
|
level: 100,
|
||||||
active: 1,
|
active: 1,
|
||||||
func: (e) => {
|
func: (e) => {
|
||||||
var processModes = (modes) => {
|
var processModes = (modes) => {
|
||||||
var delta, modeList = [];
|
var delta, modeList = [];
|
||||||
|
console.log(modes.split(''));
|
||||||
if(modes.split('').some((token) => {
|
if(modes.split('').some((token) => {
|
||||||
if(token === '-') {delta = false; return;}
|
if(token === '-') {delta = false; return;}
|
||||||
if(token === '+') {delta = true; return;}
|
if(token === '+') {delta = true; return;}
|
||||||
if(token === ' ') return;
|
if(token === ' ') return;
|
||||||
if(typeof delta !== "boolean") return true;
|
if(typeof delta === "undefined") return true;
|
||||||
modeList.push({
|
modeList.push({
|
||||||
delta: delta,
|
delta: delta,
|
||||||
mode: token
|
mode: token
|
||||||
|
@ -22,8 +23,18 @@ module.exports = (bot, trigger, lib) => {
|
||||||
var allowedModes = [
|
var allowedModes = [
|
||||||
'q','a','o','h','v'
|
'q','a','o','h','v'
|
||||||
];
|
];
|
||||||
var modes = processModes(e.message);
|
var tmp = e.message.trim().split(' ');
|
||||||
console.log(modes);
|
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;
|
return;
|
||||||
var user = modes[modes.length - 1];
|
var user = modes[modes.length - 1];
|
||||||
if(user.toLowerCase() != bot.me.nick.toLowerCase()) {
|
if(user.toLowerCase() != bot.me.nick.toLowerCase()) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user