mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
fix: bad channel.thread handling
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user