diff --git a/backend/src/plugins/Automod/AutomodPlugin.ts b/backend/src/plugins/Automod/AutomodPlugin.ts index 8d9e466b..72cb7aa5 100644 --- a/backend/src/plugins/Automod/AutomodPlugin.ts +++ b/backend/src/plugins/Automod/AutomodPlugin.ts @@ -36,6 +36,7 @@ import { pluginInfo } from "./info"; import { availableTriggers } from "./triggers/availableTriggers"; import { AutomodPluginType, ConfigSchema } from "./types"; import { PhishermanPlugin } from "../Phisherman/PhishermanPlugin"; +import { InternalPosterPlugin } from "../InternalPoster/InternalPosterPlugin"; const defaultOptions = { config: { @@ -193,6 +194,7 @@ export const AutomodPlugin = zeppelinGuildPlugin()({ MutesPlugin, CountersPlugin, PhishermanPlugin, + InternalPosterPlugin, ], configSchema: ConfigSchema, diff --git a/backend/src/plugins/Automod/actions/alert.ts b/backend/src/plugins/Automod/actions/alert.ts index b765811e..7c96dea5 100644 --- a/backend/src/plugins/Automod/actions/alert.ts +++ b/backend/src/plugins/Automod/actions/alert.ts @@ -17,11 +17,13 @@ import { isTruthy, verboseChannelMention, validateAndParseMessageContent, + chunkMessageLines, } from "../../../utils"; import { LogsPlugin } from "../../Logs/LogsPlugin"; import { automodAction } from "../helpers"; import { TemplateSafeUser, userToTemplateSafeUser } from "../../../utils/templateSafeObjects"; import { messageIsEmpty } from "../../../utils/messageIsEmpty"; +import { InternalPosterPlugin } from "../../InternalPoster/InternalPosterPlugin"; export const AlertAction = automodAction({ configType: t.type({ @@ -36,7 +38,7 @@ export const AlertAction = automodAction({ const channel = pluginData.guild.channels.cache.get(actionConfig.channel as Snowflake); const logs = pluginData.getPlugin(LogsPlugin); - if (channel && (channel instanceof TextChannel || channel instanceof ThreadChannel)) { + if (channel && channel instanceof TextChannel) { const text = actionConfig.text; const theMessageLink = contexts[0].message && messageLink(pluginData.guild.id, contexts[0].message.channel_id, contexts[0].message.id); @@ -90,11 +92,14 @@ export const AlertAction = automodAction({ } try { - await createChunkedMessage( - channel, - rendered, - erisAllowedMentionsToDjsMentionOptions(actionConfig.allowed_mentions), - ); + const poster = pluginData.getPlugin(InternalPosterPlugin); + const chunks = chunkMessageLines(rendered); + for (const chunk of chunks) { + await poster.sendMessage(channel, { + content: rendered, + allowedMentions: erisAllowedMentionsToDjsMentionOptions(actionConfig.allowed_mentions), + }); + } } catch (err) { if (err.code === 50001) { logs.logBotAlert({