allow running cleancmd on news and thread channels (#293)

This commit is contained in:
Almeida 2021-09-25 19:37:50 +01:00 committed by GitHub
parent 2042459fd2
commit 1e7a35eb4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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<UtilityPluginType>, 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;
}