WebHook broker that accepts notifications from multiple platforms and performs simple actions in response
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718
  1. import socket
  2. from .service import Service
  3. class IrcCat(Service):
  4. def __init__(self, host, port, channel):
  5. super().__init__("irccat")
  6. self._host = host
  7. self._port = port
  8. self._channel = channel
  9. def announce(self, message, channel=None):
  10. s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  11. s.connect((self._host, self._port))
  12. for line in message.split("\n"):
  13. s.sendall(f"{channel or self._channel} {line}\n".encode())
  14. s.close()