diff --git a/src/main.js b/src/main.js index d8cb950..a256ad0 100644 --- a/src/main.js +++ b/src/main.js @@ -42,7 +42,7 @@ bot.on('motd', (e) => { bot.on('message', (e) => { trigger.trigger.forEach((entry,i,a) => { - if(entry.call.test(e.message)) { + if(entry.call.test(e.message) && entry.active == 1) { lib.getUserlevel(e, (cb) => { if(cb.level >= entry.level) entry.func(e); diff --git a/src/trigger/del.js b/src/trigger/del.js index 82d22d0..e3d4ba4 100644 --- a/src/trigger/del.js +++ b/src/trigger/del.js @@ -3,6 +3,7 @@ module.exports = (bot, trigger, lib) => { name: 'delete', call: new RegExp('^\\!del (\\d+)$', 'i'), level: 100, + active: 1, func: (e) => { var id = e.message.split(' ')[1]; lib.sql.query("delete from `f0ck`.`items` where `id` = ?", id).on('end', () => { diff --git a/src/trigger/level.js b/src/trigger/level.js index cf0766b..ab0d103 100644 --- a/src/trigger/level.js +++ b/src/trigger/level.js @@ -3,6 +3,7 @@ module.exports = (bot, trigger, lib) => { name: 'level', call: new RegExp('^\\!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+")"); diff --git a/src/trigger/parser.js b/src/trigger/parser.js index 64a1027..ca77527 100644 --- a/src/trigger/parser.js +++ b/src/trigger/parser.js @@ -7,6 +7,7 @@ module.exports = (bot, trigger, lib) => { name: 'parser', call: new RegExp('https?:\\/\\/[\\w-]+(\\.[\\w-]+)+\\.?(:\\d+)?(\\/\\S*)?', 'gi'), level: 0, + active: 1, func: (e) => { if(e.channel.getName() == '#f0ck') { if(!e.message.match(/\!ignore$/)) { diff --git a/src/trigger/user.js b/src/trigger/user.js index c891f16..688c3e0 100644 --- a/src/trigger/user.js +++ b/src/trigger/user.js @@ -3,6 +3,7 @@ module.exports = (bot, trigger, lib) => { name: 'user', call: new RegExp('^\\!user$', 'i'), level: 0, + active: 1, func: (e) => { //e.reply(e.user); lib.getUser(e, (cbgu) => { diff --git a/src/trigger/ytdl.js b/src/trigger/ytdl.js index bd5ec52..f1419a3 100644 --- a/src/trigger/ytdl.js +++ b/src/trigger/ytdl.js @@ -8,6 +8,7 @@ module.exports = (bot, trigger, lib) => { name: 'ytdl', call: new RegExp('(https?://)?(www\\.)?(yotu\\.be/|youtube\\.com/)?((.+/)?(watch(\\?v=|.+&v=))?(v=)?)([\\w_-]{11})(&.+)?', 'gi'), level: 0, + active: 0, func: (e) => { if(e.channel.getName() == '#f0ck') { if(!e.message.match(/\!ignore$/)) { @@ -18,15 +19,7 @@ module.exports = (bot, trigger, lib) => { lib.checkRepost(entry, (cbcr) => { if(cbcr) { var dat = fs.createWriteStream('./b/'+tmpdest+'.webm'); - ytdl(entry, { filter: (format) => { - try { - return format.container === 'webm'; - } - catch(ex) { - dl = false; - e.reply("noep D:"); - } - } }) + ytdl(entry, { filter: (format) => { return format.container === 'webm'; } }) .on('response', (res) => { if(res.headers['content-length'] > lib.cfg.maxFileSize) { res.destroy();