From d9140ff7a8f4b689b1c9ca104114cd4c63ccf4e6 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Tue, 15 Sep 2020 01:57:46 +0300 Subject: [PATCH] automod: allow alert action to send messages >2000 chars long --- backend/src/plugins/Automod/actions/alert.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/backend/src/plugins/Automod/actions/alert.ts b/backend/src/plugins/Automod/actions/alert.ts index 7c8e724b..61a837ef 100644 --- a/backend/src/plugins/Automod/actions/alert.ts +++ b/backend/src/plugins/Automod/actions/alert.ts @@ -1,7 +1,15 @@ import * as t from "io-ts"; import { automodAction } from "../helpers"; import { LogType } from "../../../data/LogType"; -import { asyncMap, messageLink, resolveMember, stripObjectToScalars, tNullable } from "../../../utils"; +import { + asyncMap, + createChunkedMessage, + isDiscordRESTError, + messageLink, + resolveMember, + stripObjectToScalars, + tNullable, +} from "../../../utils"; import { resolveActionContactMethods } from "../functions/resolveActionContactMethods"; import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin"; import { TextChannel } from "eris"; @@ -47,7 +55,8 @@ export const AlertAction = automodAction({ messageLink: theMessageLink, logMessage, }); - channel.createMessage(rendered); + + await createChunkedMessage(channel, rendered); } else { logs.log(LogType.BOT_ALERT, { body: `Invalid channel id \`${actionConfig.channel}\` for alert action in automod rule **${ruleName}**`,