Helper to create valid messages

This commit is contained in:
Rory&
2025-10-19 08:24:28 +02:00
parent bf6ee92613
commit 416384c8fa
2 changed files with 44 additions and 1 deletions
@@ -457,13 +457,15 @@ router.post(
for (const action of alertActions) {
const alertChannel = await Channel.findOne({ where: { id: action.metadata.channel_id } });
if (!alertChannel) continue;
const msg = Message.create({
const msg = await Message.createWithDefaults({
channel_id: alertChannel.id,
content: `Automod Alert: Message ${message.id} by <@${message.author_id}> in <#${channel.id}> triggered automod rule "${rule.name}".\nMatched terms: ${matches
.map((x) => `\`${x![0]}\``)
.join(", ")}`,
author: message.author,
guild_id: message.guild_id,
member_id: message.member_id,
author_id: message.author_id
});
await Promise.all([
Message.insert(message),