Improved links parsing and replacing in Matrix and Telegram pushers.

Related to #3.
This commit is contained in:
2019-03-06 05:08:00 +05:00
parent c93fa504ad
commit 27414ccf15
3 changed files with 5 additions and 4 deletions

View File

@@ -40,8 +40,9 @@ func (dp DefaultParser) ParseMessage(message slackmessage.SlackMessage) map[stri
}
// Get all links from message.
r := regexp.MustCompile("((https??://[a-zA-Z0-9.#!*/ _-]+)\\|([a-zA-Z0-9.#!*/ _+-]+))")
r := regexp.MustCompile(`<{1}([\pL\pP\pN]+)\|{1}([\pL\pP\pN\pZs]+)>{1}`)
foundLinks := r.FindAllStringSubmatch(msg, -1)
c.Log.Debugln("Found links:", foundLinks)
// Replace them.
/*for _, link := range foundLinks {