commit 982122bdd2d56f50a2c9bd30bc6fc4c07ac47b4a
Author: Wim <wim@42.be>
Date: Wed Mar 20 23:19:27 2019 +0000
diff --git a/bridge/rocketchat/rocketchat.go b/bridge/rocketchat/rocketchat.go
index dac0564..fa1dd28 100644
--- a/bridge/rocketchat/rocketchat.go
+++ b/bridge/rocketchat/rocketchat.go
@@ -26 +27 @@ package brocketchat
import (
"errors"
+ "strings"
"sync"
"github.com/42wim/matterbridge/bridge"
@@ -8514 +8614 @@ func (b *Brocketchat) JoinChannel(channel config.ChannelInfo) error {
if b.c == nil {
return nil
}
- id, err := b.c.GetChannelId(channel.Name)
+ id, err := b.c.GetChannelId(strings.TrimPrefix(channel.Name, "#"))
if err != nil {
return err
}
b.Lock()
b.channelMap[id] = channel.Name
b.Unlock()
- mychannel := &models.Channel{ID: id, Name: channel.Name}
+ mychannel := &models.Channel{ID: id, Name: strings.TrimPrefix(channel.Name, "#")}
if err := b.c.JoinChannel(id); err != nil {
return err
}
@@ -1036 +1048 @@ func (b *Brocketchat) JoinChannel(channel config.ChannelInfo) error {
}
func (b *Brocketchat) Send(msg config.Message) (string, error) {
+ // strip the # if people has set this
+ msg.Channel = strings.TrimPrefix(msg.Channel, "#")
channel := &models.Channel{ID: b.getChannelID(msg.Channel), Name: msg.Channel}
// Delete message
@@ -1316 +1348 @@ func (b *Brocketchat) Send(msg config.Message) (string, error) {
// Upload a file if it exists
if msg.Extra != nil {
for _, rmsg := range helper.HandleExtra(&msg, b.General) {
+ // strip the # if people has set this
+ rmsg.Channel = strings.TrimPrefix(rmsg.Channel, "#")
smsg := &models.Message{
RoomID: b.getChannelID(rmsg.Channel),
Msg: rmsg.Username + rmsg.Text,