fix(discord): 修正用户ID处理逻辑以包含用户名
在检查允许列表时,将用户ID和用户名组合作为唯一标识符,避免潜在的用户识别问题
This commit is contained in:
parent
2c8416e658
commit
28e14565c3
1 changed files with 3 additions and 3 deletions
|
|
@ -175,11 +175,12 @@ func (c *DiscordChannel) handleMessage(s *discordgo.Session, m *discordgo.Messag
|
||||||
if m.Author.ID == s.State.User.ID {
|
if m.Author.ID == s.State.User.ID {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
senderID := m.Author.ID + "|" + m.Author.Username
|
||||||
|
|
||||||
// Check allowlist first to avoid downloading attachments and transcribing for rejected users
|
// 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{
|
logger.DebugCF("discord", "Message rejected by allowlist", map[string]any{
|
||||||
"user_id": m.Author.ID,
|
"user_id": senderID,
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -202,7 +203,6 @@ func (c *DiscordChannel) handleMessage(s *discordgo.Session, m *discordgo.Messag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
senderID := m.Author.ID
|
|
||||||
senderName := m.Author.Username
|
senderName := m.Author.Username
|
||||||
if m.Author.Discriminator != "" && m.Author.Discriminator != "0" {
|
if m.Author.Discriminator != "" && m.Author.Discriminator != "0" {
|
||||||
senderName += "#" + m.Author.Discriminator
|
senderName += "#" + m.Author.Discriminator
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue