From 4d4b4b77242c9fb5a34b3199946008fd37de5143 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sat, 25 Nov 2017 20:28:49 +0000 Subject: [PATCH] Refresh and reconnect when enabling an existing instance --- threshold | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/threshold b/threshold index 882e78c..b561997 100755 --- a/threshold +++ b/threshold @@ -197,6 +197,9 @@ class IRCBot(IRCClient): log("%s: connection failed: %s" % (self.name, error)) helper.sendAll("%s: connection failed: %s" % (self.name, error)) + def reconnect(self): + connector.connect() + class Base(Protocol): def __init__(self, addr): self.addr = addr @@ -427,6 +430,9 @@ class Helper(object): helper.savePool() if not spl[1] in IRCPool.keys(): self.addBot(spl[1]) + else: + IRCPool[spl[1]].refresh() + IRCPool[spl[1]].reconnect() success("Successfully enabled bot %s" % spl[1]) return else: