mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
feat(handlers): inhibitors for deleteChannel() (#401)
* better deleteChannel function * throw error if guild wasn't found * remove dm close ability * change this comment again * guildID should be first
This commit is contained in:
@@ -148,6 +148,17 @@ export async function deleteChannel(
|
||||
throw new Error(Errors.MISSING_MANAGE_CHANNELS);
|
||||
}
|
||||
|
||||
const guild = await cacheHandlers.get("guilds", guildID);
|
||||
if (!guild) throw new Error(Errors.GUILD_NOT_FOUND);
|
||||
|
||||
if (guild?.rulesChannelID === channelID) {
|
||||
throw new Error(Errors.RULES_CHANNEL_CANNOT_BE_DELETED);
|
||||
}
|
||||
|
||||
if (guild?.publicUpdatesChannelID === channelID) {
|
||||
throw new Error(Errors.UPDATES_CHANNEL_CANNOT_BE_DELETED);
|
||||
}
|
||||
|
||||
return RequestManager.delete(endpoints.CHANNEL_BASE(channelID), { reason });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user