Fix some slack integrations

Fixes #13

For instance the github integration doesn't have a
discoverable username, so this will become unkown.

Some integrations with attachment fields, title and
text should be tested for the correct order.
This commit is contained in:
erroneousboat 2016-10-31 21:26:12 +01:00
parent bc29c82f99
commit 9284355b80

View File

@ -260,7 +260,7 @@ func (s *SlackService) CreateMessageFromMessageEvent(message *slack.MessageEvent
var msgs []string var msgs []string
var name string var name string
// Append (edited) when and edit message is received // Append (edited) when an edited message is received
if message.SubType == "message_changed" { if message.SubType == "message_changed" {
message = &slack.MessageEvent{Msg: *message.SubMessage} message = &slack.MessageEvent{Msg: *message.SubMessage}
message.Text = fmt.Sprintf("%s (edited)", message.Text) message.Text = fmt.Sprintf("%s (edited)", message.Text)
@ -335,6 +335,15 @@ func createMessageFromAttachments(atts []slack.Attachment) []string {
), ),
) )
} }
if att.Text != "" {
msgs = append(msgs, att.Text)
}
if att.Title != "" {
msgs = append(msgs, att.Title)
}
} }
return msgs return msgs
} }