fix: bad channel.thread handling

This commit is contained in:
Skillz4Killz
2021-06-18 15:47:34 +00:00
committed by GitHub
parent 72f0836b7b
commit 5e4efd0f37
9 changed files with 53 additions and 44 deletions
+3 -2
View File
@@ -12,8 +12,6 @@ export async function deleteChannel(channelId: bigint, reason?: string) {
const guild = await cacheHandlers.get("guilds", channel.guildId);
if (!guild) throw new Error(Errors.GUILD_NOT_FOUND);
// TODO(threads): check if this requires guild perms or channel is enough
await requireBotGuildPermissions(guild, channel.isThreadChannel ? ["MANAGE_THREADS"] : ["MANAGE_CHANNELS"]);
if (guild.rulesChannelId === channelId) {
throw new Error(Errors.RULES_CHANNEL_CANNOT_BE_DELETED);
}
@@ -21,6 +19,9 @@ export async function deleteChannel(channelId: bigint, reason?: string) {
if (guild.publicUpdatesChannelId === channelId) {
throw new Error(Errors.UPDATES_CHANNEL_CANNOT_BE_DELETED);
}
// TODO(threads): check if this requires guild perms or channel is enough
await requireBotGuildPermissions(guild, ["MANAGE_CHANNELS"]);
}
return await rest.runMethod<undefined>("delete", endpoints.CHANNEL_BASE(channelId), { reason });