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.
 
 
cathedral/tower_manager.py

26 lines
754 B

from os import listdir
from sys import path as working_path
from sys import exit
def load_towers(dir):
working_path.append(dir)
found = [name.split(".py")[0] for name in listdir(dir) if name.endswith(".py")]
loaded = []
for tower in found:
try: lt = __import__(tower)
except Exception as e:
print(f"plugin '{tower}' could not be sucessfully loaded ({e})")
continue
if not(hasattr(lt, "run")) or not(hasattr(lt, "hooks")):
print(f"plugin '{tower}' is missing critical elements and thus could not be loaded")
continue
loaded.append(lt)
print(f"loaded plugin: '{tower}'")
return loaded
def handle_route(towers, route):
pass