def startRSS(self): sock = websocket.create_connection(self.websocketURI) self.RPC = rpc.RPC(self.authkey, "RSS", sock) signal.signal(signal.SIGTERM, self.shutdownRSS) self.RPC.RPCCommand("log","info", "RSS started in the background") while True: try: self.refreshRSS() except: tb = traceback.format_exc() self.RPC.RPCCommand("publicLog", "error", "ERROR in RSS process: %s", tb.strip().split("\n")[-1]) self.RPC.RPCCommand("privateLog", "error", "ERROR in RSS process:\n%s", tb) time.sleep(10)
def __init__(self, net, nick, name, config, **kwargs): signal.signal(signal.SIGTERM, self.shutdown) self.IS_REGISTERED = False self.network = net self.nick = nick self.name = name self.config = config self.config.channel = kwargs["channel"] sock = websocket.create_connection(self.config.websocketURI) self.PID = os.getpid() self.RPC = rpc.RPC(self.config.auth, self.config.name, sock) open("proc/bots/%d.pid" % self.PID, "w").write(str(self.PID)) ircbot.SingleServerIRCBot.__init__(self, net, nick, name)