diff --git a/src/libbot/matrix/classes/bot.py b/src/libbot/matrix/classes/bot.py index 4004e40..85d79f7 100644 --- a/src/libbot/matrix/classes/bot.py +++ b/src/libbot/matrix/classes/bot.py @@ -21,26 +21,32 @@ logger: Logger = logging.getLogger(__name__) class MatrixBot(Bot): @override def __init__( - self, - config: Dict[str, Any] | None = None, - config_path: str | Path = Path("config.json"), - locales_root: str | Path | None = None, - scheduler: AsyncIOScheduler | BackgroundScheduler | None = None, - smbl_creds: Creds = None, - smbl_config: Config = None, + self, + config: Dict[str, Any] | None = None, + config_path: str | Path = Path("config.json"), + locales_root: str | Path | None = None, + scheduler: AsyncIOScheduler | BackgroundScheduler | None = None, + smbl_creds: Creds = None, + smbl_config: Config = None, ): - self.config: Dict[str, Any] = config if config is not None else json_read(config_path) + self.bot_config: Dict[str, Any] = config if config is not None else json_read(config_path) super().__init__( - creds=smbl_creds if smbl_creds is not None else Creds(homeserver=self.config["homeserver"], - username=self.config["username"], - password=self.config["password"], - device_name=self.config["device_name"]), + creds=( + smbl_creds + if smbl_creds is not None + else Creds( + homeserver=self.bot_config["bot"]["homeserver"], + username=self.bot_config["bot"]["username"], + password=self.bot_config["bot"]["password"], + device_name=self.bot_config["bot"]["device_name"], + ) + ), config=smbl_config, ) self.bot_locale: BotLocale = BotLocale( - default_locale=self.config["locale"], + default_locale=self.bot_config["locale"], locales_root=(Path("locale") if locales_root is None else locales_root), ) self.default_locale: str = self.bot_locale.default @@ -53,7 +59,9 @@ class MatrixBot(Bot): self.scheduler: AsyncIOScheduler | BackgroundScheduler | None = scheduler @override - def run(self, scheduler_start: bool = True, scheduler_shutdown: bool = True, scheduler_wait: bool = True) -> None: + def run( + self, scheduler_start: bool = True, scheduler_shutdown: bool = True, scheduler_wait: bool = True + ) -> None: if self.scheduler is not None and scheduler_start: self.scheduler.start()