diff options
author | Wim <wim@42.be> | 2018-11-19 21:28:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-19 21:28:23 +0100 |
commit | ae32bae791e6276b4404d6cb19993c3acf543566 (patch) | |
tree | 8a85a5c58fc41138dcf0aa72f95f62d9dd8782a8 /bridge/slack/slack.go | |
parent | 57eba77561e7b6ab5fbaaa799b45078b62c9c808 (diff) | |
download | matterbridge-msglm-ae32bae791e6276b4404d6cb19993c3acf543566.tar.gz matterbridge-msglm-ae32bae791e6276b4404d6cb19993c3acf543566.tar.bz2 matterbridge-msglm-ae32bae791e6276b4404d6cb19993c3acf543566.zip |
Add protocol to msg.ID in cache (#596)
Diffstat (limited to 'bridge/slack/slack.go')
-rw-r--r-- | bridge/slack/slack.go | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go index c4689cbc..0951fb10 100644 --- a/bridge/slack/slack.go +++ b/bridge/slack/slack.go @@ -324,10 +324,8 @@ func (b *Bslack) deleteMessage(msg *config.Message, channelInfo *slack.Channel) return true, nil } - // If we get a "slack <ID>", split it. - ts := strings.Fields(msg.ID) for { - _, _, err := b.rtm.DeleteMessage(channelInfo.ID, ts[1]) + _, _, err := b.rtm.DeleteMessage(channelInfo.ID, msg.ID) if err == nil { return true, nil } @@ -344,9 +342,8 @@ func (b *Bslack) editMessage(msg *config.Message, channelInfo *slack.Channel) (b return false, nil } - ts := strings.Fields(msg.ID) for { - _, _, _, err := b.rtm.UpdateMessage(channelInfo.ID, ts[1], msg.Text) + _, _, _, err := b.rtm.UpdateMessage(channelInfo.ID, msg.ID, msg.Text) if err == nil { return true, nil } @@ -362,7 +359,7 @@ func (b *Bslack) postMessage(msg *config.Message, messageParameters *slack.PostM for { _, id, err := b.rtm.PostMessage(channelInfo.ID, msg.Text, *messageParameters) if err == nil { - return "slack " + id, nil + return id, nil } if err = b.handleRateLimit(err); err != nil { @@ -413,10 +410,7 @@ func (b *Bslack) prepareMessageParameters(msg *config.Message) *slack.PostMessag params.Username = msg.Username params.LinkNames = 1 // replace mentions params.IconURL = config.GetIconURL(msg, b.GetString(iconURLConfig)) - msgFields := strings.Fields(msg.ParentID) - if len(msgFields) >= 2 { - params.ThreadTimestamp = msgFields[1] - } + params.ThreadTimestamp = msg.ParentID if msg.Avatar != "" { params.IconURL = msg.Avatar } |