import main from core.bot import deliverRelayCommands class Allc: def __init__(self, *args): self.allc(*args) def allc(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length): if authed: if length > 4: targets = [] if spl[1] == "network": if spl[2] in main.network.keys(): for i in main.pool.keys(): if main.pool[i]["network"] == spl[2]: targets.append(i) else: failure("No such network: %s" % spl[2]) return elif spl[1] == "alias": if spl[2] in main.alias.keys(): for i in main.pool.keys(): if main.pool[i]["alias"] == spl[2]: targets.append(i) else: failure("No such alias: %s" % spl[2]) return else: incUsage("allc") return if len(targets) == 0: failure("No matches found: %s" % spl[2]) return for i in targets: relay = main.pool[i]["relay"] network = main.pool[i]["network"] alias = main.pool[i]["alias"] commands = {spl[3]: [" ".join(spl[4:])]} success("Sending commands to relay %s as user %s" % (relay, alias+"/"+network)) deliverRelayCommands(relay, commands, user=alias+"/"+network) return else: incUsage("allc") return else: incUsage(None)