Fix parseMentions

Fixes #63
This commit is contained in:
erroneousboat 2017-12-01 13:24:02 +01:00
parent c2eee9955e
commit 2874a75228

View File

@ -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 {