From 2d277a15f5b70a6188aa2871333e089f2f95ceec Mon Sep 17 00:00:00 2001 From: Wim Date: Fri, 19 Apr 2019 18:27:31 +0200 Subject: Add scripting (tengo) support for every outgoing message (#806) Adds a new key OutMessage under [tengo] table, which specifies the location of the script that will be invoked on each message being sent to a bridge and can be used to modify the Username and the Text of that message. The script will have the following global variables: read-only: inAccount, inProtocol, inChannel, inGateway outAccount, outProtocol, outChannel, outGateway read-write: msgText, msgUsername The script is reloaded on every message, so you can modify the script on the fly. The default script in https://github.com/42wim/matterbridge/tree/master/internal/tengo/outmessage.tengo is compiled in and will be executed if no script is specified. --- bridge/irc/handlers.go | 5 ----- 1 file changed, 5 deletions(-) (limited to 'bridge/irc') diff --git a/bridge/irc/handlers.go b/bridge/irc/handlers.go index f0e54928..8f0acaad 100644 --- a/bridge/irc/handlers.go +++ b/bridge/irc/handlers.go @@ -4,7 +4,6 @@ import ( "bytes" "fmt" "io/ioutil" - "regexp" "strconv" "strings" "time" @@ -182,10 +181,6 @@ func (b *Birc) handlePrivMsg(client *girc.Client, event girc.Event) { // strip action, we made an event if it was an action rmsg.Text += event.StripAction() - // strip IRC colors - re := regexp.MustCompile(`\x03(?:\d{1,2}(?:,\d{1,2})?)?|[[:cntrl:]]`) - rmsg.Text = re.ReplaceAllString(rmsg.Text, "") - // start detecting the charset mycharset := b.GetString("Charset") if mycharset == "" { -- cgit v1.2.3