This commit is contained in:
Flummi 2016-08-30 19:36:40 +00:00
parent 787c6be5e2
commit dbb14b3a5c
2 changed files with 25 additions and 5 deletions

View File

@ -1,13 +1,33 @@
module.exports = (bot, trigger, lib) => { module.exports = (bot, trigger, lib) => {
trigger.add({ trigger.add({
name: 'level', name: 'level',
call: /^\!level$/i, call: /^\!level( \@.*)?/i,
level: 0, level: 0,
active: 1, active: 1,
func: (e) => { func: (e) => {
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) => { lib.getUserlevel(e, (cb) => {
e.reply("level from "+e.user.getNick()+": "+cb.level+" (Channel: "+cb.channel+" DB: "+cb.db+")"); e.reply("level from "+e.user.getNick()+": "+cb.level+" (Channel: "+cb.channel+" DB: "+cb.db+")");
}); });
}
}, },
desc: 'get Userlevel' desc: 'get Userlevel'
}); });

View File

@ -6,7 +6,7 @@ module.exports = (bot, trigger, lib) => {
active: 1, active: 1,
func: (e) => { func: (e) => {
var tmp = e.message.match(/^\!user( +@(.*))?/i); var tmp = e.message.match(/^\!user( +@(.*))?/i);
if(tmp[2].length) { if(tmp[2] !== undefined) {
// e nachbauen xD // e nachbauen xD
var etmp = { var etmp = {
network: e.network, network: e.network,