diff options
author | Wim <wim@42.be> | 2018-11-25 00:23:42 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2018-11-29 00:04:54 +0100 |
commit | 02577a2b5c1766f1fbc43700caf30b5b88be5ea7 (patch) | |
tree | f3b0b041f6e15172eba18d8e2b4edd530d0fa2e7 | |
parent | 73501739d5527f1d76dbde10e79e409a1c78d630 (diff) | |
download | matterbridge-msglm-02577a2b5c1766f1fbc43700caf30b5b88be5ea7.tar.gz matterbridge-msglm-02577a2b5c1766f1fbc43700caf30b5b88be5ea7.tar.bz2 matterbridge-msglm-02577a2b5c1766f1fbc43700caf30b5b88be5ea7.zip |
Make sure threaded files stay in thread (slack). Fixes #590
-rw-r--r-- | bridge/slack/slack.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go index d5a6084b..d054ae81 100644 --- a/bridge/slack/slack.go +++ b/bridge/slack/slack.go @@ -390,11 +390,16 @@ func (b *Bslack) uploadFile(msg *config.Message, channelID string) { ts := time.Now() b.Log.Debugf("Adding file %s to cache at %s with timestamp", fi.Name, ts.String()) b.cache.Add("filename"+fi.Name, ts) + initialComment := fmt.Sprintf("File from %s", msg.Username) + if fi.Comment != "" { + initialComment += fmt.Sprintf("with comment: %s", fi.Comment) + } res, err := b.sc.UploadFile(slack.FileUploadParameters{ - Reader: bytes.NewReader(*fi.Data), - Filename: fi.Name, - Channels: []string{channelID}, - InitialComment: fi.Comment, + Reader: bytes.NewReader(*fi.Data), + Filename: fi.Name, + Channels: []string{channelID}, + InitialComment: initialComment, + ThreadTimestamp: msg.ParentID, }) if err != nil { b.Log.Errorf("uploadfile %#v", err) |