Added module upgrading to Control
This commit is contained in:
parent
56165e96e5
commit
99d713a952
1 changed files with 22 additions and 0 deletions
|
|
@ -1,3 +1,6 @@
|
||||||
|
from pathlib import Path
|
||||||
|
from os import system
|
||||||
|
|
||||||
import libminecraft
|
import libminecraft
|
||||||
import libsignal
|
import libsignal
|
||||||
import libcommon
|
import libcommon
|
||||||
|
|
@ -45,3 +48,22 @@ Unloaded modules: {" ".join(unloaded_modules)}""", RetardsServer
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
libsignal.sendMessage(
|
libsignal.sendMessage(
|
||||||
f"Error reloading '{module}': {e}", RetardsServer)
|
f"Error reloading '{module}': {e}", RetardsServer)
|
||||||
|
case ["!modules", "update"]:
|
||||||
|
system("git -C Serve pull")
|
||||||
|
log = []
|
||||||
|
modules = []
|
||||||
|
for file in Path("Serve", "modules").iterdir():
|
||||||
|
if file.name[:-3] in libcommon.listModules()[0]:
|
||||||
|
if file.read_text != Path("modules", file.name).read_text:
|
||||||
|
log.append(
|
||||||
|
f"Module '{file.name[:-3]}' has an available update.")
|
||||||
|
else:
|
||||||
|
log.append(f"New module added: '{file.name[:-3]}'.")
|
||||||
|
modules.append(file.name[:-3])
|
||||||
|
for module in libcommon.listModules()[0]:
|
||||||
|
if module not in modules:
|
||||||
|
log.append(f"Module '{module}' was removed.")
|
||||||
|
libsignal.sendMessage("\n".join(log), RetardsServer)
|
||||||
|
case ["!modules", "install"]:
|
||||||
|
system("cp Serve/modules/* modules")
|
||||||
|
libsignal.sendMessage("Modules installed.", RetardsServer)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue