From 5a619c5548b93436f7efb176ca4aa7e9fe347e75 Mon Sep 17 00:00:00 2001 From: Skillz Date: Fri, 17 Jul 2020 10:13:29 -0400 Subject: [PATCH] add deleteChannel() --- handlers/guild.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/handlers/guild.ts b/handlers/guild.ts index aff3b6b8a..5ac4d3e0c 100644 --- a/handlers/guild.ts +++ b/handlers/guild.ts @@ -116,6 +116,15 @@ export async function createGuildChannel( return channel; } +/** Delete a channel in your server. Bot needs MANAGE_CHANNEL permissions in the server. */ +export function deleteChannel(guildID: string, channelID: string, reason?: string) { + if (!botHasPermission(guildID, [Permissions.MANAGE_CHANNELS])) { + throw new Error(Errors.MISSING_MANAGE_CHANNELS); + } + + return RequestManager.delete(endpoints.CHANNEL(channelID), { reason }) +} + /** Returns a list of guild channel objects. * * ⚠️ **If you need this, you are probably doing something wrong. This is not intended for use. Your channels will be cached in your guild.**