Refactor message type handling for Discord messages

Update as suggested to ignore type of message we don't want for sure.
This commit is contained in:
VasilyKaiser 2026-02-26 20:08:56 +01:00 committed by GitHub
parent 386fbeb330
commit d4fda7bf69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -176,13 +176,15 @@ func (c *DiscordChannel) handleMessage(s *discordgo.Session, m *discordgo.Messag
return return
} }
// Ignore system messages (including thread creation messages) // Ignore system messages (thread creation, pins, boosts, etc.)
// MessageTypeDefault (0) = regular user message switch m.Type {
if m.Type != discordgo.MessageTypeDefault { case discordgo.MessageTypeDefault, discordgo.MessageTypeReply:
logger.DebugCF("discord", "Message ignored - system message", map[string]any{ // These are real user messages, process them
"message_type": int(m.Type), default:
}) logger.DebugCF("discord", "Message ignored - system message", map[string]any{
return "message_type": int(m.Type),
})
return
} }
// Check allowlist first to avoid downloading attachments and transcribing for rejected users // Check allowlist first to avoid downloading attachments and transcribing for rejected users