mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
fix(bots/discord): remove bad text channel checks
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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.')
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user