Improved module loading

This commit is contained in:
Sven Heidemann 2021-11-28 23:31:36 +01:00
parent ed1cb24e9c
commit 762ae5fd4d

View File

@ -75,7 +75,11 @@ class ModuleService(ModuleServiceABC, commands.Cog, metaclass=_MetaCogABC):
module_types = self._modules.where(lambda m: issubclass(m, t)) module_types = self._modules.where(lambda m: issubclass(m, t))
modules = List(t) modules = List(t)
for module_type in module_types: for module_type in module_types:
modules.append(self._services.get_service(module_type)) module = self._services.get_service(module_type)
if module is None:
self._logger.warn(__name__, f'Module {module_type} not found in services!')
break
modules.append(module)
return modules.order_by(lambda m: m.get_priority(t)) return modules.order_by(lambda m: m.get_priority(t))