everything borked

This commit is contained in:
janderedev 2021-11-13 11:54:50 +01:00
parent d224c961d8
commit ef48350e4e
Signed by: Lea
GPG key ID: 5D5E18ACB990F57A

View file

@ -84,8 +84,8 @@ function hasPerm(member: Member, perm: 'View'|'ManageRoles'|'ManageChannels'|'M
if (member.server?.owner == member.user?._id) return true;
// this should work but im not 100% certain
let userPerm = member.roles?.map(id => member.server?.roles?.[id])
.reduce((sum: number, cur: any) => sum | cur.permissions[0], member.server?.default_permissions[0]) ?? 0;
let userPerm = member.roles?.map(id => member.server?.roles?.[id]?.permissions?.[0])
.reduce((sum?: number, cur?: number) => sum! | cur!, member.server?.default_permissions[0]) ?? 0;
return !!(userPerm & p);
}