diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2021-05-20 16:56:07 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2021-05-20 16:56:42 +0300 |
commit | a478607b1706a2184090e31ba74ce0569333cd06 (patch) | |
tree | 0a9419a5e61ca26b51315606befdda9da8b194bd /calm/irk.py | |
parent | 79d4099c2d6a4000302bdb1662dd4c8b1661dac9 (diff) |
Have irkerd send our messages to libera.chat as well
Diffstat (limited to 'calm/irk.py')
-rwxr-xr-x | calm/irk.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/calm/irk.py b/calm/irk.py index 5dd195d..40986b9 100755 --- a/calm/irk.py +++ b/calm/irk.py @@ -12,7 +12,7 @@ import socket import sys DEFAULT_SERVER = ("localhost", 6659) -DEFAULT_TARGET = 'cygwin-bots' +DEFAULT_TARGET = ['cygwin-bots', 'irc://irc.libera.chat/cygwin-bots'] def connect(server=DEFAULT_SERVER): @@ -26,16 +26,20 @@ def send(s, target, message): def irk(message, target=DEFAULT_TARGET, server=DEFAULT_SERVER): - try: - s = connect(server) - if "irc:" not in target and "ircs:" not in target: - target = "irc://chat.freenode.net/{0}".format(target) + if not isinstance(target, list): + target = [target] + + for t in target: + try: + s = connect(server) + if "irc:" not in t and "ircs:" not in t: + t = "irc://chat.freenode.net/{0}".format(t) - send(s, target, message) + send(s, t, message) - s.close() - except OSError: - pass + s.close() + except OSError: + pass def main(): |