Fix regexp in replaceMention (slack). (#435)

This commit is contained in:
Patrick Connolly 2018-05-29 16:49:10 -04:00 committed by Wim
parent d03afc12fd
commit 045cb2058c

View File

@ -357,7 +357,7 @@ func (b *Bslack) userGroupName(id string) string {
// @see https://api.slack.com/docs/message-formatting#linking_to_channels_and_users // @see https://api.slack.com/docs/message-formatting#linking_to_channels_and_users
func (b *Bslack) replaceMention(text string) string { func (b *Bslack) replaceMention(text string) string {
results := regexp.MustCompile(`<@([a-zA-z0-9]+)>`).FindAllStringSubmatch(text, -1) results := regexp.MustCompile(`<@([a-zA-Z0-9]+)>`).FindAllStringSubmatch(text, -1)
for _, r := range results { for _, r := range results {
text = strings.Replace(text, "<@"+r[1]+">", "@"+b.userName(r[1]), -1) text = strings.Replace(text, "<@"+r[1]+">", "@"+b.userName(r[1]), -1)
} }