mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-25 23:41:35 +00:00
This commit is contained in:
parent
53dfb78215
commit
5619a75b05
@ -13,7 +13,9 @@ type BLegacy struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewLegacy(cfg *bridge.Config) bridge.Bridger {
|
func NewLegacy(cfg *bridge.Config) bridge.Bridger {
|
||||||
return &BLegacy{Bslack: newBridge(cfg)}
|
b := &BLegacy{Bslack: newBridge(cfg)}
|
||||||
|
b.legacy = true
|
||||||
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BLegacy) Connect() error {
|
func (b *BLegacy) Connect() error {
|
||||||
|
@ -32,6 +32,7 @@ type Bslack struct {
|
|||||||
|
|
||||||
channels *channels
|
channels *channels
|
||||||
users *users
|
users *users
|
||||||
|
legacy bool
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -151,6 +152,18 @@ func (b *Bslack) JoinChannel(channel config.ChannelInfo) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// try to join a channel when in legacy
|
||||||
|
if b.legacy {
|
||||||
|
_, err := b.sc.JoinChannel(channel.Name)
|
||||||
|
if err != nil {
|
||||||
|
switch err.Error() {
|
||||||
|
case "name_taken", "restricted_action":
|
||||||
|
case "default":
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
b.channels.populateChannels(false)
|
b.channels.populateChannels(false)
|
||||||
|
|
||||||
channelInfo, err := b.channels.getChannel(channel.Name)
|
channelInfo, err := b.channels.getChannel(channel.Name)
|
||||||
@ -163,7 +176,8 @@ func (b *Bslack) JoinChannel(channel config.ChannelInfo) error {
|
|||||||
channel.Name = channelInfo.Name
|
channel.Name = channelInfo.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
if !channelInfo.IsMember {
|
// 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)
|
return fmt.Errorf("slack integration that matterbridge is using is not member of channel '%s', please add it manually", channelInfo.Name)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user