summaryrefslogtreecommitdiffstats
path: root/bridge/slack
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-05-27 21:50:00 +0200
committerWim <wim@42.be>2018-05-27 21:50:00 +0200
commit411ef2691ccec024cf6b952e42d3f4564cb9ec58 (patch)
tree8de87bbc239f3efcafcc1275e8678f47a7d51ebb /bridge/slack
parentfc6074ea9fba9684aaad1ab6d43a0ec23db8c5d3 (diff)
downloadmatterbridge-msglm-411ef2691ccec024cf6b952e42d3f4564cb9ec58.tar.gz
matterbridge-msglm-411ef2691ccec024cf6b952e42d3f4564cb9ec58.tar.bz2
matterbridge-msglm-411ef2691ccec024cf6b952e42d3f4564cb9ec58.zip
Use uuid instead of userid. Fixes #429
Diffstat (limited to 'bridge/slack')
-rw-r--r--bridge/slack/slack.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go
index cedb18e7..1633d820 100644
--- a/bridge/slack/slack.go
+++ b/bridge/slack/slack.go
@@ -15,6 +15,7 @@ import (
"github.com/42wim/matterbridge/bridge/helper"
"github.com/42wim/matterbridge/matterhook"
"github.com/nlopes/slack"
+ "github.com/rs/xid"
)
type Bslack struct {
@@ -25,6 +26,7 @@ type Bslack struct {
Usergroups []slack.UserGroup
si *slack.Info
channels []slack.Channel
+ uuid string
*bridge.Config
sync.RWMutex
}
@@ -32,7 +34,7 @@ type Bslack struct {
const messageDeleted = "message_deleted"
func New(cfg *bridge.Config) bridge.Bridger {
- return &Bslack{Config: cfg}
+ return &Bslack{Config: cfg, uuid: xid.New().String()}
}
func (b *Bslack) Command(cmd string) string {
@@ -177,7 +179,7 @@ func (b *Bslack) Send(msg config.Message) (string, error) {
np.IconURL = msg.Avatar
}
// add a callback ID so we can see we created it
- np.Attachments = append(np.Attachments, slack.Attachment{CallbackID: "matterbridge_" + b.si.User.ID})
+ np.Attachments = append(np.Attachments, slack.Attachment{CallbackID: "matterbridge_" + b.uuid})
// add file attachments
np.Attachments = append(np.Attachments, b.createAttach(msg.Extra)...)
// add slack attachments (from another slack bridge)
@@ -657,7 +659,7 @@ func (b *Bslack) skipMessageEvent(ev *slack.MessageEvent) bool {
// skip messages we made ourselves
if len(ev.Attachments) > 0 {
- if ev.Attachments[0].CallbackID == "matterbridge_"+b.si.User.ID {
+ if ev.Attachments[0].CallbackID == "matterbridge_"+b.uuid {
return true
}
}