commit ddfc889e9759c827c4a7ab0acd8a0af84ad3bf45
Author: Wim <wim@42.be>
Date: Sat Sep 07 20:01:40 2019 +0000
diff --git a/contrib/outmessage-irccolornick.tengo b/contrib/outmessage-irccolornick.tengo
new file mode 100644
index 0000000..a16ab64
--- /dev/null
+++ b/contrib/outmessage-irccolornick.tengo
@@ -00 +114 @@
+// 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)
+}