Replaced MatrixBot.config with MatrixBot.bot_config because .config is already used by smbl
All checks were successful
All checks were successful
This commit is contained in:
parent
5a244f603d
commit
b76f727263
@ -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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user