From 19d47784bde7f5d8cfc06f868350ed6ac69c8a21 Mon Sep 17 00:00:00 2001 From: Wim Date: Thu, 31 Dec 2020 16:59:47 +0100 Subject: Add threading support with token (discord) (#1342) Webhooks don't support the threading yet, so this is token only. In discord you can reply on each message of a thread, but this is not possible in mattermost (so some changes added there to make sure we always answer on the rootID of the thread). Also needs some more testing with slack. update : It now also uses the token when replying to a thread (even if webhooks are enabled), until webhooks have support for threads. --- bridge/discord/handlers.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'bridge/discord/handlers.go') diff --git a/bridge/discord/handlers.go b/bridge/discord/handlers.go index 370b8912..d2b38538 100644 --- a/bridge/discord/handlers.go +++ b/bridge/discord/handlers.go @@ -127,6 +127,11 @@ func (b *Bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreat // Replace emotes rmsg.Text = replaceEmotes(rmsg.Text) + // Add our parent id if it exists + if m.MessageReference != nil { + rmsg.ParentID = m.MessageReference.MessageID + } + b.Log.Debugf("<= Sending message from %s on %s to gateway", m.Author.Username, b.Account) b.Log.Debugf("<= Message is %#v", rmsg) b.Remote <- rmsg -- cgit v1.2.3