WebHook broker that accepts notifications from multiple platforms and performs simple actions in response
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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()