Skip to content

Commit

Permalink
Put tracked/reported message content in a thread
Browse files Browse the repository at this point in the history
  • Loading branch information
vcarl committed May 13, 2024
1 parent f29c9c7 commit 5316bea
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/helpers/modLog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ export const reportUser = async ({
});

const warningMessage = await modLog.send(logBody);
const thread = await warningMessage.startThread({
name: message.content.slice(0, 50).toLocaleLowerCase().trim(),
});
await thread.send(quoteAndEscape(message.content).trim().slice(0, 2000));

warningMessages.set(simplifiedContent, {
logMessage: warningMessage,
Expand Down Expand Up @@ -124,15 +128,13 @@ const constructLog = async ({
)} ago`;
const extra = origExtra ? `\n${origExtra}\n` : "";

const reportedMessage = quoteAndEscape(lastReport.message.content).trim();
const attachments = describeAttachments(lastReport.message.attachments);

return {
content: truncateMessage(`${preface}
${reports}
${extra}
${reportedMessage}`),
${extra}`),
embeds: attachments ? [{ description: `\n\n${attachments}` }] : undefined,
};
};

0 comments on commit 5316bea

Please sign in to comment.