From 1e7a35eb4d2a044be4b94d3ed662a6aadf5a25ed Mon Sep 17 00:00:00 2001 From: Almeida Date: Sat, 25 Sep 2021 19:37:50 +0100 Subject: [PATCH] allow running cleancmd on news and thread channels (#293) --- backend/src/plugins/Utility/commands/CleanCmd.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/backend/src/plugins/Utility/commands/CleanCmd.ts b/backend/src/plugins/Utility/commands/CleanCmd.ts index 60e79f26..6abbb481 100644 --- a/backend/src/plugins/Utility/commands/CleanCmd.ts +++ b/backend/src/plugins/Utility/commands/CleanCmd.ts @@ -1,7 +1,5 @@ import { Message, Snowflake, TextChannel, User } from "discord.js"; import { GuildPluginData } from "knub"; -import moment from "moment-timezone"; -import { channelToTemplateSafeChannel, userToTemplateSafeUser } from "../../../utils/templateSafeObjects"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { SavedMessage } from "../../../data/entities/SavedMessage"; import { LogType } from "../../../data/LogType"; @@ -10,7 +8,6 @@ import { getBaseUrl, sendErrorMessage, sendSuccessMessage } from "../../../plugi import { allowTimeout } from "../../../RegExpRunner"; import { DAYS, getInviteCodesInString, noop, SECONDS } from "../../../utils"; import { utilityCmd, UtilityPluginType } from "../types"; -import { boolean, number } from "io-ts"; import { LogsPlugin } from "../../Logs/LogsPlugin"; import { humanizeDurationShort } from "../../../humanizeDurationShort"; @@ -84,7 +81,7 @@ export async function cleanCmd(pluginData: GuildPluginData, a } const targetChannel = args.channel ? pluginData.guild.channels.cache.get(args.channel as Snowflake) : msg.channel; - if (!targetChannel || !(targetChannel instanceof TextChannel)) { + if (!targetChannel?.isText()) { sendErrorMessage(pluginData, msg.channel, `Invalid channel specified`); return; }