mirror of
https://github.com/ahmadk953/poixpixel-discord-bot.git
synced 2025-05-10 10:43:06 +00:00
Improved channelUpdate event logging
This commit is contained in:
parent
6c523bbeba
commit
3762e554b4
5 changed files with 295 additions and 16 deletions
|
@ -84,6 +84,36 @@ export const createPermissionChangeFields = (
|
|||
return fields;
|
||||
};
|
||||
|
||||
export const getPermissionNames = (
|
||||
permissions: Readonly<PermissionsBitField>,
|
||||
): string[] => {
|
||||
const names: string[] = [];
|
||||
|
||||
Object.keys(PermissionsBitField.Flags).forEach((perm) => {
|
||||
if (permissions.has(perm as keyof typeof PermissionsBitField.Flags)) {
|
||||
names.push(formatPermissionName(perm));
|
||||
}
|
||||
});
|
||||
|
||||
return names;
|
||||
};
|
||||
|
||||
export const getPermissionDifference = (
|
||||
a: Readonly<PermissionsBitField>,
|
||||
b: Readonly<PermissionsBitField>,
|
||||
): string[] => {
|
||||
const names: string[] = [];
|
||||
|
||||
Object.keys(PermissionsBitField.Flags).forEach((perm) => {
|
||||
const permKey = perm as keyof typeof PermissionsBitField.Flags;
|
||||
if (a.has(permKey) && !b.has(permKey)) {
|
||||
names.push(formatPermissionName(perm));
|
||||
}
|
||||
});
|
||||
|
||||
return names;
|
||||
};
|
||||
|
||||
export const createRoleChangeFields = (
|
||||
oldRole: Partial<RoleProperties>,
|
||||
newRole: Partial<RoleProperties>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue