From 0bcb0b882f8f49d9ae889165dc4478d1168e1f25 Mon Sep 17 00:00:00 2001 From: Wim Date: Sun, 17 Feb 2019 21:49:45 +0100 Subject: Support join/leaves from discord. Closes #654 (#721) --- gateway/gateway.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gateway') diff --git a/gateway/gateway.go b/gateway/gateway.go index 6ac0abe5..f74a6680 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -174,6 +174,18 @@ func (gw *Gateway) getDestChannel(msg *config.Message, dest bridge.Bridge) []con return channels } + // discord join/leave is for the whole bridge, isn't a per channel join/leave + if msg.Event == config.EventJoinLeave && dest.Protocol == "discord" && msg.Account == dest.Account { + flog.Error("here") + for _, channel := range gw.Channels { + if channel.Account == msg.Account && strings.Contains(channel.Direction, "out") && + gw.validGatewayDest(msg) { + channels = append(channels, *channel) + } + } + return channels + } + // if source channel is in only, do nothing for _, channel := range gw.Channels { // lookup the channel from the message -- cgit v1.2.3