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,