From dbb14b3a5c9caae8118b022ed95d7c9293851e78 Mon Sep 17 00:00:00 2001 From: Flummi Date: Tue, 30 Aug 2016 19:36:40 +0000 Subject: [PATCH] bugfix --- src/trigger/level.js | 28 ++++++++++++++++++++++++---- src/trigger/user.js | 2 +- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/trigger/level.js b/src/trigger/level.js index f4eb0d0..724e1b3 100644 --- a/src/trigger/level.js +++ b/src/trigger/level.js @@ -1,13 +1,33 @@ module.exports = (bot, trigger, lib) => { trigger.add({ name: 'level', - call: /^\!level$/i, + call: /^\!level( \@.*)?/i, level: 0, active: 1, func: (e) => { - lib.getUserlevel(e, (cb) => { - e.reply("level from "+e.user.getNick()+": "+cb.level+" (Channel: "+cb.channel+" DB: "+cb.db+")"); - }); + var tmp = e.message.match(/^\!level( +@(.*))?/i); + if(tmp[2] !== undefined) { + // e nachbauen xD + var etmp = { + network: e.network, + user: { + getNick: () => { + return tmp[2].trim(); + } + }, + channel: { + names: e.channel.names + } + }; + lib.getUserlevel(etmp, (cb) => { + e.reply("level from "+etmp.user.getNick()+": "+cb.level+" (Channel: "+cb.channel+" DB: "+cb.db+")"); + }); + } + else { + lib.getUserlevel(e, (cb) => { + e.reply("level from "+e.user.getNick()+": "+cb.level+" (Channel: "+cb.channel+" DB: "+cb.db+")"); + }); + } }, desc: 'get Userlevel' }); diff --git a/src/trigger/user.js b/src/trigger/user.js index 23349f4..3bf99a0 100644 --- a/src/trigger/user.js +++ b/src/trigger/user.js @@ -6,7 +6,7 @@ module.exports = (bot, trigger, lib) => { active: 1, func: (e) => { var tmp = e.message.match(/^\!user( +@(.*))?/i); - if(tmp[2].length) { + if(tmp[2] !== undefined) { // e nachbauen xD var etmp = { network: e.network,