From 76048a81494cc9f2eba117160dff148a8d1727ff Mon Sep 17 00:00:00 2001 From: Womsxd <45663319+Womsxd@users.noreply.github.com> Date: Fri, 24 Jun 2022 10:13:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- account.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/account.py b/account.py index 21950ba..c12251e 100644 --- a/account.py +++ b/account.py @@ -5,13 +5,6 @@ from loghelper import log from error import CookieError -def game_id2name(game_id: str) -> str: - try: - return setting.game_id2name[game_id] - except NameError: - return game_id - - def stop_module(game_id: str) -> None: if game_id == "bh2_cn": config.config["games"]["cn"]["hokai2"]["auto_checkin"] = False @@ -27,15 +20,15 @@ def stop_module(game_id: str) -> None: def get_account_list(game_id: str, headers: dict) -> list: - log.info(f"正在获取米哈游账号绑定的{game_id2name(game_id)}账号列表...") + log.info(f"正在获取米哈游账号绑定的{setting.game_id2name.get(game_id,game_id)}账号列表...") temp_list = [] req = http.get(setting.account_Info_url + game_id, headers=headers) data = req.json() if data["retcode"] != 0: - log.warning(f"获取{game_id2name(game_id)}账号列表失败!") + log.warning(f"获取{setting.game_id2name.get(game_id,game_id)}账号列表失败!") stop_module(game_id) raise CookieError("BBS Cookie Error") for i in data["data"]["list"]: temp_list.append([i["nickname"], i["game_uid"], i["region"]]) - log.info(f"已获取到{len(temp_list)}个{game_id2name(game_id)}账号信息") + log.info(f"已获取到{len(temp_list)}个{setting.game_id2name.get(game_id,game_id)}账号信息") return temp_list