Matterbridge: Gateway-specific RemoteNickFormat

Created on 8 May 2019  路  1Comment  路  Source: 42wim/matterbridge

Is your feature request related to a problem? Please describe.
I'm frustrated because I have to create multiple same account because I cannot change RemoteNickFormat gateway-specific.

I want to have Discord #streamchat-channel and Twitch #cwchristerw with [{LABEL}]<{NICK}> when using streaming gateway and other channels when using any other gateway with [{LABEL} : {CHANNEL}]<{NICK}>.

Describe the solution you'd like
Make possible to override account-specific RemoteNickFormat using gateway-specific RemoteNickFormat like this.

[gateway.inout.options]
RemoteNickFormat="[{LABEL}]<{NICK}> "

Describe alternatives you've considered
This can be solved also by using multiple same accounts with different RemoteNickFormat or multiple separate matterbridges.

Additional context
MatterBridge is currently used between Discord #streamchat-channel and Twitch #cwchristerw only. I want to expand usage of MatterBridge for different type of communication and this makes it easier.

config.toml when using current ways

[irc]

[irc.pirateirc]
Server="roubaix-fr.pirateirc.net:6697"
UseTLS=true
UseSASL=false
SkipTLSVerify=true
Charset=""
Nick="BERT"
MessageDelay=1300
MessageQueue=30
MessageLength=400
MessageSplit=false
RejoinDelay=0
ColorNicks=false
Label="IRC : PirateIRC"
RemoteNickFormat="[{LABEL} : {CHANNEL}]<{NICK}> "
ShowJoinPart=false
NoSendJoinPart=false
StripNick=false
ShowTopicChange=false

[discord]

[discord.mirriluola]
Token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Server="Mirriluola"
UseUserName=true
UseDiscriminator=true
Label="DISCORD : Mirriluola"
RemoteNickFormat="[{LABEL} : {CHANNEL}]<{NICK}> "

[discord.mirriluola-stream]
Token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Server="Mirriluola"
UseUserName=true
UseDiscriminator=true
Label="DISCORD"
RemoteNickFormat="[{LABEL}]<{NICK}> "

[irc.twitch]
Password="oauth:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Nick="warenmedia999"
Server="irc.chat.twitch.tv:6697"
UseTLS=true
Label="TWITCH"
RemoteNickFormat="[{LABEL} : {CHANNEL}]<{NICK}> "

[irc.twitch-stream]
Password="oauth:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Nick="warenmedia999"
Server="irc.chat.twitch.tv:6697"
UseTLS=true
Label="TWITCH"
RemoteNickFormat="[{LABEL}]<{NICK}> "

[[gateway]]
name="streaming"
enable=true

[[gateway.inout]]
account="discord.mirriluola-stream"
channel="streamchat"

[[gateway.inout]]
account="irc.twitch-stream"
channel="#cwchristerw"

[[gateway]]
name="pirateirc"
enable=true

[[gateway.inout]]
account="discord.mirriluola"
channel="testing"

[[gateway.inout]]
account="irc.pirateirc"
channel="#test"

in future hopefully config.tml

[irc]

[irc.pirateirc]
Server="roubaix-fr.pirateirc.net:6697"
UseTLS=true
UseSASL=false
SkipTLSVerify=true
Charset=""
Nick="BERT"
MessageDelay=1300
MessageQueue=30
MessageLength=400
MessageSplit=false
RejoinDelay=0
ColorNicks=false
Label="IRC : PirateIRC"
RemoteNickFormat="[{LABEL} : {CHANNEL}]<{NICK}> "
ShowJoinPart=false
NoSendJoinPart=false
StripNick=false
ShowTopicChange=false

[discord]

[discord.mirriluola]
Token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Server="Mirriluola"
UseUserName=true
UseDiscriminator=true
Label="DISCORD : Mirriluola"
RemoteNickFormat="[{LABEL} : {CHANNEL}]<{NICK}> "

[irc.twitch]
Password="oauth:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Nick="warenmedia999"
Server="irc.chat.twitch.tv:6697"
UseTLS=true
Label="TWITCH"
RemoteNickFormat="[{LABEL} : {CHANNEL}]<{NICK}> "

[[gateway]]
name="streaming"
enable=true

[[gateway.inout]]
account="discord.mirriluola"
channel="streamchat"

[[gateway.inout.options]]
Label="DISCORD"
RemoteNickFormat="[{LABEL}]<{NICK}> "

[[gateway.inout]]
account="irc.twitch"
channel="#cwchristerw"

[[gateway.inout.options]]
Label="TWITCH"
RemoteNickFormat="[{LABEL}]<{NICK}> "

[[gateway]]
name="pirateirc"
enable=true

[[gateway.inout]]
account="discord.mirriluola"
channel="testing"

[[gateway.inout]]
account="irc.pirateirc"
channel="#test"
tengo

Most helpful comment

I'm not planning on adding any new features in code that can be scripted using tengo.
See https://github.com/42wim/matterbridge/wiki/Settings#remotenickformat-2

For your use-case, you could use this example script

Example script, save this as myremotenickformat.tengo

text := import("text")
if gateway == "streaming" {
    result = "["+text.to_upper(protocol) +"]<"+nick+"> "
}
if gateway == "pirateirc" {
    result = "["+text.to_upper(protocol) +": "+channel+"]<"+nick+"> "
}

Your toml file should look like

```
[irc.pirateirc]
Server="roubaix-fr.pirateirc.net:6697"
UseTLS=true
UseSASL=false
SkipTLSVerify=true
Charset=""
Nick="BERT"
MessageDelay=1300
MessageQueue=30
MessageLength=400
MessageSplit=false
RejoinDelay=0
ColorNicks=false
RemoteNickFormat="{TENGO}"
ShowJoinPart=false
NoSendJoinPart=false
StripNick=false
ShowTopicChange=false

[discord.mirriluola]
Token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Server="Mirriluola"
UseUserName=true
UseDiscriminator=true
RemoteNickFormat="{TENGO}"

[irc.twitch]
Password="oauth:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Nick="warenmedia999"
Server="irc.chat.twitch.tv:6697"
UseTLS=true
RemoteNickFormat="{TENGO}"

[tengo]
RemoteNickFormat="myremotenickformat.tengo"

[[gateway]]
name="streaming"
enable=true

[[gateway.inout]]
account="discord.mirriluola"
channel="streamchat"

[[gateway.inout]]
account="irc.twitch"
channel="#cwchristerw"

[[gateway]]
name="pirateirc"
enable=true

[[gateway.inout]]
account="discord.mirriluola"
channel="testing"

[[gateway.inout]]
account="irc.pirateirc"
channel="#test"

>All comments

I'm not planning on adding any new features in code that can be scripted using tengo.
See https://github.com/42wim/matterbridge/wiki/Settings#remotenickformat-2

For your use-case, you could use this example script

Example script, save this as myremotenickformat.tengo

text := import("text")
if gateway == "streaming" {
    result = "["+text.to_upper(protocol) +"]<"+nick+"> "
}
if gateway == "pirateirc" {
    result = "["+text.to_upper(protocol) +": "+channel+"]<"+nick+"> "
}

Your toml file should look like

```
[irc.pirateirc]
Server="roubaix-fr.pirateirc.net:6697"
UseTLS=true
UseSASL=false
SkipTLSVerify=true
Charset=""
Nick="BERT"
MessageDelay=1300
MessageQueue=30
MessageLength=400
MessageSplit=false
RejoinDelay=0
ColorNicks=false
RemoteNickFormat="{TENGO}"
ShowJoinPart=false
NoSendJoinPart=false
StripNick=false
ShowTopicChange=false

[discord.mirriluola]
Token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Server="Mirriluola"
UseUserName=true
UseDiscriminator=true
RemoteNickFormat="{TENGO}"

[irc.twitch]
Password="oauth:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Nick="warenmedia999"
Server="irc.chat.twitch.tv:6697"
UseTLS=true
RemoteNickFormat="{TENGO}"

[tengo]
RemoteNickFormat="myremotenickformat.tengo"

[[gateway]]
name="streaming"
enable=true

[[gateway.inout]]
account="discord.mirriluola"
channel="streamchat"

[[gateway.inout]]
account="irc.twitch"
channel="#cwchristerw"

[[gateway]]
name="pirateirc"
enable=true

[[gateway.inout]]
account="discord.mirriluola"
channel="testing"

[[gateway.inout]]
account="irc.pirateirc"
channel="#test"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Wouter0100 picture Wouter0100  路  4Comments

patcon picture patcon  路  4Comments

jurgenhaas picture jurgenhaas  路  5Comments

jojosoft picture jojosoft  路  8Comments

jamoffat picture jamoffat  路  4Comments