From f883167dcde27e09b2250b60f0b393f33d53d09d Mon Sep 17 00:00:00 2001 From: Wim Date: Fri, 14 Jun 2019 01:25:54 +0200 Subject: [PATCH] Update settings --- Settings.md | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/Settings.md b/Settings.md index b35ca96..75a7459 100644 --- a/Settings.md +++ b/Settings.md @@ -116,7 +116,8 @@ - [UseFirstName](#usefirstname) - [UseInsecureURL](#useinsecureurl) - [Tengo](#tengo) - - [Message](#message) + - [InMessage](#inmessage) + - [OutMessage](#outmessage) - [RemoteNickFormat](#remotenickformat-2) - [Whatsapp](#whatsapp) - [Number *](#number-) @@ -1136,8 +1137,8 @@ Example: enable it # Tengo More information about tengo on: https://github.com/d5/tengo/blob/master/docs/tutorial.md and https://github.com/d5/tengo/blob/master/docs/stdlib.md -## Message -Message allows you to specify the location of a tengo (https://github.com/d5/tengo/) script. +## InMessage +InMessage allows you to specify the location of a tengo (https://github.com/d5/tengo/) script. This script will receive every incoming message and can be used to modify the Username and the Text of that message. The script will have the following global variables: \ to modify: `msgUsername` and `msgText` \ @@ -1158,10 +1159,34 @@ if text.re_match("blah",msgText) { ``` Setting: OPTIONAL, RELOADABLE \ -Format: string \ -Example: +Format: string +Example: -`Message="example.tengo"` +`InMessage="example.tengo"` + +## OutMessage +OutMessage allows you to specify 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`, `inEvent` +`outAccount`, `outProtocol`, `outChannel`, `outGateway`, `outEvent` + +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. + +Setting: OPTIONAL, RELOADABLE \ +Format: string +Example: + +`OutMessage="example.tengo"` ## RemoteNickFormat RemoteNickFormat allows you to specify the location of a tengo (https://github.com/d5/tengo/) script.