33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
import main
|
|
from core.helper import startBot
|
|
from core.bot import deliverRelayCommands
|
|
|
|
class Enable:
|
|
def __init__(self, *args):
|
|
self.enable(*args)
|
|
|
|
def enable(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"] = True
|
|
user = main.pool[spl[1]]["alias"]
|
|
network = main.pool[spl[1]]["network"]
|
|
relay = main.pool[spl[1]]["relay"]
|
|
commands = {"status": ["Connect"]}
|
|
deliverRelayCommands(relay, commands, user=user+"/"+network)
|
|
main.saveConf("pool")
|
|
if not spl[1] in main.IRCPool.keys():
|
|
startBot(spl[1])
|
|
else:
|
|
pass
|
|
success("Successfully enabled bot %s" % spl[1])
|
|
return
|
|
else:
|
|
incUsage("enable")
|
|
return
|
|
else:
|
|
incUsage(None)
|