Include DM context in reported messages
This commit is contained in:
parent
8e87c377e8
commit
e74f7297e6
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user