3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-19 08:05:01 +00:00

Automod work. Add config examples to automod.

This commit is contained in:
Dragory 2019-10-11 01:59:56 +03:00
parent a6cc1d646e
commit def46941c9
11 changed files with 539 additions and 258 deletions

View file

@ -8,6 +8,7 @@ import {
disableCodeBlocks,
disableLinkPreviews,
findRelevantAuditLogEntry,
messageSummary,
noop,
stripObjectToScalars,
UnknownUser,
@ -205,22 +206,8 @@ export class LogsPlugin extends ZeppelinPlugin<TConfigSchema> {
return `<#${channel.id}> (**#${channel.name}**, \`${channel.id}\`)`;
},
messageSummary: (msg: SavedMessage) => {
// Regular text content
let result = "```" + (msg.data.content ? disableCodeBlocks(msg.data.content) : "<no text content>") + "```";
// Rich embed
const richEmbed = (msg.data.embeds || []).find(e => (e as Embed).type === "rich");
if (richEmbed) result += "Embed:```" + disableCodeBlocks(JSON.stringify(richEmbed)) + "```";
// Attachments
if (msg.data.attachments) {
result +=
"Attachments:\n" +
msg.data.attachments.map((a: Attachment) => disableLinkPreviews(a.url)).join("\n") +
"\n";
}
return result;
if (!msg) return "";
return messageSummary(msg);
},
};