Type fixes + use template safe values for renderTemplate() everywhere
This commit is contained in:
parent
e16eb8c8d1
commit
d109a58cb7
21 changed files with 190 additions and 98 deletions
|
@ -36,7 +36,11 @@ import { onMessageDelete } from "./util/onMessageDelete";
|
|||
import { onMessageDeleteBulk } from "./util/onMessageDeleteBulk";
|
||||
import { onMessageUpdate } from "./util/onMessageUpdate";
|
||||
import { Util } from "discord.js";
|
||||
import { TemplateSafeValueContainer, TypedTemplateSafeValueContainer } from "../../templateFormatter";
|
||||
import {
|
||||
createTypedTemplateSafeValueContainer,
|
||||
TemplateSafeValueContainer,
|
||||
TypedTemplateSafeValueContainer,
|
||||
} from "../../templateFormatter";
|
||||
import { mapToPublicFn } from "../../pluginUtils";
|
||||
|
||||
import { logAutomodAction } from "./logFunctions/logAutomodAction";
|
||||
|
@ -284,15 +288,19 @@ export const LogsPlugin = zeppelinGuildPlugin<LogsPluginType>()({
|
|||
|
||||
state.regexRunnerRepeatedTimeoutListener = (regexSource, timeoutMs, failedTimes) => {
|
||||
logger.warn(`Disabled heavy regex temporarily: ${regexSource}`);
|
||||
log(pluginData, LogType.BOT_ALERT, {
|
||||
body:
|
||||
`
|
||||
log(
|
||||
pluginData,
|
||||
LogType.BOT_ALERT,
|
||||
createTypedTemplateSafeValueContainer({
|
||||
body:
|
||||
`
|
||||
The following regex has taken longer than ${timeoutMs}ms for ${failedTimes} times and has been temporarily disabled:
|
||||
`.trim() +
|
||||
"\n```" +
|
||||
Util.escapeCodeBlock(regexSource) +
|
||||
"```",
|
||||
});
|
||||
"\n```" +
|
||||
Util.escapeCodeBlock(regexSource) +
|
||||
"```",
|
||||
}),
|
||||
);
|
||||
};
|
||||
state.regexRunner.on("repeatedTimeout", state.regexRunnerRepeatedTimeoutListener);
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue