From 9e03fcf1625aa7072ea5177b8a5d318b6f2995cd Mon Sep 17 00:00:00 2001 From: Wim Date: Wed, 30 Aug 2017 14:01:17 +0200 Subject: Fix private channel joining bug (mattermost). Closes #248 --- bridge/mattermost/mattermost.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'bridge') diff --git a/bridge/mattermost/mattermost.go b/bridge/mattermost/mattermost.go index 6bc1ebb7..fc4fdb96 100644 --- a/bridge/mattermost/mattermost.go +++ b/bridge/mattermost/mattermost.go @@ -2,6 +2,7 @@ package bmattermost import ( "errors" + "fmt" "github.com/42wim/matterbridge/bridge/config" "github.com/42wim/matterbridge/matterclient" "github.com/42wim/matterbridge/matterhook" @@ -132,7 +133,11 @@ func (b *Bmattermost) Disconnect() error { func (b *Bmattermost) JoinChannel(channel config.ChannelInfo) error { // we can only join channels using the API if b.Config.WebhookURL == "" && b.Config.WebhookBindAddress == "" { - return b.mc.JoinChannel(b.mc.GetChannelId(channel.Name, "")) + id := b.mc.GetChannelId(channel.Name, "") + if id == "" { + return fmt.Errorf("Could not find channel ID for channel %s", channel.Name) + } + return b.mc.JoinChannel(id) } return nil } -- cgit v1.2.3