4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-26 23:29:25 +00:00

Fix private channel joining bug (mattermost). Closes #248

This commit is contained in:
Wim
2017-08-30 14:01:17 +02:00
parent 8d4521c1df
commit 9e03fcf162
2 changed files with 15 additions and 4 deletions

View File

@ -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
}