Include DM context in reported messages

这个提交包含在:
Noah 2024-01-20 15:17:02 -08:00
父节点 8e87c377e8
当前提交 e74f7297e6
共有 2 个文件被更改,包括 7 次插入1 次删除

查看文件

@ -584,6 +584,12 @@ func (s *Server) OnReport(sub *Subscriber, msg messages.Message) {
return 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. // Post to the report webhook.
if _, err := PostWebhook(WebhookReport, WebhookRequest{ if _, err := PostWebhook(WebhookReport, WebhookRequest{
Action: WebhookReport, Action: WebhookReport,

查看文件

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