f0ckv1/src/events/message.js

15 lines
511 B
JavaScript
Raw Normal View History

2016-09-14 22:05:18 +00:00
module.exports = (lib) => {
lib.bot.on('message', (e) => {
lib.trigger.trigger.forEach((entry,i,a) => {
if(e.message.match(entry.call) && entry.active == 1) {
lib.log('trigger: '+entry.name);
lib.getUserlevel(e.user.getNick(), e.network, e.channel.getName(), (cb) => {
if(cb.level >= entry.level)
entry.func(e, cb.level);
else
e.reply('no permission, min level '+entry.level+' required');
});
}
});
});
};