You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

27 lines
749 B

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))