diff options
Diffstat (limited to 'bridge')
-rw-r--r-- | bridge/config/config.go | 2 | ||||
-rw-r--r-- | bridge/slack/handlers.go | 2 | ||||
-rw-r--r-- | bridge/slack/slack.go | 4 |
3 files changed, 8 insertions, 0 deletions
diff --git a/bridge/config/config.go b/bridge/config/config.go index 0e36d960..5ccf6041 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -35,6 +35,7 @@ type Message struct { Event string `json:"event"` Protocol string `json:"protocol"` Gateway string `json:"gateway"` + ParentID string `json:"parent_id"` Timestamp time.Time `json:"timestamp"` ID string `json:"id"` Extra map[string][]interface{} @@ -98,6 +99,7 @@ type Protocol struct { NoTLS bool // mattermost Password string // IRC,mattermost,XMPP,matrix PrefixMessagesWithNick bool // mattemost, slack + PreserveThreading bool // slack Protocol string // all protocols QuoteDisable bool // telegram QuoteFormat string // telegram diff --git a/bridge/slack/handlers.go b/bridge/slack/handlers.go index b6400a80..1428cba2 100644 --- a/bridge/slack/handlers.go +++ b/bridge/slack/handlers.go @@ -171,8 +171,10 @@ func (b *Bslack) handleMessageEvent(ev *slack.MessageEvent) (*config.Message, er Account: b.Account, ID: "slack " + ev.Timestamp, Extra: map[string][]interface{}{}, + ParentID: ev.ThreadTimestamp, } + if b.useChannelID { rmsg.Channel = "ID:" + channelInfo.ID } diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go index 2022ebce..d2d118b2 100644 --- a/bridge/slack/slack.go +++ b/bridge/slack/slack.go @@ -310,6 +310,10 @@ 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] + } if msg.Avatar != "" { params.IconURL = msg.Avatar } |