Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuechschen committed Jul 9, 2016
2 parents 4644baa + 01df209 commit 4ced246
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
17 changes: 15 additions & 2 deletions lib/commands/blacklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down
7 changes: 1 addition & 6 deletions lib/commands/lockskip.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,14 @@ 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);
return Promise.resolve();
}).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) {
Expand Down
7 changes: 1 addition & 6 deletions lib/eventhandlers/advance.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,14 @@ 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);
return Promise.resolve();
}).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);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 <me@fuechschen.org>",
Expand Down

0 comments on commit 4ced246

Please sign in to comment.