3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-11 04:45:02 +00:00

automod: show matched text in summaries; don't use show post date in summaries; add logMessage variable to alert action

Post date will always be more or less the time the log message is posted.

The logMessage variable in the alert action contains the full,
formatted log message that would be posted in a log channel as the
AUTOMOD_ACTION log type.
This commit is contained in:
Dragory 2019-11-30 18:07:25 +02:00
parent fb43ec159a
commit 7df1bb91d2
2 changed files with 175 additions and 127 deletions

View file

@ -209,7 +209,7 @@ export function convertDelayStringToMS(str, defaultUnit = "m"): number {
}
export function successMessage(str) {
return `👌 ${str}`;
return `<:zep_check:650361014180904971> ${str}`;
}
export function errorMessage(str) {
@ -462,7 +462,7 @@ export function getRoleMentions(str: string) {
}
/**
* Disables link previews in the given string by wrapping links in < >
* Disable link previews in the given string by wrapping links in < >
*/
export function disableLinkPreviews(str: string): string {
return str.replace(/(?<!<)(https?:\/\/\S+)/gi, "<$1>");
@ -472,6 +472,17 @@ export function deactivateMentions(content: string): string {
return content.replace(/@/g, "@\u200b");
}
/**
* Disable inline code in the given string by replacing backticks/grave accents with acute accents
* FIXME: Find a better way that keeps the grave accents? Can't use the code block approach here since it's just 1 character.
*/
export function disableInlineCode(content: string): string {
return content.replace(/`/g, "\u00b4");
}
/**
* Disable code blocks in the given string by adding invisible unicode characters between backticks
*/
export function disableCodeBlocks(content: string): string {
return content.replace(/`/g, "`\u200b");
}