diff --git a/kdb-bot/src/bot_core/abc/client_utils_service_abc.py b/kdb-bot/src/bot_core/abc/client_utils_service_abc.py index 0345ba3607..da5d099a50 100644 --- a/kdb-bot/src/bot_core/abc/client_utils_service_abc.py +++ b/kdb-bot/src/bot_core/abc/client_utils_service_abc.py @@ -17,6 +17,9 @@ class ClientUtilsServiceABC(ABC): @abstractmethod def get_client(self, dc_ic: int, guild_id: int): pass + @abstractmethod + async def check_if_bot_is_ready_yet(self) -> bool: pass + @abstractmethod async def check_if_bot_is_ready_yet_and_respond(self, ctx: Context) -> bool: pass diff --git a/kdb-bot/src/bot_core/helper/event_checks.py b/kdb-bot/src/bot_core/helper/event_checks.py index 9d4e9ccbc2..0eba341c39 100644 --- a/kdb-bot/src/bot_core/helper/event_checks.py +++ b/kdb-bot/src/bot_core/helper/event_checks.py @@ -22,10 +22,10 @@ class EventChecks: @classmethod def check_is_ready(cls): - async def check_if_bot_is_ready_yet_and_respond(ctx: Context) -> bool: - result = await cls._client_utils.check_if_bot_is_ready_yet_and_respond(ctx) + async def check_if_bot_is_ready() -> bool: + result = await cls._client_utils.check_if_bot_is_ready() if not result: raise CheckError(f'Bot is not ready') return result - return commands.check(check_if_bot_is_ready_yet_and_respond) + return commands.check(check_if_bot_is_ready) diff --git a/kdb-bot/src/bot_core/service/client_utils_service.py b/kdb-bot/src/bot_core/service/client_utils_service.py index 733e3903b0..56f5296348 100644 --- a/kdb-bot/src/bot_core/service/client_utils_service.py +++ b/kdb-bot/src/bot_core/service/client_utils_service.py @@ -59,14 +59,20 @@ class ClientUtilsService(ClientUtilsServiceABC): client = self._clients.find_client_by_discord_id_and_server_id(self._bot.user.id, server.server_id) return client - async def check_if_bot_is_ready_yet_and_respond(self, ctx: Context) -> bool: + async def check_if_bot_is_ready_yet(self) -> bool: if self._config.get_configuration('IS_READY') == 'true': return True self._logger.debug(__name__, f'Bot is not ready yet {self._t.transform("common.errors.bot_not_ready_yet")}') - await self._message_service.send_ctx_msg(ctx, self._t.transform('common.errors.bot_not_ready_yet'), without_tracking=True) return False + async def check_if_bot_is_ready_yet_and_respond(self, ctx: Context) -> bool: + result = await self.check_if_bot_is_ready_yet() + if result: + await self._message_service.send_ctx_msg(ctx, self._t.transform('common.errors.bot_not_ready_yet'), without_tracking=True) + + return result + async def presence_game(self, t_key: str): if not self._feature_flags.get_flag(FeatureFlagsEnum.presence): return