monolith/commands/delete.py

30 lines
1.0 KiB
Python
Raw Normal View History

from core.main import *
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:
if not spl[1] in pool.keys():
failure("Name does not exist: %s" % spl[1])
return
del pool[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")
saveConf("pool")
return
else:
incUsage("del")
return
else:
incUsage(None)