| 1 | /* |
| 2 | variables available |
| 3 | read-only: |
| 4 | inAccount, inProtocol, inChannel, inGateway |
| 5 | outAccount, outProtocol, outChannel, outGateway |
| 6 | |
| 7 | read-write: |
| 8 | msgText, msgUsername |
| 9 | */ |
| 10 | |
| 11 | text := import("text") |
| 12 | |
| 13 | // start - strip irc colors |
| 14 | // if we're not sending to an irc bridge we strip the IRC colors |
| 15 | if inProtocol == "irc" && outProtocol != "irc" { |
| 16 | re := text.re_compile(`\x03(?:\d{1,2}(?:,\d{1,2})?)?|[[:cntrl:]]`) |
| 17 | msgText=re.replace(msgText,"") |
| 18 | } |
| 19 | // end - strip irc colors |
| 20 | |
| 21 | // strip custom emoji |
| 22 | if inProtocol == "discord" { |
| 23 | re := text.re_compile(`<a?(:.*?:)[0-9]+>`) |
| 24 | msgText=re.replace(msgText,"$1") |
| 25 | } |
| 26 | |