Renovate the module system and implement adding and resuming pool instances using the new relay/alias/network system

This commit is contained in:
2019-01-26 18:58:21 +00:00
parent 4efea3f535
commit 8926cb76ec
37 changed files with 184 additions and 302 deletions

View File

@@ -1,9 +1,10 @@
import main
import core.helper as helper
from core.helper import startBot
from core.bot import deliverRelayCommands
class Enable:
def __init__(self, register):
register("enable", self.enable)
def __init__(self, *args):
self.enable(*args)
def enable(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
if authed:
@@ -12,9 +13,14 @@ class Enable:
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():
helper.addBot(spl[1])
startBot(spl[1])
else:
pass
success("Successfully enabled bot %s" % spl[1])