Fix order of CreateMessageFromMessageEvent

Fixes #14
This commit is contained in:
erroneousboat 2016-10-10 20:43:29 +02:00
parent 0c874120cf
commit 33b36241a1

View File

@ -154,14 +154,7 @@ func (s *SlackService) GetMessages(channel interface{}, count int) []string {
messages = append(messages, msg...)
}
// Reverse the order of the messages, we want the newest in
// the last place
var messagesReversed []string
for i := len(messages) - 1; i >= 0; i-- {
messagesReversed = append(messagesReversed, messages[i])
}
return messagesReversed
return messages
}
// CreateMessage will create a string formatted message that can be rendered
@ -227,7 +220,14 @@ func (s *SlackService) CreateMessage(message slack.Message) []string {
msgs = append(msgs, msg)
return msgs
// Reverse the order of the messages, we want the newest in
// the last place
var messagesReversed []string
for i := len(msgs) - 1; i >= 0; i-- {
messagesReversed = append(messagesReversed, msgs[i])
}
return messagesReversed
}
func (s *SlackService) CreateMessageFromMessageEvent(message *slack.MessageEvent) []string {
@ -287,7 +287,14 @@ func (s *SlackService) CreateMessageFromMessageEvent(message *slack.MessageEvent
msgs = append(msgs, msg)
return msgs
// Reverse the order of the messages, we want the newest in
// the last place
var messagesReversed []string
for i := len(msgs) - 1; i >= 0; i-- {
messagesReversed = append(messagesReversed, msgs[i])
}
return messagesReversed
}
// createMessageFromAttachments will construct a array of string of the Field