mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-21 16:55:03 +00:00
More work on permission utils and eager permission checks
This commit is contained in:
parent
5a3be1ab03
commit
8e1d39f26b
11 changed files with 189 additions and 79 deletions
15
backend/src/utils/getMissingChannelPermissions.ts
Normal file
15
backend/src/utils/getMissingChannelPermissions.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { Constants, GuildChannel, Member, Permission } from "eris";
|
||||
import { getMissingPermissions } from "./getMissingPermissions";
|
||||
|
||||
/**
|
||||
* @param requiredPermissions Bitmask of required permissions
|
||||
* @return Bitmask of missing permissions
|
||||
*/
|
||||
export function getMissingChannelPermissions(
|
||||
member: Member,
|
||||
channel: GuildChannel,
|
||||
requiredPermissions: number | bigint,
|
||||
): bigint {
|
||||
const memberChannelPermissions = channel.permissionsOf(member.id);
|
||||
return getMissingPermissions(memberChannelPermissions, requiredPermissions);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue