Separate out everything into files and implement a modules system to segment commands
This commit is contained in:
29
commands/disable.py
Normal file
29
commands/disable.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from core.main import *
|
||||
|
||||
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 pool.keys():
|
||||
failure("Name does not exist: %s" % spl[1])
|
||||
return
|
||||
pool[spl[1]]["enabled"] = False
|
||||
saveConf("pool")
|
||||
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 disabled bot %s" % spl[1])
|
||||
return
|
||||
else:
|
||||
incUsage("disable")
|
||||
return
|
||||
else:
|
||||
incUsage(None)
|
||||
Reference in New Issue
Block a user