Allowed Slack attachments to be properly updated on edit.
This commit is contained in:
@@ -270,18 +270,20 @@ func (b *Bslack) sendRTM(msg config.Message) (string, error) {
|
|||||||
msg.Text = msg.Username + msg.Text
|
msg.Text = msg.Username + msg.Text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var messageOptions []slack.MsgOption
|
||||||
|
|
||||||
// Edit message if we have an ID
|
// Edit message if we have an ID
|
||||||
if msg.ID != "" {
|
if msg.ID != "" {
|
||||||
ts := strings.Fields(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 {
|
if err != nil {
|
||||||
return msg.ID, err
|
return msg.ID, err
|
||||||
}
|
}
|
||||||
return msg.ID, nil
|
return msg.ID, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var messageOptions []slack.MsgOption
|
|
||||||
|
|
||||||
// Upload a file if it exists
|
// Upload a file if it exists
|
||||||
if msg.Extra != nil {
|
if msg.Extra != nil {
|
||||||
for _, rmsg := range helper.HandleExtra(&msg, b.General) {
|
for _, rmsg := range helper.HandleExtra(&msg, b.General) {
|
||||||
|
|||||||
Reference in New Issue
Block a user