Fix the all and allc commands so they work with the new data format

This commit is contained in:
2019-09-29 14:57:36 +01:00
parent 15ca45e5df
commit 355a80b19b
8 changed files with 45 additions and 35 deletions

View File

@@ -1,20 +1,21 @@
import main
from core.bot import deliverRelayCommands
class All:
class AllCommand:
def __init__(self, *args):
self.all(*args)
def all(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
if authed:
if length > 2:
for i in main.pool.keys():
relay = main.pool[i]["relay"]
network = main.pool[i]["network"]
alias = main.pool[i]["alias"]
commands = {spl[1]: [" ".join(spl[2:])]}
success("Sending commands to relay %s as user %s" % (relay, alias+"/"+network))
deliverRelayCommands(relay, commands, user=alias+"/"+network)
for i in main.network.keys():
for x in main.network[i].relays.keys():
num = main.network[i].relays[x]["id"]
net = main.network[i].relays[x]["net"]
alias = main.network[i].aliases[x]["nick"]
commands = {spl[1]: [" ".join(spl[2:])]}
success("Sending commands to relay %s as user %s" % (num, alias+"/"+net))
deliverRelayCommands(num, commands, user=alias+"/"+net)
return
else:
incUsage("all")