A-0.1 - Modularer Aufbau #13

Merged
edraft merged 118 commits from 0.1 into Alpha 2021-11-25 21:02:12 +01:00
2 changed files with 3 additions and 8 deletions
Showing only changes of commit 647e847d17 - Show all commits

View File

@ -7,12 +7,9 @@ from modules_core.abc.module_service_abc import ModuleServiceABC
class BootLog(ModuleABC): class BootLog(ModuleABC):
def __init__(self, logger: LoggerABC, bot: BotServiceABC): def __init__(self, logger: LoggerABC):
self._logger = logger self._logger = logger
self._bot = bot
self._logger.info(__name__, 'LOADED')
ModuleABC.__init__(self) ModuleABC.__init__(self)
async def on_ready(self): async def on_ready(self):
self._logger.info(__name__, f'Bot started: {self._bot}') self._logger.info(__name__, f'Bot started')

View File

@ -23,9 +23,7 @@ class ModuleService(ModuleServiceABC):
self._modules.extend(ModuleABC.__subclasses__()) self._modules.extend(ModuleABC.__subclasses__())
async def start_modules(self): async def start_modules(self):
self._logger.info(__name__, self._modules) modules = self._modules.where(lambda m: hasattr(m, 'on_ready') and callable(m.on_ready))
modules = self._modules.where(lambda m: hasattr(m, 'on_ready'))
self._logger.info(__name__, f'HIER: {modules}')
for module_type in modules: for module_type in modules:
module = self._services.get_service(module_type) module = self._services.get_service(module_type)
await module.on_ready() await module.on_ready()