From 77890fe9f0478f32e3eec29bb3ed916180a4406e Mon Sep 17 00:00:00 2001 From: ITOH Date: Thu, 10 Dec 2020 08:10:33 +0100 Subject: [PATCH] Remove editChannelOverwrite() --- src/handlers/channel.ts | 43 ----------------------------------------- 1 file changed, 43 deletions(-) diff --git a/src/handlers/channel.ts b/src/handlers/channel.ts index eff984b5f..a06078fde 100644 --- a/src/handlers/channel.ts +++ b/src/handlers/channel.ts @@ -13,13 +13,11 @@ import { GetMessagesBefore, MessageContent, MessageCreateOptions, - Overwrite, Permission, Permissions, RawOverwrite, WebhookPayload, } from "../types/types.ts"; -import { cache } from "../utils/cache.ts"; import { endpoints } from "../utils/constants.ts"; import { botHasChannelPermissions, @@ -421,47 +419,6 @@ export async function editChannel( ); } -export async function editChannelOverwrite( - channelID: string, - overwrite: Overwrite, - reason?: string, -) { - const hasManageChannelPerm = await botHasChannelPermissions( - channelID, - ["MANAGE_CHANNELS"], - ); - if (!hasManageChannelPerm) { - throw new Error(Errors.MISSING_MANAGE_CHANNELS); - } - - let channel = cache.channels.get(channelID); - if (!channel) throw new Error(Errors.CHANNEL_NOT_FOUND); - - const payload = { - permission_overwrites: [ - ...(channel?.permissionOverwrites || []).map((rawOverwrite) => ({ - id: rawOverwrite.id, - type: rawOverwrite.type, - allow: rawOverwrite.allow, - deny: rawOverwrite.deny, - })), - { - ...overwrite, - allow: calculateBits(overwrite.allow), - deny: calculateBits(overwrite.deny), - }, - ], - }; - - return RequestManager.patch( - endpoints.GUILD_CHANNEL(channelID), - { - ...payload, - reason, - }, - ); -} - /** Follow a News Channel to send messages to a target channel. Requires the `MANAGE_WEBHOOKS` permission in the target channel. Returns the webhook id. */ export async function followChannel( sourceChannelID: string,