Add error checking in places, set up automatic relay provisioning and fix starting bots
This commit is contained in:
@@ -11,16 +11,18 @@ class EnableCommand:
|
||||
if not spl[1] in main.network.keys():
|
||||
failure("No such network: %s" % spl[1])
|
||||
return
|
||||
if not spl[2].isdigit():
|
||||
failure("Must be a number, not %s" % spl[2])
|
||||
return
|
||||
if not int(spl[2]) in main.network[spl[1]].relays.keys():
|
||||
failure("No such relay: %s in network %s" % (spl[2], spl[1]))
|
||||
failure("No such relay on %s: %s" % (spl[2], spl[1]))
|
||||
return
|
||||
|
||||
main.network[spl[1]].relays[int(spl[2])]["enabled"] = True
|
||||
user = main.network[spl[1]].aliases[int(spl[2])]
|
||||
user = main.network[spl[1]].aliases[int(spl[2])]["nick"]
|
||||
network = spl[1]
|
||||
relay = main.network[spl[1]].relays[int(spl[2])]
|
||||
commands = {"status": ["Connect"]}
|
||||
deliverRelayCommands(relay, commands, user=user+"/"+network)
|
||||
deliverRelayCommands(int(spl[2]), commands, user=user+"/"+network)
|
||||
main.saveConf("network")
|
||||
if not spl[1]+spl[2] in main.IRCPool.keys():
|
||||
main.network[spl[1]].start_bot(int(spl[2]))
|
||||
|
||||
Reference in New Issue
Block a user