Allowed Slack attachments to be properly updated on edit.

This commit is contained in:
Patrick Connolly
2018-10-24 17:03:00 +08:00
parent eeccb7acd3
commit 8971502f31

View File

@@ -270,18 +270,20 @@ func (b *Bslack) sendRTM(msg config.Message) (string, error) {
msg.Text = msg.Username + msg.Text
}
var messageOptions []slack.MsgOption
// Edit message if we have an ID
if msg.ID != "" {
ts := strings.Fields(msg.ID)
_, _, _, err = b.sc.UpdateMessage(channelInfo.ID, ts[1], slack.MsgOptionText(msg.Text, false))
messageOptions = b.prepareMessageOptions(msg)
messageOptions = append(messageOptions, slack.MsgOptionText(msg.Text, false))
_, _, _, err = b.sc.UpdateMessage(channelInfo.ID, ts[1], messageOptions...)
if err != nil {
return msg.ID, err
}
return msg.ID, nil
}
var messageOptions []slack.MsgOption
// Upload a file if it exists
if msg.Extra != nil {
for _, rmsg := range helper.HandleExtra(&msg, b.General) {