Skip to content
This repository has been archived by the owner on Jul 3, 2021. It is now read-only.

Commit

Permalink
Fixed moderateLockWaitList & ModerateSetRole. Added more bots.
Browse files Browse the repository at this point in the history
  • Loading branch information
thedark1337 committed Feb 19, 2017
1 parent c01dcc5 commit 8c96f88
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,19 @@ Here are some bots that are using this API.
| ---------------------------------------------------- | --------------------------------------------------------------- |
| AuntJackie | [Mix-N-Mash](https://plug.dj/mix-n-mash-2) |
| [BeavisBot](https://github.com/AvatarKava/BeavisBot) | [I <3 the 80's and 90's](https://plug.dj/i-the-80-s-and-90-s-1) |
| brainbot | [5M4R7](https://plug.dj/5m4r7) |
| Charlotte | [Youtunes](https://plug.dj/youtunes) |
| -DnB- | [Drum & Bass](https://plug.dj/drum-bass) |
| DRPG | [Discord Dungeons](https://plug.dj/discorddungeons) |
| Ekko | [EDT](https://plug.dj/edtentertainment) |
| FlavorBar | [Flavorz](https://plug.dj/flavorz) |
| FoxBot | [Approaching Nirvana](https://plug.dj/approachingnirvana) |
| TFLBot | [The F**k Off Lounge \| TFL](https://plug.dj/thedark1337) |
| QBot | [EDM Qluster](https://plug.dj/qluster) |
| Holly Refbots | [Connect The Songs (Read Info!)](https://plug.dj/connect-the-songs-read-info/) |
| DRPG | [Discord Dungeons](https://plug.dj/discorddungeons) |
| brainbot | [5M4R7](https://plug.dj/5m4r7) |
| [Toaster-chan](https://git.io/vDTfR) | [☆ ♥ Nightcore-331 ♥ ☆](https://plug.dj/nightcore-331) |

| KawaiiBot | [AnimeMusic](https://plug.dj/hummingbird-me) |
| QBot | [EDM Qluster](https://plug.dj/qluster) |
| Skynet Cubed | [PlugCubed](https://plug.dj/plugcubed) |
| TFLBot | [The F**k Off Lounge \| TFL](https://plug.dj/thedark1337) |
| [Toaster-chan](https://git.io/vDTfR) | [☆ ♥ Nightcore-331 ♥ ☆](https://plug.dj/nightcore) |
Have a bot that uses the API? [**Let us know!**](https://github.com/plugCubed/plugAPI/issues/new)
---
## EventListener
Expand All @@ -109,7 +112,7 @@ You can listen on essentially any event that plug emits.
bot.on(PlugAPI.events.CHAT, (data) => {
if (data.type === 'emote') {
console.log(data.from + data.message);
} else {
} else {`
console.log(`${data.from} > ${ data.message}`);
}
});
Expand Down
28 changes: 14 additions & 14 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2456,10 +2456,10 @@ class PlugAPI extends EventEmitter3 {
return false;
}

const user = this.getUser(roleID);
const user = this.getUser(userID);

if (user !== null ? store(this)._room.getPermissions(user).canModStaff : this.havePermission(undefined, PlugAPI.ROOM_ROLE.MANAGER)) {
if (user.role === roleID) return false;
if (user && user.role === roleID) return false;
if (roleID === 0) {
store(this)._queueREST('DELETE', endpoints.MODERATE_STAFF + userID, undefined, callback);
} else {
Expand Down Expand Up @@ -2592,6 +2592,17 @@ class PlugAPI extends EventEmitter3 {
return this.jar;
}
}
moderateLockBooth(locked, clear, callback) {
if (!store(this)._room.getRoomMeta().slug || this.getUser() === null || !this.havePermission(undefined, PlugAPI.ROOM_ROLE.MANAGER) || (locked === store(this)._room.getBoothMeta().isLocked && !clear) || this.guest) {
return false;
}
store(this)._queueREST('PUT', endpoints.ROOM_LOCK_BOOTH, {
isLocked: locked,
removeAllDJs: clear
}, callback);

return true;
}

/**
* Room ranks
Expand Down Expand Up @@ -2797,17 +2808,6 @@ PlugAPI.prototype.events = PlugAPI.events;
* @param {RESTCallback} [callback] Callback function
* @returns {Boolean} If the REST request got queued
*/
PlugAPI.prototype.moderateLockWaitList = PlugAPI.prototype.moderateLockBooth = (locked, clear, callback) => {
if (!store(this)._room.getRoomMeta().slug || this.getUser() === null || !this.havePermission(undefined, PlugAPI.ROOM_ROLE.MANAGER) || (locked === store(this)._room.getBoothMeta().isLocked && !clear) || this.guest) {
return false;
}

store(this)._queueREST('PUT', endpoints.ROOM_LOCK_BOOTH, {
isLocked: locked,
removeAllDJs: clear
}, callback);

return true;
};
PlugAPI.prototype.moderateLockWaitList = PlugAPI.prototype.moderateLockBooth;

module.exports = PlugAPI;

0 comments on commit 8c96f88

Please sign in to comment.