Replaced MatrixBot.config with MatrixBot.bot_config because .config is already used by smbl
All checks were successful
Analysis / SonarCloud (pull_request) Successful in 1m52s
Tests / Build and Test (3.11) (pull_request) Successful in 1m18s
Tests / Build and Test (3.12) (pull_request) Successful in 1m22s
Tests / Build and Test (3.13) (pull_request) Successful in 1m23s

This commit is contained in:
Profitroll 2025-01-04 17:49:44 +01:00
parent 5a244f603d
commit b76f727263
Signed by: profitroll
GPG Key ID: FA35CAB49DACD3B2

View File

@ -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()