Additional checks when disabling or deleting bots

This commit is contained in:
Mark Veidemanis 2018-02-03 19:43:54 +00:00
parent aacb50d5d2
commit 57e54cbced
1 changed files with 10 additions and 5 deletions

View File

@ -670,7 +670,8 @@ class Helper(object):
if spl[1] in FactoryPool.keys():
FactoryPool[spl[1]].stopTrying()
ReactorPool[spl[1]].disconnect()
del IRCPool[spl[1]]
if spl[1] in IRCPool.keys():
del IRCPool[spl[1]]
del ReactorPool[spl[1]]
del FactoryPool[spl[1]]
success("Successfully disabled bot %s" % spl[1])
@ -998,10 +999,14 @@ class Helper(object):
failure("Name does not exist: %s" % spl[1])
return
del pool[spl[1]]
if spl[1] in IRCPool.keys():
if IRCPool[spl[1]].connected == True:
IRCPool[spl[1]].transport.loseConnection()
del IRCPool[spl[1]]
if spl[1] in ReactorPool.keys():
if spl[1] in FactoryPool.keys():
FactoryPool[spl[1]].stopTrying()
ReactorPool[spl[1]].disconnect()
if spl[1] in IRCPool.keys():
del IRCPool[spl[1]]
del ReactorPool[spl[1]]
del FactoryPool[spl[1]]
success("Successfully removed bot")
self.save("pool")
return