A-0.1 - Modularer Aufbau #13
@ -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')
|
||||||
|
@ -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()
|
||||||
|
Reference in New Issue
Block a user