Add _rawPermissionOverwrites property to Channel

This commit is contained in:
ayyanm
2020-10-29 10:50:52 -07:00
parent 47ede28f5d
commit b1903b1d8c
2 changed files with 4 additions and 1 deletions
+3
View File
@@ -14,6 +14,7 @@ export async function createChannel(
rate_limit_per_user: rateLimitPerUser, rate_limit_per_user: rateLimitPerUser,
parent_id: parentID, parent_id: parentID,
last_pin_timestamp: lastPinTimestamp, last_pin_timestamp: lastPinTimestamp,
permission_overwrites,
...rest ...rest
} = data; } = data;
@@ -43,6 +44,8 @@ export async function createChannel(
nsfw: data.nsfw || false, nsfw: data.nsfw || false,
/** The mention of the channel */ /** The mention of the channel */
mention: `<#${data.id}>`, mention: `<#${data.id}>`,
/** Raw permissions */
_rawPermissionOverwrites: permission_overwrites,
}; };
cacheHandlers.set("channels", data.id, channel); cacheHandlers.set("channels", data.id, channel);
+1 -1
View File
@@ -108,7 +108,7 @@ export async function hasChannelPermissions(
let everyoneOverwrite: RawOverwrite | undefined; let everyoneOverwrite: RawOverwrite | undefined;
let rolesOverwrites: RawOverwrite[] = []; 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 the overwrite on this channel is specific to this member
if (overwrite.id === memberID) memberOverwrite = overwrite; if (overwrite.id === memberID) memberOverwrite = overwrite;
// If it is the everyone role overwrite // If it is the everyone role overwrite