2018-03-14 20:13:40 +00:00
|
|
|
import main
|
2018-02-23 22:05:40 +00:00
|
|
|
|
|
|
|
class Delete:
|
|
|
|
def __init__(self, register):
|
|
|
|
register("del", self.delete)
|
|
|
|
|
|
|
|
def delete(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
|
|
|
|
if authed:
|
|
|
|
if length == 2:
|
2018-03-14 20:13:40 +00:00
|
|
|
if not spl[1] in main.pool.keys():
|
2018-02-23 22:05:40 +00:00
|
|
|
failure("Name does not exist: %s" % spl[1])
|
|
|
|
return
|
2018-05-07 18:58:19 +00:00
|
|
|
del main.pool[spl[1]]
|
2018-03-14 20:13:40 +00:00
|
|
|
if spl[1] in main.ReactorPool.keys():
|
|
|
|
if spl[1] in main.FactoryPool.keys():
|
|
|
|
main.FactoryPool[spl[1]].stopTrying()
|
|
|
|
main.ReactorPool[spl[1]].disconnect()
|
|
|
|
if spl[1] in main.IRCPool.keys():
|
|
|
|
del main.IRCPool[spl[1]]
|
|
|
|
del main.ReactorPool[spl[1]]
|
|
|
|
del main.FactoryPool[spl[1]]
|
2018-07-27 21:58:37 +00:00
|
|
|
success("Successfully removed bot: %s" % spl[1])
|
2018-03-14 20:13:40 +00:00
|
|
|
main.saveConf("pool")
|
2018-02-23 22:05:40 +00:00
|
|
|
return
|
|
|
|
else:
|
|
|
|
incUsage("del")
|
|
|
|
return
|
|
|
|
else:
|
|
|
|
incUsage(None)
|