From 28e14565c30ac4d07abb3a4baf18f6be50c40bec Mon Sep 17 00:00:00 2001 From: dotwoo Date: Fri, 27 Feb 2026 11:37:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(discord):=20=E4=BF=AE=E6=AD=A3=E7=94=A8?= =?UTF-8?q?=E6=88=B7ID=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91=E4=BB=A5?= =?UTF-8?q?=E5=8C=85=E5=90=AB=E7=94=A8=E6=88=B7=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在检查允许列表时,将用户ID和用户名组合作为唯一标识符,避免潜在的用户识别问题 --- pkg/channels/discord.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/channels/discord.go b/pkg/channels/discord.go index f6faa3373..10dac8e9a 100644 --- a/pkg/channels/discord.go +++ b/pkg/channels/discord.go @@ -175,11 +175,12 @@ func (c *DiscordChannel) handleMessage(s *discordgo.Session, m *discordgo.Messag if m.Author.ID == s.State.User.ID { return } + senderID := m.Author.ID + "|" + m.Author.Username // Check allowlist first to avoid downloading attachments and transcribing for rejected users - if !c.IsAllowed(m.Author.ID) { + if !c.IsAllowed(senderID) { logger.DebugCF("discord", "Message rejected by allowlist", map[string]any{ - "user_id": m.Author.ID, + "user_id": senderID, }) return } @@ -202,7 +203,6 @@ func (c *DiscordChannel) handleMessage(s *discordgo.Session, m *discordgo.Messag } } - senderID := m.Author.ID senderName := m.Author.Username if m.Author.Discriminator != "" && m.Author.Discriminator != "0" { senderName += "#" + m.Author.Discriminator