fix(bots/discord): remove bad text channel checks

This commit is contained in:
PalmDevs
2024-08-02 18:42:53 +07:00
parent 412e00317d
commit f5939e2528
3 changed files with 4 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
import { EmbedBuilder, GuildChannel } from 'discord.js' import { EmbedBuilder } from 'discord.js'
import { ModerationCommand } from '$/classes/Command' import { ModerationCommand } from '$/classes/Command'
import CommandError, { CommandErrorType } from '$/classes/CommandError' 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.') throw new CommandError(CommandErrorType.MissingArgument, 'Either `amount` or `until` must be provided.')
const channel = interaction.channel! 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.') throw new CommandError(CommandErrorType.InvalidChannel, 'The supplied channel is not a text channel.')
const embed = applyCommonEmbedStyles( const embed = applyCommonEmbedStyles(

View File

@@ -28,7 +28,7 @@ export default new ModerationCommand({
if (!channel?.isTextBased() || channel.isDMBased()) if (!channel?.isTextBased() || channel.isDMBased())
throw new CommandError( throw new CommandError(
CommandErrorType.InvalidChannel, 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.') if (Number.isNaN(duration)) throw new CommandError(CommandErrorType.InvalidDuration, 'Invalid duration.')

View File

@@ -38,7 +38,7 @@ export const getLogChannel = async (guild: Guild) => {
try { try {
const channel = await guild.channels.fetch(logConfig.thread ?? logConfig.channel) 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 void logger.warn('The moderation log channel does not exist, skipping logging')
return channel return channel