From 3719db1dab050928417757c498edfc673501bad9 Mon Sep 17 00:00:00 2001 From: xiaoniu Date: Mon, 19 Jun 2023 12:05:34 +0800 Subject: fix invalid yaml format when is_use_with_gocq is False --- ATRI/configs/create.py | 9 ++++++--- ATRI/configs/default_config.yml | 5 +---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'ATRI') diff --git a/ATRI/configs/create.py b/ATRI/configs/create.py index f1be942..1eff69b 100644 --- a/ATRI/configs/create.py +++ b/ATRI/configs/create.py @@ -93,12 +93,15 @@ def init_config(conf_path: Path, default_conf_path: Path): if is_use_with_gocq: raw_conf = raw_conf.replace("{is_use_with_gocq}", "true") - raw_conf = raw_conf.replace("{uin}", str(uin)) # type: ignore - raw_conf = raw_conf.replace("{password}", password) # type: ignore - raw_conf = raw_conf.replace("{protocol}", str(protocol)) # type: ignore raw_conf = raw_conf.replace("{download_domain}", download_domain) # type: ignore + raw_conf = raw_conf.replace("{accounts}", """ + - uin: {uin} + password: "{password}" + protocol: {protocol}""". + format(uin=str(uin), password=password, protocol=str(protocol))) # type: ignore else: raw_conf = raw_conf.replace("{is_use_with_gocq}", "false") + raw_conf = raw_conf.replace("{account}", "[]") raw_conf = raw_conf.replace("{saucenao_key}", saucenao_key) diff --git a/ATRI/configs/default_config.yml b/ATRI/configs/default_config.yml index 7808487..daa7ca8 100644 --- a/ATRI/configs/default_config.yml +++ b/ATRI/configs/default_config.yml @@ -16,10 +16,7 @@ BotConfig: WithGoCQHTTP: enabled: {is_use_with_gocq} - accounts: - - uin: {uin} - password: "{password}" - protocol: {protocol} + accounts: {accounts} download_domain: "{download_domain}" download_version: "v1.0.0-rc4" -- cgit v1.2.3