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

@@ -185,7 +185,7 @@ func (mxc *MatrixConnection) Initialize(conn_name string, api_root string, user
// If we're here - everything is okay and we already in room. Send
// greeting message.
mxc.SendMessage("OpenSAPS is back in business for connection '" + mxc.conn_name + "'!")
//mxc.SendMessage("OpenSAPS is back in business for connection '" + mxc.conn_name + "'!")
}
// This function launches when new data was received thru Slack API.
@@ -200,7 +200,7 @@ func (mxc *MatrixConnection) ProcessMessage(message slackmessage.SlackMessage) {
if linksFound {
links := linksRaw.([][]string)
for _, link := range links {
messageToSend = strings.Replace(messageToSend, "<"+link[0]+">", `<a href="`+link[2]+`">`+link[3]+`</a>`, -1)
messageToSend = strings.Replace(messageToSend, link[0], `<a href="`+link[1]+`">`+link[2]+`</a>`, -1)
}
}