From 26becb570bf2aea83efa528a742637aa1dd270a7 Mon Sep 17 00:00:00 2001 From: Amish Shah Date: Sat, 4 Feb 2017 20:58:39 +0000 Subject: [PATCH] Fix #1168 (.hasPermission) --- src/structures/GuildChannel.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index ba8825719..ef7402274 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -64,10 +64,12 @@ class GuildChannel extends Channel { for (const role of roles.values()) permissions |= role.permissions; const overwrites = this.overwritesFor(member, true, roles); + let allow = 0; for (const overwrite of overwrites.role.concat(overwrites.member)) { permissions &= ~overwrite.deny; - permissions |= overwrite.allow; + allow |= overwrite.allow; } + permissions |= allow; const admin = Boolean(permissions & Constants.PermissionFlags.ADMINISTRATOR); if (admin) permissions = Constants.ALL_PERMISSIONS;