From e387d20f441547fc37891776b061b95e94cb88e5 Mon Sep 17 00:00:00 2001 From: Bsian Date: Wed, 10 Jun 2020 14:05:07 +0100 Subject: [PATCH] Clean up bitfield calculations --- src/commands/whois.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/commands/whois.ts b/src/commands/whois.ts index 9f56a6a..77c5156 100644 --- a/src/commands/whois.ts +++ b/src/commands/whois.ts @@ -86,15 +86,15 @@ export default class Whois extends Command { const serverAcknowledgements: string[] = []; const bit = member.permission.allow; if (message.guild.ownerID === member.id) serverAcknowledgements.push('Server Owner'); - if ((bit | 8) === bit) { permissions.push('Administrator'); serverAcknowledgements.push('Server Admin'); } - if ((bit | 32) === bit) { permissions.push('Manage Server'); serverAcknowledgements.push('Server Manager'); } - if ((bit | 16) === bit) permissions.push('Manage Channels'); - if ((bit | 268435456) === bit) permissions.push('Manage Roles'); - if ((bit | 8192) === bit) { permissions.push('Manage Messages'); serverAcknowledgements.push('Server Moderator'); } - if ((bit | 134217728) === bit) permissions.push('Manage Nicknames'); - if ((bit | 1073741824) === bit) permissions.push('Manage Emojis'); - if ((bit | 4) === bit) permissions.push('Ban Members'); - if ((bit | 2) === bit) permissions.push('Kick Members'); + if (bit & 8) { permissions.push('Administrator'); serverAcknowledgements.push('Server Admin'); } + if (bit & 32) { permissions.push('Manage Server'); serverAcknowledgements.push('Server Manager'); } + if (bit & 16) permissions.push('Manage Channels'); + if (bit & 268435456) permissions.push('Manage Roles'); + if (bit & 8192) { permissions.push('Manage Messages'); serverAcknowledgements.push('Server Moderator'); } + if (bit & 134217728) permissions.push('Manage Nicknames'); + if (bit & 1073741824) permissions.push('Manage Emojis'); + if (bit & 4) permissions.push('Ban Members'); + if (bit & 2) permissions.push('Kick Members'); const account = await this.client.db.Member.findOne({ userID: member.id }); if (account?.additional?.langs.length > 0) { const langs: string[] = [];