Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions bridge/slack/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,6 @@ func (b *Bslack) JoinChannel(channel config.ChannelInfo) error {
return nil
}

// try to join a channel when in legacy
if b.legacy {
_, _, _, err := b.sc.JoinConversation(channel.Name)
if err != nil {
switch err.Error() {
case "name_taken", "restricted_action":
case "default":
return err
}
}
}

b.channels.populateChannels(false)

channelInfo, err := b.channels.getChannel(channel.Name)
Expand All @@ -179,9 +167,16 @@ func (b *Bslack) JoinChannel(channel config.ChannelInfo) error {
channel.Name = channelInfo.Name
}

// we can't join a channel unless we are using legacy tokens #651
if !channelInfo.IsMember && !b.legacy {
return fmt.Errorf("slack integration that matterbridge is using is not member of channel '%s', please add it manually", channelInfo.Name)
if !channelInfo.IsMember {
// try to join a channel
_, _, _, err := b.sc.JoinConversation(channel.Name)
if err != nil {
switch err.Error() {
case "name_taken", "restricted_action":
case "default":
return fmt.Errorf("slack integration that matterbridge is using is not member of channel '%s', please add it manually: %#v", channelInfo.Name, err)
}
}
}
return nil
}
Expand Down