From 903290acc98668149b72489a256930f85b8a67cf Mon Sep 17 00:00:00 2001 From: Qais Patankar Date: Mon, 1 Jul 2019 08:15:44 +0900 Subject: [PATCH] router: limit fba2749b0be648c243cbe45c2225624eb48b348e to discord only --- gateway/router.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/gateway/router.go b/gateway/router.go index 84fd8d1a..3d531676 100644 --- a/gateway/router.go +++ b/gateway/router.go @@ -143,9 +143,18 @@ func (r *Router) handleReceive() { msgIDs = append(msgIDs, gw.handleMessage(&msg, br)...) } - // Always add/update the message ID. This is necessary as msgIDs - // will change if a bridge returns a different ID in response to edits. - gw.Messages.Add(msg.Protocol+" "+msg.ID, msgIDs) + if msg.ID != "" { + _, exists := gw.Messages.Get(msg.Protocol + " " + msg.ID) + + // Only add the message ID if it doesn't already exist + // + // For some bridges we always add/update the message ID. + // This is necessary as msgIDs will change if a bridge returns + // a different ID in response to edits. + if !exists || msg.Protocol == "discord" { + gw.Messages.Add(msg.Protocol+" "+msg.ID, msgIDs) + } + } } } }