From 356ada872c0e1564097e2f8165931fb8c9ee9d23 Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 11 Mar 2023 17:55:11 +0100 Subject: Add handlers at the end. Fixes #1988 (discord) (#2011) --- bridge/discord/discord.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/bridge/discord/discord.go b/bridge/discord/discord.go index 5ae6c572..51dbe6bc 100644 --- a/bridge/discord/discord.go +++ b/bridge/discord/discord.go @@ -81,17 +81,6 @@ func (b *Bdiscord) Connect() error { return err } b.Log.Info("Connection succeeded") - b.c.AddHandler(b.messageCreate) - b.c.AddHandler(b.messageTyping) - b.c.AddHandler(b.messageUpdate) - b.c.AddHandler(b.messageDelete) - b.c.AddHandler(b.messageDeleteBulk) - b.c.AddHandler(b.memberAdd) - b.c.AddHandler(b.memberRemove) - b.c.AddHandler(b.memberUpdate) - if b.GetInt("debuglevel") == 1 { - b.c.AddHandler(b.messageEvent) - } // 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 | @@ -233,6 +222,19 @@ func (b *Bdiscord) Connect() error { b.nickMemberMap[member.Nick] = member } } + + b.c.AddHandler(b.messageCreate) + b.c.AddHandler(b.messageTyping) + b.c.AddHandler(b.messageUpdate) + b.c.AddHandler(b.messageDelete) + b.c.AddHandler(b.messageDeleteBulk) + b.c.AddHandler(b.memberAdd) + b.c.AddHandler(b.memberRemove) + b.c.AddHandler(b.memberUpdate) + if b.GetInt("debuglevel") == 1 { + b.c.AddHandler(b.messageEvent) + } + return nil } -- cgit v1.2.3