diff --git a/src/service/slack.go b/src/service/slack.go index fc67804..4ca5ea1 100644 --- a/src/service/slack.go +++ b/src/service/slack.go @@ -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