From 2874a752280ed83494caee372a304c09a764a98a Mon Sep 17 00:00:00 2001 From: erroneousboat Date: Fri, 1 Dec 2017 13:24:02 +0100 Subject: [PATCH] Fix parseMentions Fixes #63 --- service/slack.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/service/slack.go b/service/slack.go index 2a8676c..c45492c 100644 --- a/service/slack.go +++ b/service/slack.go @@ -403,13 +403,14 @@ func parseMessage(s *SlackService, msg string) string { // <@U12345> func parseMentions(s *SlackService, msg string) string { r := regexp.MustCompile(`\<@(\w+\|*\w+)\>`) - rs := r.FindStringSubmatch(msg) - if len(rs) < 1 { - return msg - } return r.ReplaceAllStringFunc( msg, func(str string) string { + rs := r.FindStringSubmatch(str) + if len(rs) < 1 { + return str + } + var userID string split := strings.Split(rs[1], "|") if len(split) > 0 {