diff --git a/src/modules/boot_log/boot_log.py b/src/modules/boot_log/boot_log.py index 4d72b69..4ee4834 100644 --- a/src/modules/boot_log/boot_log.py +++ b/src/modules/boot_log/boot_log.py @@ -27,14 +27,9 @@ class BootLog(ModuleABC, OnReadyABC): self._bot = bot self._message_service = message_service - self._priorities = { - OnReadyABC: 10 - } - + ModuleABC.__init__(self) + self._priorities[OnReadyABC] = 10 self._logger.trace(__name__, f'Module {type(self)} loaded') - - def get_priority(self, t: type) -> int: - return self._priorities[t] async def on_ready(self): self._logger.debug(__name__, f'Module {type(self)} started') diff --git a/src/modules_core/abc/module_abc.py b/src/modules_core/abc/module_abc.py index d377d4b..a970850 100644 --- a/src/modules_core/abc/module_abc.py +++ b/src/modules_core/abc/module_abc.py @@ -5,7 +5,10 @@ import discord class ModuleABC(ABC): @abstractmethod - def __init__(self): pass - - @abstractmethod - def get_priority(self, t: type) -> int: pass + def __init__(self): + self._priorities = {} + + def get_priority(self, t: type) -> int: + if t not in self._priorities: + raise Exception(f'Priority for {t} not found!') + return self._priorities[t]