mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-20 05:23:31 +01:00
Moved permissions to get/set
the grind was unreal
This commit is contained in:
@@ -28,28 +28,6 @@ var ChannelPermissions = (function () {
|
|||||||
|
|
||||||
this.deny = data.deny;
|
this.deny = data.deny;
|
||||||
this.allow = data.allow;
|
this.allow = data.allow;
|
||||||
|
|
||||||
this.createInstantInvite = getBit(0);
|
|
||||||
//this.banMembers = getBit(1);
|
|
||||||
//this.kickMembers = getBit(2);
|
|
||||||
this.managePermissions = getBit(3);
|
|
||||||
this.manageChannels = getBit(4);
|
|
||||||
//this.manageServer = getBit(5);
|
|
||||||
this.readMessages = getBit(10);
|
|
||||||
this.sendMessages = getBit(11);
|
|
||||||
this.sendTTSMessages = getBit(12);
|
|
||||||
this.manageMessages = getBit(13);
|
|
||||||
this.embedLinks = getBit(14);
|
|
||||||
this.attachFiles = getBit(15);
|
|
||||||
this.readMessageHistory = getBit(16);
|
|
||||||
this.mentionEveryone = getBit(17);
|
|
||||||
|
|
||||||
this.voiceConnect = getBit(20);
|
|
||||||
this.voiceSpeak = getBit(21);
|
|
||||||
this.voiceMuteMembers = getBit(22);
|
|
||||||
this.voiceDeafenMembers = getBit(23);
|
|
||||||
this.voiceMoveMembers = getBit(24);
|
|
||||||
this.voiceUseVoiceActivation = getBit(25);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_createClass(ChannelPermissions, [{
|
_createClass(ChannelPermissions, [{
|
||||||
@@ -57,6 +35,145 @@ var ChannelPermissions = (function () {
|
|||||||
value: function getBit(x) {
|
value: function getBit(x) {
|
||||||
return (this.packed >>> x & 1) === 1;
|
return (this.packed >>> x & 1) === 1;
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: "setBit",
|
||||||
|
value: function setBit() {}
|
||||||
|
}, {
|
||||||
|
key: "createInstantInvite",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(0);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(0, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "manageRoles",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(3);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(3, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "manageChannels",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(4);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(4, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "readMessages",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(10);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(10, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "sendMessages",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(11);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(11, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "sendTTSMessages",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(12);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(12, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "manageMessages",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(13);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(13, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "embedLinks",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(14);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(14, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "attachFiles",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(15);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(15, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "readMessageHistory",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(16);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(16, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "mentionEveryone",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(17);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(17, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "voiceConnect",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(20);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(20, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "voiceSpeak",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(21);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(21, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "voiceMuteMembers",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(22);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(22, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "voiceDeafenMembers",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(23);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(23, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "voiceMoveMembers",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(24);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(24, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "voiceUseVoiceActivation",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(25);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(25, val);
|
||||||
|
}
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
return ChannelPermissions;
|
return ChannelPermissions;
|
||||||
|
|||||||
@@ -18,28 +18,6 @@ var EvaluatedPermissions = (function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.packed = data;
|
this.packed = data;
|
||||||
|
|
||||||
this.createInstantInvite = getBit(0);
|
|
||||||
//this.banMembers = getBit(1);
|
|
||||||
//this.kickMembers = getBit(2);
|
|
||||||
this.managePermissions = getBit(3);
|
|
||||||
this.manageChannels = getBit(4);
|
|
||||||
//this.manageServer = getBit(5);
|
|
||||||
this.readMessages = getBit(10);
|
|
||||||
this.sendMessages = getBit(11);
|
|
||||||
this.sendTTSMessages = getBit(12);
|
|
||||||
this.manageMessages = getBit(13);
|
|
||||||
this.embedLinks = getBit(14);
|
|
||||||
this.attachFiles = getBit(15);
|
|
||||||
this.readMessageHistory = getBit(16);
|
|
||||||
this.mentionEveryone = getBit(17);
|
|
||||||
|
|
||||||
this.voiceConnect = getBit(20);
|
|
||||||
this.voiceSpeak = getBit(21);
|
|
||||||
this.voiceMuteMembers = getBit(22);
|
|
||||||
this.voiceDeafenMembers = getBit(23);
|
|
||||||
this.voiceMoveMembers = getBit(24);
|
|
||||||
this.voiceUseVoiceActivation = getBit(25);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_createClass(EvaluatedPermissions, [{
|
_createClass(EvaluatedPermissions, [{
|
||||||
@@ -47,6 +25,145 @@ var EvaluatedPermissions = (function () {
|
|||||||
value: function getBit(x) {
|
value: function getBit(x) {
|
||||||
return (this.packed >>> x & 1) === 1;
|
return (this.packed >>> x & 1) === 1;
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: "setBit",
|
||||||
|
value: function setBit() {}
|
||||||
|
}, {
|
||||||
|
key: "createInstantInvite",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(0);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(0, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "manageRoles",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(3);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(3, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "manageChannels",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(4);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(4, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "readMessages",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(10);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(10, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "sendMessages",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(11);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(11, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "sendTTSMessages",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(12);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(12, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "manageMessages",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(13);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(13, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "embedLinks",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(14);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(14, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "attachFiles",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(15);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(15, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "readMessageHistory",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(16);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(16, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "mentionEveryone",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(17);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(17, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "voiceConnect",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(20);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(20, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "voiceSpeak",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(21);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(21, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "voiceMuteMembers",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(22);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(22, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "voiceDeafenMembers",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(23);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(23, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "voiceMoveMembers",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(24);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(24, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "voiceUseVoiceActivation",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(25);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(25, val);
|
||||||
|
}
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
return EvaluatedPermissions;
|
return EvaluatedPermissions;
|
||||||
|
|||||||
@@ -17,27 +17,6 @@ var ServerPermissions = (function () {
|
|||||||
this.packed = data.permissions;
|
this.packed = data.permissions;
|
||||||
this.name = data.name;
|
this.name = data.name;
|
||||||
this.id = data.id;
|
this.id = data.id;
|
||||||
|
|
||||||
this.banMembers = getBit(1);
|
|
||||||
this.kickMembers = getBit(2);
|
|
||||||
this.manageRoles = getBit(3);
|
|
||||||
this.manageChannels = getBit(4);
|
|
||||||
this.manageServer = getBit(5);
|
|
||||||
this.readMessages = getBit(10);
|
|
||||||
this.sendMessages = getBit(11);
|
|
||||||
this.sendTTSMessages = getBit(12);
|
|
||||||
this.manageMessages = getBit(13);
|
|
||||||
this.embedLinks = getBit(14);
|
|
||||||
this.attachFiles = getBit(15);
|
|
||||||
this.readMessageHistory = getBit(16);
|
|
||||||
this.mentionEveryone = getBit(17);
|
|
||||||
|
|
||||||
this.voiceConnect = getBit(20);
|
|
||||||
this.voiceSpeak = getBit(21);
|
|
||||||
this.voiceMuteMembers = getBit(22);
|
|
||||||
this.voiceDeafenMembers = getBit(23);
|
|
||||||
this.voiceMoveMembers = getBit(24);
|
|
||||||
this.voiceUseVoiceActivation = getBit(25);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_createClass(ServerPermissions, [{
|
_createClass(ServerPermissions, [{
|
||||||
@@ -45,6 +24,11 @@ var ServerPermissions = (function () {
|
|||||||
value: function getBit(x) {
|
value: function getBit(x) {
|
||||||
return (this.packed >>> x & 1) === 1;
|
return (this.packed >>> x & 1) === 1;
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: "setBit",
|
||||||
|
value: function setBit() {
|
||||||
|
//dummy function for now
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
key: "toString",
|
key: "toString",
|
||||||
value: function toString() {
|
value: function toString() {
|
||||||
@@ -58,6 +42,158 @@ var ServerPermissions = (function () {
|
|||||||
set: function set(val) {
|
set: function set(val) {
|
||||||
this.setBit(0, val);
|
this.setBit(0, val);
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
key: "banMembers",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(1);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(1, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "kickMembers",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(2);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(2, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "manageRoles",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(3);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(3, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "manageChannels",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(4);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(4, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "manageServer",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(5);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(5, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "readMessages",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(10);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(10, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "sendMessages",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(11);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(11, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "sendTTSMessages",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(12);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(12, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "manageMessages",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(13);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(13, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "embedLinks",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(14);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(14, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "attachFiles",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(15);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(15, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "readMessageHistory",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(16);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(16, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "mentionEveryone",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(17);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(17, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "voiceConnect",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(20);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(20, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "voiceSpeak",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(21);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(21, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "voiceMuteMembers",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(22);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(22, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "voiceDeafenMembers",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(23);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(23, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "voiceMoveMembers",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(24);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(24, val);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "voiceUseVoiceActivation",
|
||||||
|
get: function get() {
|
||||||
|
return this.getBit(25);
|
||||||
|
},
|
||||||
|
set: function set(val) {
|
||||||
|
this.setBit(25, val);
|
||||||
|
}
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
return ServerPermissions;
|
return ServerPermissions;
|
||||||
|
|||||||
@@ -22,33 +22,66 @@ class ChannelPermissions{
|
|||||||
this.deny = data.deny;
|
this.deny = data.deny;
|
||||||
this.allow = data.allow;
|
this.allow = data.allow;
|
||||||
|
|
||||||
this.createInstantInvite = getBit(0);
|
|
||||||
//this.banMembers = getBit(1);
|
|
||||||
//this.kickMembers = getBit(2);
|
|
||||||
this.managePermissions = getBit(3);
|
|
||||||
this.manageChannels = getBit(4);
|
|
||||||
//this.manageServer = getBit(5);
|
|
||||||
this.readMessages = getBit(10);
|
|
||||||
this.sendMessages = getBit(11);
|
|
||||||
this.sendTTSMessages = getBit(12);
|
|
||||||
this.manageMessages = getBit(13);
|
|
||||||
this.embedLinks = getBit(14);
|
|
||||||
this.attachFiles = getBit(15);
|
|
||||||
this.readMessageHistory = getBit(16);
|
|
||||||
this.mentionEveryone = getBit(17);
|
|
||||||
|
|
||||||
this.voiceConnect = getBit(20);
|
|
||||||
this.voiceSpeak = getBit(21);
|
|
||||||
this.voiceMuteMembers = getBit(22);
|
|
||||||
this.voiceDeafenMembers = getBit(23);
|
|
||||||
this.voiceMoveMembers = getBit(24);
|
|
||||||
this.voiceUseVoiceActivation = getBit(25);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get createInstantInvite(){return this.getBit(0);}
|
||||||
|
set createInstantInvite(val){this.setBit(0, val);}
|
||||||
|
|
||||||
|
get manageRoles(){return this.getBit(3);}
|
||||||
|
set manageRoles(val){this.setBit(3, val);}
|
||||||
|
|
||||||
|
get manageChannels(){return this.getBit(4);}
|
||||||
|
set manageChannels(val){this.setBit(4, val);}
|
||||||
|
|
||||||
|
get readMessages(){return this.getBit(10);}
|
||||||
|
set readMessages(val){this.setBit(10, val);}
|
||||||
|
|
||||||
|
get sendMessages(){return this.getBit(11);}
|
||||||
|
set sendMessages(val){this.setBit(11, val);}
|
||||||
|
|
||||||
|
get sendTTSMessages(){return this.getBit(12);}
|
||||||
|
set sendTTSMessages(val){this.setBit(12, val);}
|
||||||
|
|
||||||
|
get manageMessages(){return this.getBit(13);}
|
||||||
|
set manageMessages(val){this.setBit(13, val);}
|
||||||
|
|
||||||
|
get embedLinks(){return this.getBit(14);}
|
||||||
|
set embedLinks(val){this.setBit(14, val);}
|
||||||
|
|
||||||
|
get attachFiles(){return this.getBit(15);}
|
||||||
|
set attachFiles(val){this.setBit(15, val);}
|
||||||
|
|
||||||
|
get readMessageHistory(){return this.getBit(16);}
|
||||||
|
set readMessageHistory(val){this.setBit(16, val);}
|
||||||
|
|
||||||
|
get mentionEveryone(){return this.getBit(17);}
|
||||||
|
set mentionEveryone(val){this.setBit(17, val);}
|
||||||
|
|
||||||
|
get voiceConnect(){return this.getBit(20);}
|
||||||
|
set voiceConnect(val){this.setBit(20, val);}
|
||||||
|
|
||||||
|
get voiceSpeak(){return this.getBit(21);}
|
||||||
|
set voiceSpeak(val){this.setBit(21, val);}
|
||||||
|
|
||||||
|
get voiceMuteMembers(){return this.getBit(22);}
|
||||||
|
set voiceMuteMembers(val){this.setBit(22, val);}
|
||||||
|
|
||||||
|
get voiceDeafenMembers(){return this.getBit(23);}
|
||||||
|
set voiceDeafenMembers(val){this.setBit(23, val);}
|
||||||
|
|
||||||
|
get voiceMoveMembers(){return this.getBit(24);}
|
||||||
|
set voiceMoveMembers(val){this.setBit(24, val);}
|
||||||
|
|
||||||
|
get voiceUseVoiceActivation(){return this.getBit(25);}
|
||||||
|
set voiceUseVoiceActivation(val){this.setBit(25, val);}
|
||||||
|
|
||||||
getBit(x) {
|
getBit(x) {
|
||||||
return ((this.packed >>> x) & 1) === 1;
|
return ((this.packed >>> x) & 1) === 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setBit() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = ChannelPermissions;
|
module.exports = ChannelPermissions;
|
||||||
@@ -1,44 +1,76 @@
|
|||||||
class EvaluatedPermissions{
|
class EvaluatedPermissions {
|
||||||
constructor(data){
|
constructor(data) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
function getBit(x) {
|
function getBit(x) {
|
||||||
if(((self.packed >>> 3) & 1) === 1){
|
if (((self.packed >>> 3) & 1) === 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return ((self.packed >>> x) & 1) === 1;
|
return ((self.packed >>> x) & 1) === 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.packed = data;
|
this.packed = data;
|
||||||
|
|
||||||
this.createInstantInvite = getBit(0);
|
|
||||||
//this.banMembers = getBit(1);
|
|
||||||
//this.kickMembers = getBit(2);
|
|
||||||
this.managePermissions = getBit(3);
|
|
||||||
this.manageChannels = getBit(4);
|
|
||||||
//this.manageServer = getBit(5);
|
|
||||||
this.readMessages = getBit(10);
|
|
||||||
this.sendMessages = getBit(11);
|
|
||||||
this.sendTTSMessages = getBit(12);
|
|
||||||
this.manageMessages = getBit(13);
|
|
||||||
this.embedLinks = getBit(14);
|
|
||||||
this.attachFiles = getBit(15);
|
|
||||||
this.readMessageHistory = getBit(16);
|
|
||||||
this.mentionEveryone = getBit(17);
|
|
||||||
|
|
||||||
this.voiceConnect = getBit(20);
|
|
||||||
this.voiceSpeak = getBit(21);
|
|
||||||
this.voiceMuteMembers = getBit(22);
|
|
||||||
this.voiceDeafenMembers = getBit(23);
|
|
||||||
this.voiceMoveMembers = getBit(24);
|
|
||||||
this.voiceUseVoiceActivation = getBit(25);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get createInstantInvite() { return this.getBit(0); }
|
||||||
|
set createInstantInvite(val) { this.setBit(0, val); }
|
||||||
|
|
||||||
|
get manageRoles() { return this.getBit(3); }
|
||||||
|
set manageRoles(val) { this.setBit(3, val); }
|
||||||
|
|
||||||
|
get manageChannels() { return this.getBit(4); }
|
||||||
|
set manageChannels(val) { this.setBit(4, val); }
|
||||||
|
|
||||||
|
get readMessages() { return this.getBit(10); }
|
||||||
|
set readMessages(val) { this.setBit(10, val); }
|
||||||
|
|
||||||
|
get sendMessages() { return this.getBit(11); }
|
||||||
|
set sendMessages(val) { this.setBit(11, val); }
|
||||||
|
|
||||||
|
get sendTTSMessages() { return this.getBit(12); }
|
||||||
|
set sendTTSMessages(val) { this.setBit(12, val); }
|
||||||
|
|
||||||
|
get manageMessages() { return this.getBit(13); }
|
||||||
|
set manageMessages(val) { this.setBit(13, val); }
|
||||||
|
|
||||||
|
get embedLinks() { return this.getBit(14); }
|
||||||
|
set embedLinks(val) { this.setBit(14, val); }
|
||||||
|
|
||||||
|
get attachFiles() { return this.getBit(15); }
|
||||||
|
set attachFiles(val) { this.setBit(15, val); }
|
||||||
|
|
||||||
|
get readMessageHistory() { return this.getBit(16); }
|
||||||
|
set readMessageHistory(val) { this.setBit(16, val); }
|
||||||
|
|
||||||
|
get mentionEveryone() { return this.getBit(17); }
|
||||||
|
set mentionEveryone(val) { this.setBit(17, val); }
|
||||||
|
|
||||||
|
get voiceConnect() { return this.getBit(20); }
|
||||||
|
set voiceConnect(val) { this.setBit(20, val); }
|
||||||
|
|
||||||
|
get voiceSpeak() { return this.getBit(21); }
|
||||||
|
set voiceSpeak(val) { this.setBit(21, val); }
|
||||||
|
|
||||||
|
get voiceMuteMembers() { return this.getBit(22); }
|
||||||
|
set voiceMuteMembers(val) { this.setBit(22, val); }
|
||||||
|
|
||||||
|
get voiceDeafenMembers() { return this.getBit(23); }
|
||||||
|
set voiceDeafenMembers(val) { this.setBit(23, val); }
|
||||||
|
|
||||||
|
get voiceMoveMembers() { return this.getBit(24); }
|
||||||
|
set voiceMoveMembers(val) { this.setBit(24, val); }
|
||||||
|
|
||||||
|
get voiceUseVoiceActivation() { return this.getBit(25); }
|
||||||
|
set voiceUseVoiceActivation(val) { this.setBit(25, val); }
|
||||||
|
|
||||||
getBit(x) {
|
getBit(x) {
|
||||||
return ((this.packed >>> x) & 1) === 1;
|
return ((this.packed >>> x) & 1) === 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setBit() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = EvaluatedPermissions;
|
module.exports = EvaluatedPermissions;
|
||||||
@@ -12,36 +12,76 @@ class ServerPermissions {
|
|||||||
this.name = data.name;
|
this.name = data.name;
|
||||||
this.id = data.id;
|
this.id = data.id;
|
||||||
|
|
||||||
this.banMembers = getBit(1);
|
|
||||||
this.kickMembers = getBit(2);
|
|
||||||
this.manageRoles = getBit(3);
|
|
||||||
this.manageChannels = getBit(4);
|
|
||||||
this.manageServer = getBit(5);
|
|
||||||
this.readMessages = getBit(10);
|
|
||||||
this.sendMessages = getBit(11);
|
|
||||||
this.sendTTSMessages = getBit(12);
|
|
||||||
this.manageMessages = getBit(13);
|
|
||||||
this.embedLinks = getBit(14);
|
|
||||||
this.attachFiles = getBit(15);
|
|
||||||
this.readMessageHistory = getBit(16);
|
|
||||||
this.mentionEveryone = getBit(17);
|
|
||||||
|
|
||||||
this.voiceConnect = getBit(20);
|
|
||||||
this.voiceSpeak = getBit(21);
|
|
||||||
this.voiceMuteMembers = getBit(22);
|
|
||||||
this.voiceDeafenMembers = getBit(23);
|
|
||||||
this.voiceMoveMembers = getBit(24);
|
|
||||||
this.voiceUseVoiceActivation = getBit(25);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get createInstantInvite(){return this.getBit(0);}
|
get createInstantInvite(){return this.getBit(0);}
|
||||||
set createInstantInvite(val){this.setBit(0, val);}
|
set createInstantInvite(val){this.setBit(0, val);}
|
||||||
|
|
||||||
|
get banMembers(){return this.getBit(1);}
|
||||||
|
set banMembers(val){this.setBit(1, val);}
|
||||||
|
|
||||||
|
get kickMembers(){return this.getBit(2);}
|
||||||
|
set kickMembers(val){this.setBit(2, val);}
|
||||||
|
|
||||||
|
get manageRoles(){return this.getBit(3);}
|
||||||
|
set manageRoles(val){this.setBit(3, val);}
|
||||||
|
|
||||||
|
get manageChannels(){return this.getBit(4);}
|
||||||
|
set manageChannels(val){this.setBit(4, val);}
|
||||||
|
|
||||||
|
get manageServer(){return this.getBit(5);}
|
||||||
|
set manageServer(val){this.setBit(5, val);}
|
||||||
|
|
||||||
|
get readMessages(){return this.getBit(10);}
|
||||||
|
set readMessages(val){this.setBit(10, val);}
|
||||||
|
|
||||||
|
get sendMessages(){return this.getBit(11);}
|
||||||
|
set sendMessages(val){this.setBit(11, val);}
|
||||||
|
|
||||||
|
get sendTTSMessages(){return this.getBit(12);}
|
||||||
|
set sendTTSMessages(val){this.setBit(12, val);}
|
||||||
|
|
||||||
|
get manageMessages(){return this.getBit(13);}
|
||||||
|
set manageMessages(val){this.setBit(13, val);}
|
||||||
|
|
||||||
|
get embedLinks(){return this.getBit(14);}
|
||||||
|
set embedLinks(val){this.setBit(14, val);}
|
||||||
|
|
||||||
|
get attachFiles(){return this.getBit(15);}
|
||||||
|
set attachFiles(val){this.setBit(15, val);}
|
||||||
|
|
||||||
|
get readMessageHistory(){return this.getBit(16);}
|
||||||
|
set readMessageHistory(val){this.setBit(16, val);}
|
||||||
|
|
||||||
|
get mentionEveryone(){return this.getBit(17);}
|
||||||
|
set mentionEveryone(val){this.setBit(17, val);}
|
||||||
|
|
||||||
|
get voiceConnect(){return this.getBit(20);}
|
||||||
|
set voiceConnect(val){this.setBit(20, val);}
|
||||||
|
|
||||||
|
get voiceSpeak(){return this.getBit(21);}
|
||||||
|
set voiceSpeak(val){this.setBit(21, val);}
|
||||||
|
|
||||||
|
get voiceMuteMembers(){return this.getBit(22);}
|
||||||
|
set voiceMuteMembers(val){this.setBit(22, val);}
|
||||||
|
|
||||||
|
get voiceDeafenMembers(){return this.getBit(23);}
|
||||||
|
set voiceDeafenMembers(val){this.setBit(23, val);}
|
||||||
|
|
||||||
|
get voiceMoveMembers(){return this.getBit(24);}
|
||||||
|
set voiceMoveMembers(val){this.setBit(24, val);}
|
||||||
|
|
||||||
|
get voiceUseVoiceActivation(){return this.getBit(25);}
|
||||||
|
set voiceUseVoiceActivation(val){this.setBit(25, val);}
|
||||||
|
|
||||||
getBit(x) {
|
getBit(x) {
|
||||||
return ((this.packed >>> x) & 1) === 1;
|
return ((this.packed >>> x) & 1) === 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setBit(){
|
||||||
|
//dummy function for now
|
||||||
|
}
|
||||||
|
|
||||||
toString(){
|
toString(){
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user