WebHook broker that accepts notifications from multiple platforms and performs simple actions in response
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

irccat.py 484B

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):
  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(bf"{self._channel} {line}\n")
  14. s.close()