From b1903b1d8cc957fc6298db0d728b5d0a00cdac37 Mon Sep 17 00:00:00 2001 From: ayyanm Date: Thu, 29 Oct 2020 10:50:52 -0700 Subject: [PATCH] Add _rawPermissionOverwrites property to Channel --- src/structures/channel.ts | 3 +++ src/utils/permissions.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/structures/channel.ts b/src/structures/channel.ts index cdd6d347b..0405dd03b 100644 --- a/src/structures/channel.ts +++ b/src/structures/channel.ts @@ -14,6 +14,7 @@ export async function createChannel( rate_limit_per_user: rateLimitPerUser, parent_id: parentID, last_pin_timestamp: lastPinTimestamp, + permission_overwrites, ...rest } = data; @@ -43,6 +44,8 @@ export async function createChannel( nsfw: data.nsfw || false, /** The mention of the channel */ mention: `<#${data.id}>`, + /** Raw permissions */ + _rawPermissionOverwrites: permission_overwrites, }; cacheHandlers.set("channels", data.id, channel); diff --git a/src/utils/permissions.ts b/src/utils/permissions.ts index 1902e3387..0a3a39543 100644 --- a/src/utils/permissions.ts +++ b/src/utils/permissions.ts @@ -108,7 +108,7 @@ export async function hasChannelPermissions( let everyoneOverwrite: RawOverwrite | undefined; let rolesOverwrites: RawOverwrite[] = []; - for (const overwrite of channel.permissionOverwrites || []) { + for (const overwrite of channel._rawPermissionOverwrites || []) { // If the overwrite on this channel is specific to this member if (overwrite.id === memberID) memberOverwrite = overwrite; // If it is the everyone role overwrite