mirror of
https://github.com/danbulant/discord.js
synced 2026-06-09 17:52:55 +00:00
Added permission
This commit is contained in:
parent
73dc5a5e22
commit
ada3261918
2 changed files with 45 additions and 0 deletions
38
src/Permissions.js
Normal file
38
src/Permissions.js
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
class Permission {
|
||||||
|
|
||||||
|
constructor(packedPermissions) {
|
||||||
|
|
||||||
|
function getBit(x) {
|
||||||
|
return ((this.packed >>> x) & 1) === 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.packed = packedPermissions;
|
||||||
|
|
||||||
|
this.createInstantInvite = getBit(0);
|
||||||
|
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(26);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getBit(x) {
|
||||||
|
return ((this.packed >>> x) & 1) === 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -29,6 +29,13 @@ mybot.on("message", function (message) {
|
||||||
|
|
||||||
mybot.on("ready", function () {
|
mybot.on("ready", function () {
|
||||||
console.log("im ready");
|
console.log("im ready");
|
||||||
|
|
||||||
|
for(var server of mybot.servers){
|
||||||
|
if(server.name === "test-server"){
|
||||||
|
mybot.leaveServer(server);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
mybot.on("debug", function(info){
|
mybot.on("debug", function(info){
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue