diff --git a/config.ini b/config.ini index 1ff5665..1b5e082 100644 --- a/config.ini +++ b/config.ini @@ -1,6 +1,6 @@ # Ci configuration for GitHub Actions. [framework] -ver=3 +ver=4 [main] ver=2.5.0 [release] diff --git a/matrix_sync/client/init.py b/matrix_sync/client/init.py index d01a37f..42d3a59 100644 --- a/matrix_sync/client/init.py +++ b/matrix_sync/client/init.py @@ -28,7 +28,8 @@ async def login_by_password(): await cache_token(resp) log_info(tr("login.save_token")) else: - log_error(f"{tr("login.failed")}: {resp}") + tip = tr("login.failed") + log_error(f"{tip}: {resp}") homeserver = get_homeserver(plg_globals.config["homeserver"]) log_info(f'homeserver: "{homeserver}", bot: "{plg_globals.config["user_id"]}"') log_error(tr("check_config")) diff --git a/matrix_sync/entry.py b/matrix_sync/entry.py index 44e5fb4..092cd1f 100644 --- a/matrix_sync/entry.py +++ b/matrix_sync/entry.py @@ -1,5 +1,8 @@ +import os + from .utils import tr from .utils.logger import * +from .client.init import login_by_password from .client.reporter import send_to_matrix from .client.receiver import stop_sync from .config import load_config @@ -7,10 +10,12 @@ from mcdreforged.api.all import * -# Framwork ver: 2.5.0-2 +# Framwork ver: 2.5.0-4 async def on_load(server: PluginServerInterface, prev_module): await load_config(server) command_register(server) + if not os.path.exists(f"{configDir}/token.json"): + await login_by_password() start_sync() def on_server_start(server: PluginServerInterface):