|
|
|
@ -38,20 +38,9 @@ class EmpyrionBot(api.Bot):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def start_server(self, nachricht, users, key):
|
|
|
|
|
print("start server")
|
|
|
|
|
puffer = "Starte Server\n"
|
|
|
|
|
nachricht = self.send_message(key, puffer)
|
|
|
|
|
cmd = shlex.split(CONFIG["steamcmd"]["start"], posix=False)
|
|
|
|
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
|
|
|
|
while p.poll() is None:
|
|
|
|
|
output = p.stdout.readline().decode("utf-8")
|
|
|
|
|
if output:
|
|
|
|
|
if check_nachrichten_laenge(f"{puffer} {output}"):
|
|
|
|
|
puffer = f"{puffer} {output}"
|
|
|
|
|
self.edit_message_text(puffer, key, nachricht["result"]["message_id"])
|
|
|
|
|
else:
|
|
|
|
|
puffer = output
|
|
|
|
|
nachricht = self.send_message(key, puffer)
|
|
|
|
|
print("starte server")
|
|
|
|
|
os.chdir("C:\steamCMD\empyriondedicatedserver")
|
|
|
|
|
subprocess.run(['EmpyrionLauncher.exe', '-startDedi', '-dedicated dedicated_HP2.yaml'])
|
|
|
|
|
|
|
|
|
|
def stop_server(self, nachricht, users, key):
|
|
|
|
|
puffer = ""
|
|
|
|
@ -74,7 +63,11 @@ class EmpyrionBot(api.Bot):
|
|
|
|
|
self.edit_message_text(puffer, key, nachricht["result"]["message_id"])
|
|
|
|
|
|
|
|
|
|
def status_server(self, nachricht, users, key):
|
|
|
|
|
[print(p) for p in psutil.process_iter() if "Empyrion" in p.name()]
|
|
|
|
|
text = [str(p) for p in psutil.process_iter() if "Empyrion" in p.name()]
|
|
|
|
|
if text:
|
|
|
|
|
self.send_message(key, "\n".join(text))
|
|
|
|
|
else:
|
|
|
|
|
self.send_message(key, "Kein Prozess aktiv")
|
|
|
|
|
|
|
|
|
|
def update_server(self, nachricht, users, key):
|
|
|
|
|
# Zu Suchender String zum analysieren des Errorlogpfades:
|
|
|
|
@ -111,6 +104,7 @@ class EmpyrionBot(api.Bot):
|
|
|
|
|
if kommando == "/start":
|
|
|
|
|
self.start(nachricht, users, key)
|
|
|
|
|
elif kommando == "/start_server":
|
|
|
|
|
pass
|
|
|
|
|
self.start_server(nachricht, users, key)
|
|
|
|
|
elif kommando == "/stop_server":
|
|
|
|
|
pass
|
|
|
|
|