fix: confusing behavior on permissions

This commit is contained in:
Yuzu 2022-09-07 22:14:52 -05:00
parent 630be18ae9
commit 16b9ee3bc5

View File

@ -25,13 +25,21 @@ export class Permissions implements BitField<bigint> {
/** Stores all entity permissions */
bitfield: bigint;
/** Wheter to grant all other permissions to the administrator */
/**
* Wheter to grant all other permissions to the administrator
* **Not to get confused with Permissions#admin**
*/
__admin__ = true;
constructor(bitfield: PermissionResolvable) {
this.bitfield = Permissions.resolve(bitfield);
}
/** Wheter the bitfield has the administrator flag */
get admin(): boolean {
return (this.bitfield & BigInt(Permissions.Flags.ADMINISTRATOR)) === this.bitfield;
}
get array(): PermissionString[] {
// unsafe cast, do not edit
const permissions = Object.keys(Permissions.Flags) as PermissionString[];