diff --git a/lib/commands/blacklist.js b/lib/commands/blacklist.js index 41a5a5f..eedc0e5 100644 --- a/lib/commands/blacklist.js +++ b/lib/commands/blacklist.js @@ -13,14 +13,27 @@ module.exports = { names: ['blacklist', 'bl'], enabled: true, handler: function (data) { - redis.hget('user:roles',data.id).then(function (perm) { + redis.hget('user:roles', data.id).then(function (perm) { redis.exists('meta:state:skipable').then(function (ex) { perm = parseInt(perm, 10); if (perm > 1 && ex === 0) { var booth = utils.clone(plugged.getBooth()); var media = utils.clone(plugged.getMedia()); + //todo locksip option plugged.sendChat(utils.replace(langfile.blacklist.default, {username: data.username}), 60); - plugged.skipDJ(booth.dj); + if (config.blacklist.lockskip) { + plugged.setCyclePromise(true).then(function () { + return plugged.skipDJPromise(booth.dj); + }).then(function () { + if (config.lockskip.move_pos !== undefined) plugged.moveDJ(booth.dj, config.lockskip.move_pos); + return Promise.resolve(); + }).then(function () { + if (booth.shouldCycle !== plugged.doesWaitlistCycle()) return plugged.setCyclePromise(booth.shouldCycle); + else Promise.resolve(); + }).catch(function (err) { + story.error('Error while lockskipping.', {attach: err}); + }); + } else plugged.skipDJ(booth.dj); redis.set('meta:state:skipable', 1).then(function () { redis.expire('meta:state:skipable', 2); }); diff --git a/lib/commands/lockskip.js b/lib/commands/lockskip.js index 148d2b5..2d448f2 100644 --- a/lib/commands/lockskip.js +++ b/lib/commands/lockskip.js @@ -18,9 +18,7 @@ module.exports = { plugged.sendChat(utils.replace(langfile.skip.lockskip, {username: data.username}), 70); var booth = utils.clone(plugged.getBooth()); var media = utils.clone(plugged.getMedia()); - plugged.setLockPromise(true, false).then(function () { - return plugged.setCyclePromise(true); - }).then(function () { + plugged.setCyclePromise(true).then(function () { return plugged.skipDJPromise(booth.dj); }).then(function () { if (config.lockskip.move_pos !== undefined) plugged.moveDJ(booth.dj, config.lockskip.move_pos); @@ -28,9 +26,6 @@ module.exports = { }).then(function () { if (booth.shouldCycle !== plugged.doesWaitlistCycle()) return plugged.setCyclePromise(booth.shouldCycle); else Promise.resolve(); - }).then(function () { - if (booth.isLocked !== plugged.isWaitlistLocked()) plugged.setLockPromise(booth.isLocked, false); - else return Promise.resolve(); }).then(function () { var split = data.message.trim().split(' '); if (langfile.skip.reasons[split[1]] !== undefined) { diff --git a/lib/eventhandlers/advance.js b/lib/eventhandlers/advance.js index c5183d9..1e3f64c 100644 --- a/lib/eventhandlers/advance.js +++ b/lib/eventhandlers/advance.js @@ -32,9 +32,7 @@ module.exports = { if (plugged.getMedia().id === now.media.id) { plugged.sendChat(error.preskip); if (error.do_lockskip) { - plugged.setLockPromise(true, false).then(function () { - return plugged.setCyclePromise(true); - }).then(function () { + plugged.setCyclePromise(true).then(function () { return plugged.skipDJPromise(booth.dj); }).then(function () { if (config.lockskip.move_pos !== undefined) plugged.moveDJ(booth.dj, config.lockskip.move_pos); @@ -42,9 +40,6 @@ module.exports = { }).then(function () { if (booth.shouldCycle !== plugged.doesWaitlistCycle()) return plugged.setCyclePromise(booth.shouldCycle); else Promise.resolve(); - }).then(function () { - if (booth.isLocked !== plugged.isWaitlistLocked()) plugged.setLockPromise(booth.isLocked, false); - else return Promise.resolve(); }).then(function () { plugged.sendChat(error.afterskip); if (error.blacklist) db.blacklist.add(now.media.format, now.media.cid, error.bl_reason || undefined); diff --git a/package.json b/package.json index 3526d27..49614b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plugbot", - "version": "1.3.0", + "version": "1.3.1", "main": "bot.js", "description": "A simple bot for plug.dj", "author": "Fuechschen ",