Separate out everything into files and implement a modules system to segment commands

This commit is contained in:
2018-02-23 22:05:40 +00:00
parent 4b3541625a
commit cb7142ef88
30 changed files with 1346 additions and 1123 deletions

29
commands/disable.py Normal file
View 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)