Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

Viewing file on branch master

1// See https://github.com/42wim/matterbridge/issues/881
2// Generates a colored nick for each msgUsername, with example to filter specific codes
3
4text := import("text")
5fmt := import("fmt")
6if outProtocol == "irc" {
7 // generate a color for a nick, make sure it isn't 0 or 15
8 colorCode := len(msgUsername)+bytes(msgUsername)[0]%14 + 2
9 // example if we want to use colorCode 3 when we have calculated colorcode 14
10 if colorCode == 14 {
11 colorCode = 3
12 }
13 msgUsername=fmt.sprintf("\x03%02d%s\x0F", colorCode, msgUsername)
14}
15