Include DM context in reported messages

This commit is contained in:
Noah 2024-01-20 15:17:02 -08:00
parent 8e87c377e8
commit e74f7297e6
2 changed files with 7 additions and 1 deletions

View File

@ -584,6 +584,12 @@ func (s *Server) OnReport(sub *Subscriber, msg messages.Message) {
return
}
// Attach recent message context to DMs.
if strings.HasPrefix(msg.Channel, "@") {
context := getDirectMessageContext(sub.Username, msg.Username)
msg.Message += "\n\nRecent message context:\n\n" + context
}
// Post to the report webhook.
if _, err := PostWebhook(WebhookReport, WebhookRequest{
Action: WebhookReport,

View File

@ -113,7 +113,7 @@ func (s *Server) reportFilteredMessage(sub *Subscriber, msg messages.Message) er
var (
messageContexts = map[string][]string{}
messageContextMu sync.RWMutex
messageContextSize = 10
messageContextSize = 30
)
// Push a message onto the recent messages context.