Refresh and reconnect when enabling an existing instance

This commit is contained in:
Mark Veidemanis 2017-11-25 20:28:49 +00:00
parent 9950a527c1
commit 4d4b4b7724
1 changed files with 6 additions and 0 deletions

View File

@ -197,6 +197,9 @@ class IRCBot(IRCClient):
log("%s: connection failed: %s" % (self.name, error)) log("%s: connection failed: %s" % (self.name, error))
helper.sendAll("%s: connection failed: %s" % (self.name, error)) helper.sendAll("%s: connection failed: %s" % (self.name, error))
def reconnect(self):
connector.connect()
class Base(Protocol): class Base(Protocol):
def __init__(self, addr): def __init__(self, addr):
self.addr = addr self.addr = addr
@ -427,6 +430,9 @@ class Helper(object):
helper.savePool() helper.savePool()
if not spl[1] in IRCPool.keys(): if not spl[1] in IRCPool.keys():
self.addBot(spl[1]) self.addBot(spl[1])
else:
IRCPool[spl[1]].refresh()
IRCPool[spl[1]].reconnect()
success("Successfully enabled bot %s" % spl[1]) success("Successfully enabled bot %s" % spl[1])
return return
else: else: