From 2a7f28606c4984a37c89b0c90cfa986a602d1e77 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 20 Mar 2021 14:46:36 -0700 Subject: [PATCH] Declare GUILD_MEMBERS privileged intent (discord) (#1428) Without this declared, it seems that Discord will not send any member update events after connection, even if the privileged gateway intent is enabled for the bot in settings. This causes nick tracking to get out of sync when people change their nicks after the bot connects. See: https://discord.com/developers/docs/topics/gateway#gateway-intents --- bridge/discord/discord.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bridge/discord/discord.go b/bridge/discord/discord.go index 5f28a3bd..9cc83ddc 100644 --- a/bridge/discord/discord.go +++ b/bridge/discord/discord.go @@ -75,6 +75,11 @@ func (b *Bdiscord) Connect() error { b.c.AddHandler(b.messageDeleteBulk) b.c.AddHandler(b.memberAdd) b.c.AddHandler(b.memberRemove) + // Add privileged intent for guild member tracking. This is needed to track nicks + // for display names and @mention translation + b.c.Identify.Intents = discordgo.MakeIntent(discordgo.IntentsAllWithoutPrivileged | + discordgo.IntentsGuildMembers) + err = b.c.Open() if err != nil { return err