small bugfix

This commit is contained in:
Flummi 2016-08-24 22:02:20 +02:00
parent b71e20933d
commit 649e4339aa
8 changed files with 13 additions and 10 deletions

View File

@ -42,16 +42,18 @@ bot.on('motd', (e) => {
bot.on('message', (e) => { bot.on('message', (e) => {
trigger.trigger.forEach((entry,i,a) => { trigger.trigger.forEach((entry,i,a) => {
if(entry.call.test(e.message) && entry.active == 1) { //if(entry.call.test(e.message) && entry.active == 1) {
//if(e.message.match(new RegExp(entry.call, entry.flags)) && entry.active == 1) {
if(e.message.match(entry.call) && entry.active == 1) {
lib.log('trigger: '+entry.name); lib.log('trigger: '+entry.name);
lib.getUserlevel(e, (cb) => { lib.getUserlevel(e, (cb) => {
setTimeout(()=>{ //setTimeout(()=>{
if(cb.level >= entry.level) { if(cb.level >= entry.level) {
entry.func(e); entry.func(e);
} }
else else
e.reply('no permission, min level '+entry.level+' required'); e.reply('no permission, min level '+entry.level+' required');
}, 200); //}, 200);
}); });
} }
}); });
@ -68,6 +70,7 @@ var trigger = {
trigger.trigger.push({ trigger.trigger.push({
name: args.name, name: args.name,
call: args.call, call: args.call,
//flags: args.flags,
func: args.func, func: args.func,
desc: args.desc, desc: args.desc,
level: args.level, level: args.level,

View File

@ -1,7 +1,7 @@
module.exports = (bot, trigger, lib) => { module.exports = (bot, trigger, lib) => {
trigger.add({ trigger.add({
name: 'debug', name: 'debug',
call: new RegExp('^\\!debug$', 'i'), call: /^\!debug$/i,
level: 100, level: 100,
active: 1, active: 1,
func: (e) => { func: (e) => {

View File

@ -1,7 +1,7 @@
module.exports = (bot, trigger, lib) => { module.exports = (bot, trigger, lib) => {
trigger.add({ trigger.add({
name: 'delete', name: 'delete',
call: new RegExp('^\\!del (\\d+)$', 'i'), call: /^\!del (\d+)$/i,
level: 100, level: 100,
active: 1, active: 1,
func: (e) => { func: (e) => {

View File

@ -1,7 +1,7 @@
module.exports = (bot, trigger, lib) => { module.exports = (bot, trigger, lib) => {
trigger.add({ trigger.add({
name: 'level', name: 'level',
call: new RegExp('^\\!level$', 'i'), call: /^\!level$/i,
level: 0, level: 0,
active: 1, active: 1,
func: (e) => { func: (e) => {

View File

@ -5,7 +5,7 @@ var path = require('path');
module.exports = (bot, trigger, lib) => { module.exports = (bot, trigger, lib) => {
trigger.add({ trigger.add({
name: 'parser', name: 'parser',
call: new RegExp('https?:\\/\\/[\\w-]+(\\.[\\w-]+)+\\.?(:\\d+)?(\\/\\S*)?', 'gi'), call: /https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi,
level: 0, level: 0,
active: 1, active: 1,
func: (e) => { func: (e) => {

View File

@ -3,7 +3,7 @@
module.exports = (bot, trigger, lib) => { module.exports = (bot, trigger, lib) => {
trigger.add({ trigger.add({
name: 'thumbnailer', name: 'thumbnailer',
call: new RegExp('^\\!thumb (\\d+)$', 'i'), call: /^\!thumb (\d+)$/i,
level: 100, level: 100,
active: 1, active: 1,
func: (e) => { func: (e) => {

View File

@ -1,7 +1,7 @@
module.exports = (bot, trigger, lib) => { module.exports = (bot, trigger, lib) => {
trigger.add({ trigger.add({
name: 'user', name: 'user',
call: new RegExp('^\\!user$', 'i'), call: /^\!user$/i,
level: 0, level: 0,
active: 1, active: 1,
func: (e) => { func: (e) => {

View File

@ -6,7 +6,7 @@ var probe = require('node-ffprobe');
module.exports = (bot, trigger, lib) => { module.exports = (bot, trigger, lib) => {
trigger.add({ trigger.add({
name: 'ytdl', name: 'ytdl',
call: new RegExp('(https?://)?(www\\.)?(yotu\\.be/|youtube\\.com/)?((.+/)?(watch(\\?v=|.+&v=))?(v=)?)([\\w_-]{11})(&.+)?', 'gi'), call: /https?:\/\/(www\.)?(yotu\.be\/|youtube\.com\/)?((.+\/)?(watch(\?v=|.+&v=))?(v=)?)([\w_-]{11})(&.+)?/gi,
level: 0, level: 0,
active: 0, active: 0,
func: (e) => { func: (e) => {