Fix logMessage variable not working in automod alert
This commit is contained in:
parent
bd2c51691a
commit
0b28215208
1 changed files with 10 additions and 1 deletions
|
@ -16,10 +16,12 @@ import {
|
||||||
tNormalizedNullOptional,
|
tNormalizedNullOptional,
|
||||||
isTruthy,
|
isTruthy,
|
||||||
verboseChannelMention,
|
verboseChannelMention,
|
||||||
|
validateAndParseMessageContent,
|
||||||
} from "../../../utils";
|
} from "../../../utils";
|
||||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||||
import { automodAction } from "../helpers";
|
import { automodAction } from "../helpers";
|
||||||
import { TemplateSafeUser, userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
|
import { TemplateSafeUser, userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
|
||||||
|
import { messageIsEmpty } from "../../../utils/messageIsEmpty";
|
||||||
|
|
||||||
export const AlertAction = automodAction({
|
export const AlertAction = automodAction({
|
||||||
configType: t.type({
|
configType: t.type({
|
||||||
|
@ -66,7 +68,7 @@ export const AlertAction = automodAction({
|
||||||
actionsTaken,
|
actionsTaken,
|
||||||
matchSummary: matchResult.summary,
|
matchSummary: matchResult.summary,
|
||||||
messageLink: theMessageLink,
|
messageLink: theMessageLink,
|
||||||
logMessage: logMessage?.content,
|
logMessage: validateAndParseMessageContent(logMessage)?.content,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -80,6 +82,13 @@ export const AlertAction = automodAction({
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (messageIsEmpty(rendered)) {
|
||||||
|
pluginData.getPlugin(LogsPlugin).logBotAlert({
|
||||||
|
body: `Tried to send alert with an empty message for automod rule ${ruleName}`,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await createChunkedMessage(
|
await createChunkedMessage(
|
||||||
channel,
|
channel,
|
||||||
|
|
Loading…
Add table
Reference in a new issue