30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
import main
|
|
|
|
class Disable:
|
|
def __init__(self, register):
|
|
register("disable", self.disable)
|
|
|
|
def disable(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
|
|
if authed:
|
|
if length == 2:
|
|
if not spl[1] in main.pool.keys():
|
|
failure("Name does not exist: %s" % spl[1])
|
|
return
|
|
main.pool[spl[1]]["enabled"] = False
|
|
main.saveConf("pool")
|
|
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]]
|
|
success("Successfully disabled bot %s" % spl[1])
|
|
return
|
|
else:
|
|
incUsage("disable")
|
|
return
|
|
else:
|
|
incUsage(None)
|