summaryrefslogtreecommitdiffstats
path: root/bridge/discord/discord.go
diff options
context:
space:
mode:
authorJames Lu <james@overdrivenetworks.com>2021-03-20 14:46:36 -0700
committerGitHub <noreply@github.com>2021-03-20 22:46:36 +0100
commit2a7f28606c4984a37c89b0c90cfa986a602d1e77 (patch)
treeec3aa7e99bc0800478bc9d40c6695fecd27355c9 /bridge/discord/discord.go
parent0450482e6ebed8a379f2d43f0ee264ea0d130a31 (diff)
downloadmatterbridge-msglm-2a7f28606c4984a37c89b0c90cfa986a602d1e77.tar.gz
matterbridge-msglm-2a7f28606c4984a37c89b0c90cfa986a602d1e77.tar.bz2
matterbridge-msglm-2a7f28606c4984a37c89b0c90cfa986a602d1e77.zip
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
Diffstat (limited to 'bridge/discord/discord.go')
-rw-r--r--bridge/discord/discord.go5
1 files changed, 5 insertions, 0 deletions
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