rj1
about | log | files | refs | license
commit 8b0a42a16d74fdeee5da1e4c92c49dcc73bca801
parent b9bbee7e7f3edb2afe11f51eebcc9ebdd44eb7c8
author: rj1 <[email protected]>
date:   Fri,  6 May 2022 17:26:08 -0500

user actions are relayed

Diffstat:
Mrelay.py | 14++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/relay.py b/relay.py @@ -1,5 +1,4 @@ import znc -import json class relay(znc.Module): @@ -7,8 +6,15 @@ class relay(znc.Module): module_types = [znc.CModInfo.UserModule] def OnChanMsg(self, nick, channel, message): - if str(channel.GetName()).lower() == "#source": - network = self.GetUser().FindNetwork("target-network") - network.PutIRC(f"PRIVMSG #target-channel :<{str(nick)}> {str(message)}") + self._sendMsg(nick, channel, f"<{nick}> {message}") return znc.CONTINUE + def OnChanAction(self, nick, channel, message): + self._sendMsg(nick, channel, f"*{nick} {message}") + return znc.CONTINUE + + def _sendMsg(self, network, channel, message): + if str(channel.GetName()).lower() == channel: + network = self.GetUser().FindNetwork(network) + network.PutIRC(f"PRIVMSG {channel} :{message}") + return znc.CONTINUE