feat: detect reply/forward/crosspost in message capture + inject into AI moderation

- Add is_reply, is_forward, is_crosspost, reference_message_id,
  reference_channel_id, reference_guild_id columns to messages table
- Update MessageRecord type with reference fields
- Extract reply/forward/crosspost from Discord message type/flags
- Track reference.type (DEFAULT=reply, FORWARD) and CROSSPOSTED flag
- Inject <reference> XML with parent content into LLM moderation prompt
- Add reply/forward/crosspost rules to moderation prompt rules
- Format context messages with [reply_to], [forward_from], [crosspost]
- Add migration 0009

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-06-13 00:55:42 +07:00
co-authored by Claude
parent 0ac056dc8a
commit e3249edb6c
9 changed files with 133 additions and 8 deletions
@@ -0,0 +1,7 @@
ALTER TABLE messages
ADD COLUMN IF NOT EXISTS is_reply boolean,
ADD COLUMN IF NOT EXISTS is_forward boolean,
ADD COLUMN IF NOT EXISTS is_crosspost boolean,
ADD COLUMN IF NOT EXISTS reference_message_id text,
ADD COLUMN IF NOT EXISTS reference_channel_id text,
ADD COLUMN IF NOT EXISTS reference_guild_id text;
@@ -64,6 +64,13 @@
"when": 1781270000000,
"tag": "0008_add_user_profiles_table",
"breakpoints": true
},
{
"idx": 9,
"version": "7",
"when": 1781316000000,
"tag": "0009_add_reply_forward_crosspost",
"breakpoints": true
}
]
}