From 698c5ae066c0bc2904a2f430aa332f6c506bb04e Mon Sep 17 00:00:00 2001 From: Skillz Date: Tue, 22 Sep 2020 19:07:50 -0400 Subject: [PATCH] fix channel perm overwrite type --- src/handlers/channel.ts | 7 +++---- src/types/guild.ts | 9 +++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/handlers/channel.ts b/src/handlers/channel.ts index 534d5703e..2986b7480 100644 --- a/src/handlers/channel.ts +++ b/src/handlers/channel.ts @@ -11,7 +11,6 @@ import type { } from "../types/channel.ts"; import type { RawOverwrite } from "../types/guild.ts"; -import { logYellow } from "../utils/logger.ts"; import { endpoints } from "../constants/discord.ts"; import { RequestManager } from "../module/requestManager.ts"; import { Errors } from "../types/errors.ts"; @@ -189,7 +188,7 @@ export function deleteMessages( } if (ids.length > 100) { - logYellow( + console.warn( `This endpoint only accepts a maximum of 100 messages. Deleting the first 100 message ids provided.`, ); } @@ -326,11 +325,11 @@ export function editChannel( allow: overwrite.allow.reduce( (bits, perm) => bits |= BigInt(Permissions[perm]), BigInt(0), - ), + ).toString(), deny: overwrite.deny.reduce( (bits, perm) => bits |= BigInt(Permissions[perm]), BigInt(0), - ), + ).toString(), }; }, ), diff --git a/src/types/guild.ts b/src/types/guild.ts index 3be883ddf..55cb02533 100644 --- a/src/types/guild.ts +++ b/src/types/guild.ts @@ -450,18 +450,23 @@ export interface Overwrite { /** The role or user id */ id: string; /** Whether this is a role or a member */ - type: "role" | "member"; + type: OverwriteType; /** The permissions that this id is allowed to do. (This will mark it as a green check.) */ allow: Permission[]; /** The permissions that this id is NOT allowed to do. (This will mark it as a red x.) */ deny: Permission[]; } +export enum OverwriteType { + ROLE, + MEMBER, +} + export interface RawOverwrite { /** The role or user id */ id: string; /** Whether this is a role or a member */ - type: "role" | "member"; + type: OverwriteType; /** The permissions that this id is allowed to do. (This will mark it as a green check.) */ allow: number; /** The permissions that this id is NOT allowed to do. (This will mark it as a red x.) */