diff options
author | Wim <wim@42.be> | 2019-09-07 20:01:40 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2019-09-07 20:01:54 +0200 |
commit | 9327810bbfe9cf0da2415d223fc642d943ff2ade (patch) | |
tree | 7528300981b7a439db06123aa9f5a1001828b663 /contrib | |
parent | f66d5f1e58b25df47d8062481a25dd1522e693b0 (diff) | |
download | matterbridge-msglm-9327810bbfe9cf0da2415d223fc642d943ff2ade.tar.gz matterbridge-msglm-9327810bbfe9cf0da2415d223fc642d943ff2ade.tar.bz2 matterbridge-msglm-9327810bbfe9cf0da2415d223fc642d943ff2ade.zip |
Add tengo example for nick color filter. See #881
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/outmessage-irccolornick.tengo | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/contrib/outmessage-irccolornick.tengo b/contrib/outmessage-irccolornick.tengo new file mode 100644 index 00000000..a16ab64e --- /dev/null +++ b/contrib/outmessage-irccolornick.tengo @@ -0,0 +1,14 @@ +// See https://github.com/42wim/matterbridge/issues/881 +// Generates a colored nick for each msgUsername, with example to filter specific codes + +text := import("text") +fmt := import("fmt") +if outProtocol == "irc" { + // generate a color for a nick, make sure it isn't 0 or 15 + colorCode := len(msgUsername)+bytes(msgUsername)[0]%14 + 2 + // example if we want to use colorCode 3 when we have calculated colorcode 14 + if colorCode == 14 { + colorCode = 3 + } + msgUsername=fmt.sprintf("\x03%02d%s\x0F", colorCode, msgUsername) +} |