|
|
@ -38,20 +38,9 @@ class EmpyrionBot(api.Bot):
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def start_server(self, nachricht, users, key):
|
|
|
|
def start_server(self, nachricht, users, key):
|
|
|
|
print("start server")
|
|
|
|
print("starte server")
|
|
|
|
puffer = "Starte Server\n"
|
|
|
|
os.chdir("C:\steamCMD\empyriondedicatedserver")
|
|
|
|
nachricht = self.send_message(key, puffer)
|
|
|
|
subprocess.run(['EmpyrionLauncher.exe', '-startDedi', '-dedicated dedicated_HP2.yaml'])
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def stop_server(self, nachricht, users, key):
|
|
|
|
def stop_server(self, nachricht, users, key):
|
|
|
|
puffer = ""
|
|
|
|
puffer = ""
|
|
|
@ -74,7 +63,11 @@ class EmpyrionBot(api.Bot):
|
|
|
|
self.edit_message_text(puffer, key, nachricht["result"]["message_id"])
|
|
|
|
self.edit_message_text(puffer, key, nachricht["result"]["message_id"])
|
|
|
|
|
|
|
|
|
|
|
|
def status_server(self, nachricht, users, key):
|
|
|
|
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):
|
|
|
|
def update_server(self, nachricht, users, key):
|
|
|
|
# Zu Suchender String zum analysieren des Errorlogpfades:
|
|
|
|
# Zu Suchender String zum analysieren des Errorlogpfades:
|
|
|
@ -111,6 +104,7 @@ class EmpyrionBot(api.Bot):
|
|
|
|
if kommando == "/start":
|
|
|
|
if kommando == "/start":
|
|
|
|
self.start(nachricht, users, key)
|
|
|
|
self.start(nachricht, users, key)
|
|
|
|
elif kommando == "/start_server":
|
|
|
|
elif kommando == "/start_server":
|
|
|
|
|
|
|
|
pass
|
|
|
|
self.start_server(nachricht, users, key)
|
|
|
|
self.start_server(nachricht, users, key)
|
|
|
|
elif kommando == "/stop_server":
|
|
|
|
elif kommando == "/stop_server":
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|