From dce600ad51100d9f9a1cee1d0bda9410f0a2c2a9 Mon Sep 17 00:00:00 2001 From: Wim Date: Tue, 20 Sep 2016 12:20:44 +0200 Subject: [PATCH] Fix joining slack/mattermost channels using the webhook --- bridge/mattermost/mattermost.go | 6 +++++- bridge/slack/slack.go | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/bridge/mattermost/mattermost.go b/bridge/mattermost/mattermost.go index 0e627666..a79a311b 100644 --- a/bridge/mattermost/mattermost.go +++ b/bridge/mattermost/mattermost.go @@ -84,7 +84,11 @@ func (b *Bmattermost) FullOrigin() string { } func (b *Bmattermost) JoinChannel(channel string) error { - return b.mc.JoinChannel(channel) + // we can only join channels using the API + if b.Config.UseAPI { + return b.mc.JoinChannel(channel) + } + return nil } func (b *Bmattermost) Name() string { diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go index 75429852..79b291b2 100644 --- a/bridge/slack/slack.go +++ b/bridge/slack/slack.go @@ -68,9 +68,13 @@ func (b *Bslack) FullOrigin() string { } func (b *Bslack) JoinChannel(channel string) error { - schannel := b.getChannelByName(channel) - if schannel != nil && !schannel.IsMember { - b.sc.JoinChannel(schannel.ID) + // we can only join channels using the API + if b.Config.UseAPI { + schannel := b.getChannelByName(channel) + if schannel != nil && !schannel.IsMember { + _, err := b.sc.JoinChannel(schannel.ID) + return err + } } return nil }