diff --git a/src/gismo_core/service/bot_service.py b/src/gismo_core/service/bot_service.py index 881743d..becdab4 100644 --- a/src/gismo_core/service/bot_service.py +++ b/src/gismo_core/service/bot_service.py @@ -1,8 +1,9 @@ import discord -from discord.ext import commands - from cpl_core.configuration import ConfigurationABC -from cpl_core.logging import LoggerABC +from cpl_core.console import Console +from cpl_core.environment import ApplicationEnvironmentABC +from cpl_core.logging import LoggerABC, LoggingLevelEnum, LoggingSettings +from discord.ext import commands from gismo_core.abc.bot_service_abc import BotServiceABC from gismo_core.configuration.bot_settings import BotSettings from gismo_core.configuration.discord_settings import DiscordSettings @@ -13,11 +14,22 @@ from modules_core.service.module_service import ModuleService class BotService(BotServiceABC, commands.Bot): - def __init__(self, config: ConfigurationABC, logger: LoggerABC, modules: ModuleService, discord_settings: DiscordSettings, bot_settings: BotSettings): + def __init__( + self, + config: ConfigurationABC, + logger: LoggerABC, + modules: ModuleService, + discord_settings: DiscordSettings, + bot_settings: BotSettings, + env: ApplicationEnvironmentABC, + logging_st: LoggingSettings, + ): # services self._config = config self._logger = logger self._modules = modules + self._env = env + self._logging_st = logging_st # settings self._discord_settings = discord_settings @@ -52,5 +64,8 @@ class BotService(BotServiceABC, commands.Bot): self._config.add_configuration(f'DSERVER_{server.id}', server) self._logger.trace(__name__, f'Loaded config for server: {server.id}') + self._logger.header(f'{self.user.name}:') + if self._logging_st.console.value >= LoggingLevelEnum.INFO.value: + Console.banner(self._env.application_name if self._env.application_name != '' else 'Gismo') await self._modules.on_ready() diff --git a/src/modules/boot_log/boot_log.py b/src/modules/boot_log/boot_log.py index b0b95b7..587c743 100644 --- a/src/modules/boot_log/boot_log.py +++ b/src/modules/boot_log/boot_log.py @@ -1,17 +1,13 @@ from datetime import datetime -import discord -from discord import guild -from async_timeout import asyncio from cpl_core.configuration import ConfigurationABC -from cpl_core.console import Console -from cpl_core.environment import ApplicationEnvironmentABC -from cpl_core.logging import LoggerABC, LoggingLevelEnum, LoggingSettings +from cpl_core.logging import LoggerABC +from discord import guild from gismo_core.abc.bot_service_abc import BotServiceABC from gismo_core.abc.message_service_abc import MessageServiceABC from gismo_core.configuration.server_settings import ServerSettings -from modules_core.abc.module_abc import ModuleABC from modules_core.abc.events.on_ready_abc import OnReadyABC +from modules_core.abc.module_abc import ModuleABC class BootLog(ModuleABC, OnReadyABC): @@ -19,15 +15,11 @@ class BootLog(ModuleABC, OnReadyABC): def __init__( self, config: ConfigurationABC, - env: ApplicationEnvironmentABC, - logging_st: LoggingSettings, logger: LoggerABC, bot: BotServiceABC, message_service: MessageServiceABC ): self._config = config - self._env = env - self._logging_st = logging_st self._logger = logger self._bot = bot @@ -62,10 +54,6 @@ class BootLog(ModuleABC, OnReadyABC): self._logger.error(__name__, 'Init time calculation failed', e) return - self._logger.header(f'{self._bot.user.name}:') - if self._logging_st.console.value >= LoggingLevelEnum.INFO.value: - Console.banner(self._env.application_name if self._env.application_name != '' else 'Gismo') - for g in self._bot.guilds: g: guild = g self._logger.debug(__name__, f'Server detected: {g.id}')