mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-18 15:45:03 +00:00
Automod work. Add config examples to automod.
This commit is contained in:
parent
a6cc1d646e
commit
def46941c9
11 changed files with 539 additions and 258 deletions
20
src/utils.ts
20
src/utils.ts
|
@ -1,5 +1,7 @@
|
|||
import {
|
||||
Attachment,
|
||||
Client,
|
||||
Embed,
|
||||
EmbedOptions,
|
||||
Emoji,
|
||||
Guild,
|
||||
|
@ -23,6 +25,7 @@ const fsp = fs.promises;
|
|||
import https from "https";
|
||||
import tmp from "tmp";
|
||||
import { logger, waitForReaction } from "knub";
|
||||
import { SavedMessage } from "./data/entities/SavedMessage";
|
||||
|
||||
const delayStringMultipliers = {
|
||||
w: 1000 * 60 * 60 * 24 * 7,
|
||||
|
@ -772,3 +775,20 @@ export async function confirm(bot: Client, channel: TextableChannel, userId: str
|
|||
msg.delete().catch(noop);
|
||||
return reply && reply.name === "✅";
|
||||
}
|
||||
|
||||
export function 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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue