-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
148 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,112 @@ | ||
if(Connis_Channel_Perms & View_Channel) | ||
const ChannelBits = require(`./api/BitFlags/PermissionBitfields`).codes; | ||
const { PerformanceObserver, performance } = require('perf_hooks'); | ||
/* | ||
0th bit = view channel | ||
1st bit = send messages | ||
2nd bit = manage messages | ||
00000000000000000000000000000000 | ||
*/ | ||
function isBitSet(b,pos) | ||
{ | ||
console.log("COnni can view the channel"); | ||
return (b.field & (1 << pos)) != 0; | ||
} | ||
if(Connis_Channel_Perms & Send_Messages) | ||
function setBit(b,pos) | ||
{ | ||
console.log("COnni can speak in the channel"); | ||
b.field |= (1 << pos); | ||
} | ||
if(Connis_Channel_Perms & Ping_Messages) | ||
function clearBit(b,pos) | ||
{ | ||
console.log("COnni can ping in the channel"); | ||
b.field = ~(1 << pos); | ||
} | ||
|
||
|
||
|
||
|
||
var ChannelObj = | ||
{ | ||
ChannelID:"", | ||
Name:"", | ||
Description:"", | ||
RoleOverrides: | ||
[ | ||
{ | ||
RoleID:"", | ||
VIEW_CHANNEL: true, | ||
MANAGE_CHANNEL: null, | ||
MANAGE_PERMISSION: null, | ||
CREATE_INVITE: null, | ||
SEND_MESSAGES: true, | ||
} | ||
] | ||
}; | ||
|
||
var RoleObject = | ||
{ | ||
RoleID:"", | ||
RoleName:"", | ||
Colour:{r:255,g:0,b:255,a:255}, | ||
Permissions: | ||
{ | ||
VIEW_CHANNEL: true, | ||
MANAGE_CHANNEL: null, | ||
MANAGE_PERMISSION: null, | ||
CREATE_INVITE: null, | ||
SEND_MESSAGES: true, | ||
} | ||
} | ||
|
||
|
||
/* | ||
*/ | ||
|
||
|
||
|
||
|
||
/* | ||
let start = (new Date()).getTime() | ||
let pog =0; | ||
/*setBit(testing,0); | ||
setBit(testing,1); | ||
var testing = {field:3}; | ||
for(var i = 0; i < 100000000; ++i) | ||
{ | ||
if(isBitSet(testing,0)) | ||
{ | ||
++pog; | ||
//console.log("Conni can view the channel"); | ||
} | ||
if(isBitSet(testing,1)) | ||
{ | ||
++pog; | ||
//console.log("Conni can Send_Messages in the channel"); | ||
} | ||
if(isBitSet(testing,2)) | ||
{ | ||
++pog; | ||
//console.log("Conni can Manage_Messages the channel"); | ||
} | ||
} | ||
let end = (new Date()).getTime() | ||
var duration = end-start; | ||
console.log(duration, "ms"); | ||
console.log(pog); | ||
console.log(ConnisChannelPerms.field & 1<<1 ); | ||
setBit(ConnisChannelPerms,2); | ||
clearBit(ConnisChannelPerms,1); | ||
clearBit(ConnisChannelPerms,0); | ||
console.log(`field = ${ConnisChannelPerms.field}`); | ||
console.log((ConnisChannelPerms.field & ChannelBits.Manage_Messages) ? "can manage messages in the channel" : "cant manage messages"); | ||
setHexBit(ConnisChannelPerms,) | ||
console.log(ConnisChannelPerms.field); | ||
console.log((ConnisChannelPerms.field & ChannelBits.Manage_Messages) ? "can manage messages in the channel" : "cant manage messages"); | ||
*/ | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
exports.codes = { | ||
//#region ChannelPerms | ||
View_Channel : { | ||
field :0x1, | ||
pos :0 | ||
}, | ||
Send_Messages : { | ||
field :0x10, | ||
pos :1 | ||
}, | ||
Manage_Messages : { | ||
field :0x100, | ||
pos :2 | ||
}, | ||
//#endregion | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters