4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-07-04 13:37:44 +00:00

Support rewriting messages from relaybots using ExtractNicks. Fixes #466 (#730)

some examples:
this replaces a message like "Relaybot: <relayeduser> something interesting" to "relayeduser: something interesting"
ExtractNicks=[ [ "Relaybot", "<(.*?)>\\s+" ] ]
you can use multiple entries for multiplebots
this also replaces a message like "otherbot: (relayeduser) something else" to "relayeduser: something else"
ExtractNicks=[ [ "Relaybot", "<(.*?)>\\s+" ],[ "otherbot","\\((.*?)\\)\\s+" ]
OPTIONAL (default empty)
ExtractNicks=[ ["otherbot","<(.*?)>\\s+" ] ]
This commit is contained in:
Wim
2019-02-23 16:35:54 +01:00
committed by GitHub
parent 5095db8a43
commit 3190703dc8
4 changed files with 248 additions and 0 deletions

View File

@ -351,6 +351,8 @@ func (gw *Gateway) modifyMessage(msg *config.Message) {
msg.Text = re.ReplaceAllString(msg.Text, replace)
}
gw.handleExtractNicks(msg)
// messages from api have Gateway specified, don't overwrite
if msg.Protocol != apiProtocol {
msg.Gateway = gw.Name