Servers now manage server-wide permissions

Servers now create ServerPermissions objects for roles
This commit is contained in:
hydrabolt
2015-10-03 19:44:08 +01:00
parent 6967f5e649
commit b264b61718
5 changed files with 159 additions and 57 deletions

View File

@@ -1,12 +1,18 @@
class ServerPermissions {
constructor(packedPermissions) {
constructor(data) {
var self = this;
function getBit(x) {
return ((this.packed >>> x) & 1) === 1;
return ((self.packed >>> x) & 1) === 1;
}
this.packed = packedPermissions;
this.packed = data.permissions;
this.name = data.name;
this.id = data.id;
this.createInstantInvite = getBit(0);
this.banMembers = getBit(1);
@@ -35,4 +41,6 @@ class ServerPermissions {
getBit(x) {
return ((this.packed >>> x) & 1) === 1;
}
}
}
module.exports = ServerPermissions;