diff --git a/bots/discord/src/commands/moderation/purge.ts b/bots/discord/src/commands/moderation/purge.ts index 8f59a31..a956b69 100644 --- a/bots/discord/src/commands/moderation/purge.ts +++ b/bots/discord/src/commands/moderation/purge.ts @@ -1,4 +1,4 @@ -import { EmbedBuilder, GuildChannel } from 'discord.js' +import { EmbedBuilder } from 'discord.js' import { ModerationCommand } from '$/classes/Command' import CommandError, { CommandErrorType } from '$/classes/CommandError' @@ -31,7 +31,7 @@ export default new ModerationCommand({ throw new CommandError(CommandErrorType.MissingArgument, 'Either `amount` or `until` must be provided.') const channel = interaction.channel! - if (!(channel.isTextBased() && channel instanceof GuildChannel)) + if (!channel.isTextBased()) throw new CommandError(CommandErrorType.InvalidChannel, 'The supplied channel is not a text channel.') const embed = applyCommonEmbedStyles( diff --git a/bots/discord/src/commands/moderation/slowmode.ts b/bots/discord/src/commands/moderation/slowmode.ts index 6fe055f..5e55002 100644 --- a/bots/discord/src/commands/moderation/slowmode.ts +++ b/bots/discord/src/commands/moderation/slowmode.ts @@ -28,7 +28,7 @@ export default new ModerationCommand({ if (!channel?.isTextBased() || channel.isDMBased()) throw new CommandError( CommandErrorType.InvalidChannel, - 'The supplied channel is not a text channel or does not exist.', + 'The supplied channel is not a text channel.', ) if (Number.isNaN(duration)) throw new CommandError(CommandErrorType.InvalidDuration, 'Invalid duration.') diff --git a/bots/discord/src/utils/discord/moderation.ts b/bots/discord/src/utils/discord/moderation.ts index 062e6b1..9f8cb00 100644 --- a/bots/discord/src/utils/discord/moderation.ts +++ b/bots/discord/src/utils/discord/moderation.ts @@ -38,7 +38,7 @@ export const getLogChannel = async (guild: Guild) => { try { const channel = await guild.channels.fetch(logConfig.thread ?? logConfig.channel) - if (!channel || !channel.isTextBased()) + if (!channel?.isTextBased()) return void logger.warn('The moderation log channel does not exist, skipping logging') return channel