summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorWim <wim@42.be>2019-04-19 18:27:31 +0200
committerGitHub <noreply@github.com>2019-04-19 18:27:31 +0200
commit2d277a15f5b70a6188aa2871333e089f2f95ceec (patch)
tree68fb9f5932bf199409cec2a10ffe5dd10f6e6aea /contrib
parentd60468bb05f9fc4066a669cd9704174629a19dd3 (diff)
downloadmatterbridge-msglm-2d277a15f5b70a6188aa2871333e089f2f95ceec.tar.gz
matterbridge-msglm-2d277a15f5b70a6188aa2871333e089f2f95ceec.tar.bz2
matterbridge-msglm-2d277a15f5b70a6188aa2871333e089f2f95ceec.zip
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.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/outmessage-irccolors.tengo7
1 files changed, 7 insertions, 0 deletions
diff --git a/contrib/outmessage-irccolors.tengo b/contrib/outmessage-irccolors.tengo
new file mode 100644
index 00000000..fe63da43
--- /dev/null
+++ b/contrib/outmessage-irccolors.tengo
@@ -0,0 +1,7 @@
+// See https://github.com/42wim/matterbridge/issues/798
+
+// if we're not sending to an irc bridge we strip the IRC colors
+if outProtocol != "irc" {
+ re := text.re_compile(`\x03(?:\d{1,2}(?:,\d{1,2})?)?|[[:cntrl:]]`)
+ msgText=re.replace(msgText,"")
+}