mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-21 18:22:00 -08:00
Make sure threaded files stay in thread (slack). Fixes #590
This commit is contained in:
parent
0929535b2e
commit
f00d4d7d3f
@ -389,11 +389,16 @@ func (b *Bslack) uploadFile(msg *config.Message, channelID string) {
|
|||||||
ts := time.Now()
|
ts := time.Now()
|
||||||
b.Log.Debugf("Adding file %s to cache at %s with timestamp", fi.Name, ts.String())
|
b.Log.Debugf("Adding file %s to cache at %s with timestamp", fi.Name, ts.String())
|
||||||
b.cache.Add("filename"+fi.Name, ts)
|
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{
|
res, err := b.sc.UploadFile(slack.FileUploadParameters{
|
||||||
Reader: bytes.NewReader(*fi.Data),
|
Reader: bytes.NewReader(*fi.Data),
|
||||||
Filename: fi.Name,
|
Filename: fi.Name,
|
||||||
Channels: []string{channelID},
|
Channels: []string{channelID},
|
||||||
InitialComment: fi.Comment,
|
InitialComment: initialComment,
|
||||||
|
ThreadTimestamp: msg.ParentID,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Log.Errorf("uploadfile %#v", err)
|
b.Log.Errorf("uploadfile %#v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user