diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-02-22 17:34:14 +0100 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-02-22 17:34:14 +0100 |
commit | 2f7230e5d5730cea84ec5b9187a9178ae7088bdb (patch) | |
tree | ea5afc2ffb6cdccfe977ffdfd14129b0e26b5066 /src/util/Permissions.ts | |
parent | Fix Member Model (diff) | |
download | server-2f7230e5d5730cea84ec5b9187a9178ae7088bdb.tar.xz |
Custom Permission
Diffstat (limited to 'src/util/Permissions.ts')
-rw-r--r-- | src/util/Permissions.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/util/Permissions.ts b/src/util/Permissions.ts index d1d5bc44..75b9f432 100644 --- a/src/util/Permissions.ts +++ b/src/util/Permissions.ts @@ -41,6 +41,8 @@ type PermissionString = | "MANAGE_WEBHOOKS" | "MANAGE_EMOJIS"; +const CUSTOM_PERMISSION_OFFSET = 1n << 48n; // 16 free custom permission bits, and 16 for discord to add new ones + export class Permissions extends BitField { static FLAGS = { CREATE_INSTANT_INVITE: 1n << 0n, @@ -74,6 +76,8 @@ export class Permissions extends BitField { MANAGE_ROLES: 1n << 28n, MANAGE_WEBHOOKS: 1n << 29n, MANAGE_EMOJIS: 1n << 30n, + // CUSTOM PERMISSIONS + // CUSTOM_PERMISSION: 1n << 0n + CUSTOM_PERMISSION_OFFSET }; any(permission: PermissionResolvable, checkAdmin = true) { @@ -140,7 +144,7 @@ export async function getPermission(user_id: bigint, guild_id: bigint, channel_i var roles = await RoleModel.find({ guild_id, id: { $in: member.roles } }).exec(); let channel: ChannelDocument | null = null; if (channel_id) { - channel = await ChannelModel.findOne({ id: channel_id }, "permission_overwrites"); + channel = await ChannelModel.findOne({ id: channel_id }, "permission_overwrites").exec(); } var permission = Permissions.finalPermission({ |