from colors import * from rcon.source import rcon class PostEffect: servers = [] def __init__(self, path): with open(path, "r") as servers_file: servers = servers_file.readlines() for line in servers: try: address, rcon, command = line.replace("\n","").split("|") self.servers.append({ "ip": address.split(":")[0], "port": int(address.split(":")[1]), "rcon": rcon, "command": command }) except: pass async def execute(self): for server in self.servers: try: info("{ip}:{port} execute {command}".format(**server)) await rcon(server["command"], host=server["ip"], port=server["port"], passwd=server["rcon"]) except: error("Server {ip}:{port} not response".format(**server))