From 47ede28f5d2f4705a4183ec9ed5583acf47191a3 Mon Sep 17 00:00:00 2001 From: ayyanm Date: Thu, 29 Oct 2020 10:38:40 -0700 Subject: [PATCH] Rename permission_overwrites to permissionOverwrites --- src/handlers/guild.ts | 2 +- src/structures/channel.ts | 2 +- src/types/guild.ts | 2 +- src/utils/permissions.ts | 2 +- tests/mod.test.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/handlers/guild.ts b/src/handlers/guild.ts index 385b2c017..f80780993 100644 --- a/src/handlers/guild.ts +++ b/src/handlers/guild.ts @@ -105,7 +105,7 @@ export async function createGuildChannel( (await RequestManager.post(endpoints.GUILD_CHANNELS(guild.id), { ...options, name, - permission_overwrites: options?.permission_overwrites?.map((perm) => ({ + permission_overwrites: options?.permissionOverwrites?.map((perm) => ({ ...perm, allow: perm.allow.reduce( diff --git a/src/structures/channel.ts b/src/structures/channel.ts index acc29ebb4..cdd6d347b 100644 --- a/src/structures/channel.ts +++ b/src/structures/channel.ts @@ -32,7 +32,7 @@ export async function createChannel( /** The last time when a message was pinned in this channel */ lastPinTimestamp, /** The permission overwrites for this channel */ - permissions: data.permission_overwrites + permissionOverwrites: data.permission_overwrites ? data.permission_overwrites.map((perm) => ({ ...perm, allow: calculatePermissions(BigInt(perm.allow)), diff --git a/src/types/guild.ts b/src/types/guild.ts index 7bcd4991e..590428f64 100644 --- a/src/types/guild.ts +++ b/src/types/guild.ts @@ -487,7 +487,7 @@ export interface ChannelCreateOptions { /** The sorting position of the channel */ position?: number; /** The channel's permission overwrites */ - permission_overwrites?: Overwrite[]; + permissionOverwrites?: Overwrite[]; /** The id of the parent category for the channel */ parent_id?: string; /** Whether the channel is nsfw */ diff --git a/src/utils/permissions.ts b/src/utils/permissions.ts index 0c4583a34..1902e3387 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.permission_overwrites || []) { + for (const overwrite of channel.permissionOverwrites || []) { // If the overwrite on this channel is specific to this member if (overwrite.id === memberID) memberOverwrite = overwrite; // If it is the everyone role overwrite diff --git a/tests/mod.test.ts b/tests/mod.test.ts index bfa3169e7..bd966602e 100644 --- a/tests/mod.test.ts +++ b/tests/mod.test.ts @@ -156,7 +156,7 @@ Deno.test({ async fn() { const channel = cache.channels.get(data.channelID); if (!channel) throw "Channel not found"; - assertArrayIncludes(channel.permission_overwrites!, [ + assertArrayIncludes(channel.permissionOverwrites!, [ { id: data.roleID, type: OverwriteType.ROLE,