shortened code a bit

This commit is contained in:
jkhsjdhjs 2016-09-06 05:02:58 +02:00
parent 4c5bd3dd1d
commit 52824f54b3

View File

@ -1,33 +1,30 @@
module.exports = (bot, trigger, lib) => {
trigger.add({
name: 'level',
call: /^\!level( \@.*)?/i,
call: /^\!level(?: +\@.*)?/i,
level: 0,
active: 1,
func: (e) => {
var tmp = e.message.match(/^\!level( +@(.*))?/i);
if(tmp[2] !== undefined) {
var user, etmp;
if(user = e.message.match(/^\!level(?: +@(.*))?/i)[1]) {
// e nachbauen xD
var etmp = {
etmp = {
network: e.network,
user: {
getNick: () => {
return tmp[2].trim();
return user.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+")");
});
}
else
etmp = e;
lib.getUserlevel(etmp, (cb) => {
e.reply("level from "+etmp.user.getNick()+": "+cb.level+" (Channel: "+cb.channel+" DB: "+cb.db+")");
});
},
desc: 'get Userlevel'
});