From 6ed95a4cbb0d0b36b1cdc50d902454958bd27efc Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Tue, 23 Jan 2024 16:48:14 +0800 Subject: [PATCH 01/19] =?UTF-8?q?refactor(all):=20=E4=BB=8E=20nonebot.log?= =?UTF-8?q?=20=E5=AF=BC=E5=85=A5=20logger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/model/config.py | 2 +- src/nonebot_plugin_mystool/model/data.py | 2 +- src/nonebot_plugin_mystool/model/upgrade/common.py | 2 +- src/nonebot_plugin_mystool/model/upgrade/configV2.py | 2 +- src/nonebot_plugin_mystool/model/upgrade/dataV2.py | 2 +- src/nonebot_plugin_mystool/utils/common.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/nonebot_plugin_mystool/model/config.py b/src/nonebot_plugin_mystool/model/config.py index a5bb0129..65e21b65 100644 --- a/src/nonebot_plugin_mystool/model/config.py +++ b/src/nonebot_plugin_mystool/model/config.py @@ -4,7 +4,7 @@ from typing import Union, Optional, Tuple, Any, Dict, TYPE_CHECKING import nonebot -from loguru import logger +from nonebot.log import logger from pydantic import BaseModel, BaseSettings, validator from ..model.common import data_path diff --git a/src/nonebot_plugin_mystool/model/data.py b/src/nonebot_plugin_mystool/model/data.py index 4d7bc97d..a6218f5c 100644 --- a/src/nonebot_plugin_mystool/model/data.py +++ b/src/nonebot_plugin_mystool/model/data.py @@ -5,7 +5,7 @@ from uuid import UUID, uuid4 from httpx import Cookies -from loguru import logger +from nonebot.log import logger from pydantic import BaseModel, ValidationError, validator from .._version import __version__ diff --git a/src/nonebot_plugin_mystool/model/upgrade/common.py b/src/nonebot_plugin_mystool/model/upgrade/common.py index 83a4cfea..241f0574 100644 --- a/src/nonebot_plugin_mystool/model/upgrade/common.py +++ b/src/nonebot_plugin_mystool/model/upgrade/common.py @@ -1,6 +1,6 @@ from typing import Union, Optional, Dict, TYPE_CHECKING -from loguru import logger +from nonebot.log import logger from pydantic import BaseSettings from ..._version import __version__ diff --git a/src/nonebot_plugin_mystool/model/upgrade/configV2.py b/src/nonebot_plugin_mystool/model/upgrade/configV2.py index 445d57e7..27e2e0a7 100644 --- a/src/nonebot_plugin_mystool/model/upgrade/configV2.py +++ b/src/nonebot_plugin_mystool/model/upgrade/configV2.py @@ -7,7 +7,7 @@ from pathlib import Path from typing import Union, Optional, Tuple, Any, Dict, TYPE_CHECKING -from loguru import logger +from nonebot.log import logger from pydantic import BaseModel, BaseSettings, validator from ...model.common import data_path diff --git a/src/nonebot_plugin_mystool/model/upgrade/dataV2.py b/src/nonebot_plugin_mystool/model/upgrade/dataV2.py index f578f4ba..d80ba03a 100644 --- a/src/nonebot_plugin_mystool/model/upgrade/dataV2.py +++ b/src/nonebot_plugin_mystool/model/upgrade/dataV2.py @@ -9,7 +9,7 @@ from uuid import UUID, uuid4 from httpx import Cookies -from loguru import logger +from nonebot.log import logger from pydantic import BaseModel, ValidationError, validator from ..._version import __version__ diff --git a/src/nonebot_plugin_mystool/utils/common.py b/src/nonebot_plugin_mystool/utils/common.py index d2b58d45..6f43b323 100644 --- a/src/nonebot_plugin_mystool/utils/common.py +++ b/src/nonebot_plugin_mystool/utils/common.py @@ -32,7 +32,7 @@ from ..model import GeetestResult, PluginDataManager, Preference, plugin_config, plugin_env, UserData if TYPE_CHECKING: - from loguru import Logger + from nonebot.log import logger __all__ = ["GeneralMessageEvent", "GeneralPrivateMessageEvent", "GeneralGroupMessageEvent", "CommandBegin", "get_last_command_sep", "COMMAND_BEGIN", "set_logger", "logger", "PLUGIN", "custom_attempt_times", From c4d37e3f6ce0776043dec06b18bf28aff9b7fee5 Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Tue, 23 Jan 2024 17:20:06 +0800 Subject: [PATCH 02/19] =?UTF-8?q?fix(utils):=20=E4=BF=AE=E5=A4=8D=20F821?= =?UTF-8?q?=20undefined=20name=20'Logger'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/utils/common.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/nonebot_plugin_mystool/utils/common.py b/src/nonebot_plugin_mystool/utils/common.py index 6f43b323..e2c0637e 100644 --- a/src/nonebot_plugin_mystool/utils/common.py +++ b/src/nonebot_plugin_mystool/utils/common.py @@ -8,7 +8,7 @@ import uuid from copy import deepcopy from pathlib import Path -from typing import (TYPE_CHECKING, Dict, Literal, +from typing import (Dict, Literal, Union, Optional, Tuple, Iterable, List) from urllib.parse import urlencode @@ -16,6 +16,7 @@ import nonebot.log import nonebot.plugin import tenacity +from loguru import Logger from nonebot import Adapter, Bot from nonebot.adapters import Message from nonebot.adapters.onebot.v11 import MessageEvent as OneBotV11MessageEvent, PrivateMessageEvent, GroupMessageEvent, \ @@ -27,13 +28,11 @@ from nonebot.adapters.qq.models import DMS from nonebot.exception import ActionFailed from nonebot.log import logger +from nonebot.log import logger from qrcode import QRCode from ..model import GeetestResult, PluginDataManager, Preference, plugin_config, plugin_env, UserData -if TYPE_CHECKING: - from nonebot.log import logger - __all__ = ["GeneralMessageEvent", "GeneralPrivateMessageEvent", "GeneralGroupMessageEvent", "CommandBegin", "get_last_command_sep", "COMMAND_BEGIN", "set_logger", "logger", "PLUGIN", "custom_attempt_times", "get_async_retry", "generate_device_id", "cookie_str_to_dict", "cookie_dict_to_str", "generate_ds", From 455a83e124e165b6930e23a1486305bb39d6e3c9 Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Tue, 23 Jan 2024 17:27:57 +0800 Subject: [PATCH 03/19] =?UTF-8?q?style(all):=20=E4=BF=AE=E5=A4=8D=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E6=A0=B7=E5=BC=8F=E8=BF=9D=E8=A7=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/api/common.py | 6 ++++-- src/nonebot_plugin_mystool/api/game_sign_api.py | 7 +++++-- src/nonebot_plugin_mystool/command/address.py | 14 +++++++------- src/nonebot_plugin_mystool/model/data.py | 4 ++-- src/nonebot_plugin_mystool/model/upgrade/dataV2.py | 4 ++-- src/nonebot_plugin_mystool/utils/good_image.py | 7 +++---- 6 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/nonebot_plugin_mystool/api/common.py b/src/nonebot_plugin_mystool/api/common.py index 45880812..f4ddd13d 100644 --- a/src/nonebot_plugin_mystool/api/common.py +++ b/src/nonebot_plugin_mystool/api/common.py @@ -1593,8 +1593,10 @@ async def starrail_note(account: UserAccount) -> Tuple[ return StarRailNoteStatus(no_starrail_account=True), None -async def create_verification(account: UserAccount = None, retry: bool = True) -> Tuple[ - BaseApiStatus, Optional[MmtData]]: +async def create_verification( + account: UserAccount = None, + retry: bool = True +) -> Tuple[BaseApiStatus, Optional[MmtData]]: """ 创建人机验证任务 - 一般用于米游社讨论区签到 diff --git a/src/nonebot_plugin_mystool/api/game_sign_api.py b/src/nonebot_plugin_mystool/api/game_sign_api.py index 27e1e1c3..834e3fb0 100644 --- a/src/nonebot_plugin_mystool/api/game_sign_api.py +++ b/src/nonebot_plugin_mystool/api/game_sign_api.py @@ -90,8 +90,11 @@ async def get_rewards(self, retry: bool = True) -> Tuple[BaseApiStatus, Optional logger.exception(f"获取签到奖励信息 - 请求失败") return BaseApiStatus(network_error=True), None - async def get_info(self, platform: Literal["ios", "android"] = "ios", retry: bool = True) -> Tuple[ - BaseApiStatus, Optional[GameSignInfo]]: + async def get_info( + self, + platform: Literal["ios", "android"] = "ios", + retry: bool = True + ) -> Tuple[BaseApiStatus, Optional[GameSignInfo]]: """ 获取签到记录 diff --git a/src/nonebot_plugin_mystool/command/address.py b/src/nonebot_plugin_mystool/command/address.py index 0a21e71a..d701dadf 100644 --- a/src/nonebot_plugin_mystool/command/address.py +++ b/src/nonebot_plugin_mystool/command/address.py @@ -68,13 +68,13 @@ async def _(event: Union[GeneralPrivateMessageEvent], state: T_State, bbs_uid=Ar if address_list: address_text = map( - lambda x: f"省 ➢ {x.province_name}" \ - f"\n市 ➢ {x.city_name}" \ - f"\n区/县 ➢ {x.county_name}" \ - f"\n详细地址 ➢ {x.addr_ext}" \ - f"\n联系电话 ➢ {x.phone}" \ - f"\n联系人 ➢ {x.connect_name}" \ - f"\n地址ID ➢ {x.id}", + lambda x: f"省 ➢ {x.province_name}\n" + f"市 ➢ {x.city_name}\n" + f"区/县 ➢ {x.county_name}\n" + f"详细地址 ➢ {x.addr_ext}\n" + f"联系电话 ➢ {x.phone}\n" + f"联系人 ➢ {x.connect_name}\n" + f"地址ID ➢ {x.id}", address_list ) msg = "以下为查询结果:" \ diff --git a/src/nonebot_plugin_mystool/model/data.py b/src/nonebot_plugin_mystool/model/data.py index a6218f5c..6f08492f 100644 --- a/src/nonebot_plugin_mystool/model/data.py +++ b/src/nonebot_plugin_mystool/model/data.py @@ -345,7 +345,7 @@ def uuid4_validate(v): """ try: UUID(v, version=4) - except: + except Exception: return False else: return True @@ -459,7 +459,7 @@ def load_plugin_data(cls): except (ValidationError, JSONDecodeError): logger.exception(f"读取插件数据文件失败,请检查插件数据文件 {plugin_data_path} 格式是否正确") raise - except: + except Exception: logger.exception( f"读取插件数据文件失败,请检查插件数据文件 {plugin_data_path} 是否存在且有权限读取和写入") raise diff --git a/src/nonebot_plugin_mystool/model/upgrade/dataV2.py b/src/nonebot_plugin_mystool/model/upgrade/dataV2.py index d80ba03a..eb9735fb 100644 --- a/src/nonebot_plugin_mystool/model/upgrade/dataV2.py +++ b/src/nonebot_plugin_mystool/model/upgrade/dataV2.py @@ -349,7 +349,7 @@ def uuid4_validate(v): """ try: UUID(v, version=4) - except: + except Exception: return False else: return True @@ -463,7 +463,7 @@ def load_plugin_data(cls): except (ValidationError, JSONDecodeError): logger.exception(f"读取插件数据文件失败,请检查插件数据文件 {plugin_data_path} 格式是否正确") raise - except: + except Exception: logger.exception( f"读取插件数据文件失败,请检查插件数据文件 {plugin_data_path} 是否存在且有权限读取和写入") raise diff --git a/src/nonebot_plugin_mystool/utils/good_image.py b/src/nonebot_plugin_mystool/utils/good_image.py index 59b0929a..c1de8b9d 100644 --- a/src/nonebot_plugin_mystool/utils/good_image.py +++ b/src/nonebot_plugin_mystool/utils/good_image.py @@ -64,7 +64,7 @@ async def game_list_to_image(good_list: List[Good], lock: Lock = None, retry: bo f"{plugin_config.preference.log_head}商品列表图片生成 - 已完成字体下载 -> {FONT_SAVE_PATH}") try: os.remove(TEMP_FONT_PATH) - except: + except Exception: logger.exception( f"{plugin_config.preference.log_head}商品列表图片生成 - 无法清理下载的字体压缩包临时文件") font_path = FONT_SAVE_PATH @@ -94,8 +94,7 @@ async def game_list_to_image(good_list: List[Good], lock: Lock = None, retry: bo # 记录预览图粘贴位置 position.append((0, size_y)) # 调整下一个粘贴的位置 - size_y += plugin_env.good_list_image_config.ICON_SIZE[1] + \ - plugin_env.good_list_image_config.PADDING_ICON + size_y += plugin_env.good_list_image_config.ICON_SIZE[1] + plugin_env.good_list_image_config.PADDING_ICON imgs.append(img) preview = Image.new( @@ -123,5 +122,5 @@ async def game_list_to_image(good_list: List[Good], lock: Lock = None, retry: bo image_bytes = io.BytesIO() preview.save(image_bytes, format="JPEG") return image_bytes.getvalue() - except: + except Exception: logger.exception(f"{plugin_config.preference.log_head}商品列表图片生成 - 无法完成图片生成") From 1afd67cc95d6ea8a3b0f72bbb8049e995dff5acb Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Tue, 23 Jan 2024 17:31:14 +0800 Subject: [PATCH 04/19] =?UTF-8?q?refactor(model):=20=E6=9B=B4=E6=96=B0=20P?= =?UTF-8?q?reference.github=5Fproxy=20=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/model/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nonebot_plugin_mystool/model/config.py b/src/nonebot_plugin_mystool/model/config.py index 65e21b65..7f24b31c 100644 --- a/src/nonebot_plugin_mystool/model/config.py +++ b/src/nonebot_plugin_mystool/model/config.py @@ -25,7 +25,7 @@ class Preference(BaseModel): """ 偏好设置 """ - github_proxy: Optional[str] = "https://ghproxy.com/" + github_proxy: Optional[str] = "https://mirror.ghproxy.com/" """GitHub加速代理 最终会拼接在原GitHub链接前面""" enable_connection_test: bool = True """是否开启连接测试""" From 9e10d700e5fbcf8ba6dc572b58c7a82b5173b225 Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:28:11 +0800 Subject: [PATCH 05/19] =?UTF-8?q?feat(model):=20=E4=B8=BA=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=95=B0=E6=8D=AE=E5=A2=9E=E5=8A=A0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: 242 --- src/nonebot_plugin_mystool/model/data.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/nonebot_plugin_mystool/model/data.py b/src/nonebot_plugin_mystool/model/data.py index 6f08492f..e9384a7c 100644 --- a/src/nonebot_plugin_mystool/model/data.py +++ b/src/nonebot_plugin_mystool/model/data.py @@ -8,6 +8,7 @@ from nonebot.log import logger from pydantic import BaseModel, ValidationError, validator +from ..utils import blur_phone from .._version import __version__ from ..model.common import data_path, BaseModelWithSetter, Address, BaseModelWithUpdate, Good, GameRecord @@ -271,6 +272,13 @@ def bbs_uid(self): def bbs_uid(self, value: str): self.cookies.bbs_uid = value + @property + def display_name(self): + """ + 显示名称 + """ + return f"{self.bbs_uid}({blur_phone(self.phone_number)})" + class ExchangePlan(BaseModel): """ From 09645194dae9ea84041ae4a035dc2a2164909faf Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:29:06 +0800 Subject: [PATCH 06/19] =?UTF-8?q?refactor(utils):=20=E9=87=87=E7=94=A8?= =?UTF-8?q?=E6=9B=B4=E4=BF=9D=E5=AE=88=E7=9A=84=E6=89=8B=E6=9C=BA=E5=8F=B7?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E6=96=B9=E5=BC=8F=EF=BC=88=E5=8F=AA=E4=BF=9D?= =?UTF-8?q?=E7=95=99=E5=B0=BE=E5=8F=B7=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/utils/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nonebot_plugin_mystool/utils/common.py b/src/nonebot_plugin_mystool/utils/common.py index e2c0637e..91c42999 100644 --- a/src/nonebot_plugin_mystool/utils/common.py +++ b/src/nonebot_plugin_mystool/utils/common.py @@ -307,7 +307,7 @@ def blur_phone(phone: Union[str, int]) -> str: """ if isinstance(phone, int): phone = str(phone) - return f"{phone[:3]}****{phone[-4:]}" + return f"☎️{phone[-4:]}" def generate_qr_img(data: str): From 1158b371029643424e37946762f0d5ac5aa80efa Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:30:59 +0800 Subject: [PATCH 07/19] =?UTF-8?q?feat(all):=20=E5=9C=A8=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E6=96=B9=E9=9D=A2=E9=87=87=E7=94=A8=20UserAc?= =?UTF-8?q?count.display=5Fname=20=E8=BE=93=E5=87=BA=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: 242 --- src/nonebot_plugin_mystool/api/common.py | 42 ++++++------ .../api/game_sign_api.py | 12 ++-- .../api/myb_missions_api.py | 28 ++++---- src/nonebot_plugin_mystool/command/address.py | 4 +- .../command/exchange.py | 10 +-- src/nonebot_plugin_mystool/command/plan.py | 68 +++++++++---------- 6 files changed, 82 insertions(+), 82 deletions(-) diff --git a/src/nonebot_plugin_mystool/api/common.py b/src/nonebot_plugin_mystool/api/common.py index f4ddd13d..218891a8 100644 --- a/src/nonebot_plugin_mystool/api/common.py +++ b/src/nonebot_plugin_mystool/api/common.py @@ -397,7 +397,7 @@ async def get_game_record(account: UserAccount, retry: bool = True) -> Tuple[Bas api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"获取用户游戏数据(GameRecord) - 用户 {account.bbs_uid} 登录失效") + f"获取用户游戏数据(GameRecord) - 用户 {account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(login_expired=True), None return BaseApiStatus(success=True), list( @@ -455,7 +455,7 @@ async def get_user_myb(account: UserAccount, retry: bool = True) -> Tuple[BaseAp api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"获取用户米游币 - 用户 {account.bbs_uid} 登录失效") + f"获取用户米游币 - 用户 {account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(login_expired=True), None return BaseApiStatus(success=True), int(api_result.data["points"]) @@ -497,7 +497,7 @@ async def device_login(account: UserAccount, retry: bool = True): api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"设备登录(device_login) - 用户 {account.bbs_uid} 登录失效") + f"设备登录(device_login) - 用户 {account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(login_expired=True) if res.json()["message"] != "OK": @@ -542,7 +542,7 @@ async def device_save(account: UserAccount, retry: bool = True): api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"设备保存(device_save) - 用户 {account.bbs_uid} 登录失效") + f"设备保存(device_save) - 用户 {account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(login_expired=True) if res.json()["message"] != "OK": @@ -679,7 +679,7 @@ async def get_address(account: UserAccount, retry: bool = True) -> Tuple[BaseApi api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"获取地址数据 - 用户 {account.bbs_uid} 登录失效") + f"获取地址数据 - 用户 {account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(login_expired=True), None address_list = list(map(Address.parse_obj, api_result.data["list"])) @@ -1362,28 +1362,28 @@ async def good_exchange(plan: ExchangePlan) -> Tuple[ExchangeStatus, Optional[Ex api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"米游币商品兑换 - 执行兑换: 用户 {plan.account.bbs_uid} 登录失效 - 请求发送时间: {start_time}") + f"米游币商品兑换 - 执行兑换: 用户 {plan.account.display_name} 登录失效 - 请求发送时间: {start_time}") logger.debug(f"网络请求返回: {res.text}") return ExchangeStatus(login_expired=True), None if api_result.success: logger.info( - f"米游币商品兑换: 用户 {plan.account.bbs_uid} 商品 {plan.good.goods_id} 兑换成功!可以自行确认 - 请求发送时间: {start_time}") + f"米游币商品兑换: 用户 {plan.account.display_name} 商品 {plan.good.goods_id} 兑换成功!可以自行确认 - 请求发送时间: {start_time}") logger.debug(f"网络请求返回: {res.text}") return ExchangeStatus(success=True), ExchangeResult(result=True, return_data=res.json(), plan=plan) else: logger.info( - f"米游币商品兑换: 用户 {plan.account.bbs_uid} 商品 {plan.good.goods_id} 兑换失败,可以自行确认 - 请求发送时间: {start_time}") + f"米游币商品兑换: 用户 {plan.account.display_name} 商品 {plan.good.goods_id} 兑换失败,可以自行确认 - 请求发送时间: {start_time}") logger.debug(f"网络请求返回: {res.text}") return ExchangeStatus(success=True), ExchangeResult(result=False, return_data=res.json(), plan=plan) except Exception as e: if is_incorrect_return(e): logger.error( - f"米游币商品兑换: 用户 {plan.account.bbs_uid} 商品 {plan.good.goods_id} 服务器没有正确返回 - 请求发送时间: {start_time}") + f"米游币商品兑换: 用户 {plan.account.display_name} 商品 {plan.good.goods_id} 服务器没有正确返回 - 请求发送时间: {start_time}") logger.debug(f"网络请求返回: {res.text}") return ExchangeStatus(incorrect_return=True), None else: logger.exception( - f"米游币商品兑换: 用户 {plan.account.bbs_uid} 商品 {plan.good.goods_id} 请求失败 - 请求发送时间: {start_time}") + f"米游币商品兑换: 用户 {plan.account.display_name} 商品 {plan.good.goods_id} 请求失败 - 请求发送时间: {start_time}") return ExchangeStatus(network_error=True), None @@ -1421,28 +1421,28 @@ def good_exchange_sync(plan: ExchangePlan) -> Tuple[ExchangeStatus, Optional[Exc api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"米游币商品兑换 - 执行兑换: 用户 {plan.account.bbs_uid} 登录失效 - 请求发送时间: {start_time}") + f"米游币商品兑换 - 执行兑换: 用户 {plan.account.display_name} 登录失效 - 请求发送时间: {start_time}") logger.debug(f"网络请求返回: {res.text}") return ExchangeStatus(login_expired=True), None if api_result.success: logger.info( - f"米游币商品兑换: 用户 {plan.account.bbs_uid} 商品 {plan.good.goods_id} 兑换成功!可以自行确认 - 请求发送时间: {start_time}") + f"米游币商品兑换: 用户 {plan.account.display_name} 商品 {plan.good.goods_id} 兑换成功!可以自行确认 - 请求发送时间: {start_time}") logger.debug(f"网络请求返回: {res.text}") return ExchangeStatus(success=True), ExchangeResult(result=True, return_data=res.json(), plan=plan) else: logger.info( - f"米游币商品兑换: 用户 {plan.account.bbs_uid} 商品 {plan.good.goods_id} 兑换失败,可以自行确认 - 请求发送时间: {start_time}") + f"米游币商品兑换: 用户 {plan.account.display_name} 商品 {plan.good.goods_id} 兑换失败,可以自行确认 - 请求发送时间: {start_time}") logger.debug(f"网络请求返回: {res.text}") return ExchangeStatus(success=True), ExchangeResult(result=False, return_data=res.json(), plan=plan) except Exception as e: if is_incorrect_return(e): logger.error( - f"米游币商品兑换: 用户 {plan.account.bbs_uid} 商品 {plan.good.goods_id} 服务器没有正确返回 - 请求发送时间: {start_time}") + f"米游币商品兑换: 用户 {plan.account.display_name} 商品 {plan.good.goods_id} 服务器没有正确返回 - 请求发送时间: {start_time}") logger.debug(f"网络请求返回: {res.text}") return ExchangeStatus(incorrect_return=True), None else: logger.exception( - f"米游币商品兑换: 用户 {plan.account.bbs_uid} 商品 {plan.good.goods_id} 请求失败 - 请求发送时间: {start_time}") + f"米游币商品兑换: 用户 {plan.account.display_name} 商品 {plan.good.goods_id} 请求失败 - 请求发送时间: {start_time}") return ExchangeStatus(network_error=True), None @@ -1491,17 +1491,17 @@ async def genshin_note(account: UserAccount) -> Tuple[ api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"原神实时便笺: 用户 {account.bbs_uid} 登录失效") + f"原神实时便笺: 用户 {account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return GenshinNoteStatus(login_expired=True), None if api_result.invalid_ds: logger.info( - f"原神实时便笺: 用户 {account.bbs_uid} DS 校验失败") + f"原神实时便笺: 用户 {account.display_name} DS 校验失败") logger.debug(f"网络请求返回: {res.text}") if api_result.retcode == 1034: logger.info( - f"原神实时便笺: 用户 {account.bbs_uid} 可能被验证码阻拦") + f"原神实时便笺: 用户 {account.display_name} 可能被验证码阻拦") logger.debug(f"网络请求返回: {res.text}") if not api_result.success: headers["DS"] = generate_ds() @@ -1568,17 +1568,17 @@ async def starrail_note(account: UserAccount) -> Tuple[ api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"崩铁实时便笺: 用户 {account.bbs_uid} 登录失效") + f"崩铁实时便笺: 用户 {account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return StarRailNoteStatus(login_expired=True), None if api_result.invalid_ds: logger.info( - f"崩铁实时便笺: 用户 {account.bbs_uid} DS 校验失败") + f"崩铁实时便笺: 用户 {account.display_name} DS 校验失败") logger.debug(f"网络请求返回: {res.text}") if api_result.retcode == 1034: logger.info( - f"崩铁实时便笺: 用户 {account.bbs_uid} 可能被验证码阻拦") + f"崩铁实时便笺: 用户 {account.display_name} 可能被验证码阻拦") logger.debug(f"网络请求返回: {res.text}") return StarRailNoteStatus(success=True), StarRailNote.parse_obj(api_result.data) except tenacity.RetryError as e: diff --git a/src/nonebot_plugin_mystool/api/game_sign_api.py b/src/nonebot_plugin_mystool/api/game_sign_api.py index 834e3fb0..f3c5771c 100644 --- a/src/nonebot_plugin_mystool/api/game_sign_api.py +++ b/src/nonebot_plugin_mystool/api/game_sign_api.py @@ -115,12 +115,12 @@ async def get_info( api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"获取签到数据 - 用户 {self.account.bbs_uid} 登录失效") + f"获取签到数据 - 用户 {self.account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(login_expired=True), None if api_result.invalid_ds: logger.info( - f"获取签到数据 - 用户 {self.account.bbs_uid} DS 校验失败") + f"获取签到数据 - 用户 {self.account.display_name} DS 校验失败") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(invalid_ds=True), None return BaseApiStatus(success=True), GameSignInfo.parse_obj(api_result.data) @@ -193,21 +193,21 @@ async def sign(self, api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"游戏签到 - 用户 {self.account.bbs_uid} 登录失效") + f"游戏签到 - 用户 {self.account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(login_expired=True), None elif api_result.invalid_ds: logger.info( - f"游戏签到 - 用户 {self.account.bbs_uid} DS 校验失败") + f"游戏签到 - 用户 {self.account.display_name} DS 校验失败") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(invalid_ds=True), None elif api_result.data.get("risk_code") != 0: logger.warning( - f"{plugin_config.preference.log_head}游戏签到 - 用户 {self.account.bbs_uid} 可能被人机验证阻拦") + f"{plugin_config.preference.log_head}游戏签到 - 用户 {self.account.display_name} 可能被人机验证阻拦") logger.debug(f"{plugin_config.preference.log_head}网络请求返回: {res.text}") return BaseApiStatus(need_verify=True), MmtData.parse_obj(api_result.data) else: - logger.success(f"游戏签到 - 用户 {self.account.bbs_uid} 签到成功") + logger.success(f"游戏签到 - 用户 {self.account.display_name} 签到成功") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(success=True), None diff --git a/src/nonebot_plugin_mystool/api/myb_missions_api.py b/src/nonebot_plugin_mystool/api/myb_missions_api.py index deebe5f1..db90b8d2 100644 --- a/src/nonebot_plugin_mystool/api/myb_missions_api.py +++ b/src/nonebot_plugin_mystool/api/myb_missions_api.py @@ -134,17 +134,17 @@ async def sign(self, retry: bool = True) -> Tuple[MissionStatus, Optional[int]]: api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.error( - f"米游币任务 - 讨论区签到: 用户 {self.account.bbs_uid} 登录失效") + f"米游币任务 - 讨论区签到: 用户 {self.account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return MissionStatus(login_expired=True), None elif api_result.invalid_ds: logger.error( - f"米游币任务 - 讨论区签到: 用户 {self.account.bbs_uid} DS 校验失败") + f"米游币任务 - 讨论区签到: 用户 {self.account.display_name} DS 校验失败") logger.debug(f"网络请求返回: {res.text}") return MissionStatus(invalid_ds=True), None elif api_result.retcode == 1034: logger.error( - f"米游币任务 - 讨论区签到: 用户 {self.account.bbs_uid} 需要完成人机验证") + f"米游币任务 - 讨论区签到: 用户 {self.account.display_name} 需要完成人机验证") logger.debug(f"网络请求返回: {res.text}") if plugin_config.preference.geetest_url: create_status, mmt_data = await create_verification(self.account) @@ -152,15 +152,15 @@ async def sign(self, retry: bool = True) -> Tuple[MissionStatus, Optional[int]]: if geetest_result := await get_validate(mmt_data.gt, mmt_data.challenge): if await verify_verification(mmt_data, geetest_result, self.account): logger.success( - f"米游币任务 - 讨论区签到: 用户 {self.account.bbs_uid} 人机验证通过") + f"米游币任务 - 讨论区签到: 用户 {self.account.display_name} 人机验证通过") continue else: logger.info( - f"米游币任务 - 讨论区签到: 用户 {self.account.bbs_uid} 未配置极验人机验证打码平台") + f"米游币任务 - 讨论区签到: 用户 {self.account.display_name} 未配置极验人机验证打码平台") return MissionStatus(need_verify=True), None elif api_result.retcode == 1008: logger.warning( - f"米游币任务 - 讨论区签到: 用户 {self.account.bbs_uid} 今日已经签到过了") + f"米游币任务 - 讨论区签到: 用户 {self.account.display_name} 今日已经签到过了") logger.debug(f"网络请求返回: {res.text}") return MissionStatus(success=True, already_signed=True), 0 return MissionStatus(success=True), api_result.data["points"] @@ -236,12 +236,12 @@ async def read(self, read_times: int = 5, retry: bool = True) -> MissionStatus: api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"米游币任务 - 阅读: 用户 {self.account.bbs_uid} 登录失效") + f"米游币任务 - 阅读: 用户 {self.account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return MissionStatus(login_expired=True) if api_result.invalid_ds: logger.info( - f"米游币任务 - 阅读: 用户 {self.account.bbs_uid} DS 校验失败") + f"米游币任务 - 阅读: 用户 {self.account.display_name} DS 校验失败") logger.debug(f"网络请求返回: {res.text}") return MissionStatus(invalid_ds=True) if api_result.message == "帖子不存在": @@ -297,12 +297,12 @@ async def like(self, like_times: int = 10, retry: bool = True) -> MissionStatus: api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"米游币任务 - 点赞: 用户 {self.account.bbs_uid} 登录失效") + f"米游币任务 - 点赞: 用户 {self.account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return MissionStatus(login_expired=True) if api_result.invalid_ds: logger.info( - f"米游币任务 - 点赞: 用户 {self.account.bbs_uid} DS 校验失败") + f"米游币任务 - 点赞: 用户 {self.account.display_name} DS 校验失败") logger.debug(f"网络请求返回: {res.text}") return MissionStatus(invalid_ds=True) if api_result.message == "帖子不存在": @@ -351,12 +351,12 @@ async def share(self, retry: bool = True): api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"米游币任务 - 分享: 用户 {self.account.bbs_uid} 登录失效") + f"米游币任务 - 分享: 用户 {self.account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return MissionStatus(login_expired=True) if api_result.invalid_ds: logger.info( - f"米游币任务 - 分享: 用户 {self.account.bbs_uid} DS 校验失败") + f"米游币任务 - 分享: 用户 {self.account.display_name} DS 校验失败") logger.debug(f"网络请求返回: {res.text}") return MissionStatus(invalid_ds=True) if api_result.message == "帖子不存在": @@ -466,7 +466,7 @@ async def get_missions(account: UserAccount, retry: bool = True) -> Tuple[BaseAp api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"获取米游币任务列表: 用户 {account.bbs_uid} 登录失效") + f"获取米游币任务列表: 用户 {account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(login_expired=True), None mission_list: List[MissionData] = [] @@ -503,7 +503,7 @@ async def get_missions_state(account: UserAccount, retry: bool = True) -> Tuple[ api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"获取米游币任务完成情况: 用户 {account.bbs_uid} 登录失效") + f"获取米游币任务完成情况: 用户 {account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(login_expired=True), None state_dict = {} diff --git a/src/nonebot_plugin_mystool/command/address.py b/src/nonebot_plugin_mystool/command/address.py index d701dadf..1b44406c 100644 --- a/src/nonebot_plugin_mystool/command/address.py +++ b/src/nonebot_plugin_mystool/command/address.py @@ -63,7 +63,7 @@ async def _(event: Union[GeneralPrivateMessageEvent], state: T_State, bbs_uid=Ar state['address_list'] = address_list if not address_status: if address_status.login_expired: - await address_matcher.finish(f"⚠️账户 {account.bbs_uid} 登录失效,请重新登录") + await address_matcher.finish(f"⚠️账户 {account.display_name} 登录失效,请重新登录") await address_matcher.finish("⚠️获取失败,请稍后重新尝试") if address_list: @@ -96,6 +96,6 @@ async def _(_: Union[GeneralPrivateMessageEvent], state: T_State, address_id=Arg account: UserAccount = state["account"] account.address = address PluginDataManager.write_plugin_data() - await address_matcher.finish(f"🎉已成功设置账户 {account.bbs_uid} 的地址") + await address_matcher.finish(f"🎉已成功设置账户 {account.display_name} 的地址") else: await address_matcher.reject("⚠️您发送的地址ID与查询结果不匹配,请重新发送") diff --git a/src/nonebot_plugin_mystool/command/exchange.py b/src/nonebot_plugin_mystool/command/exchange.py index 21e515c7..6027a2ef 100644 --- a/src/nonebot_plugin_mystool/command/exchange.py +++ b/src/nonebot_plugin_mystool/command/exchange.py @@ -122,7 +122,7 @@ async def _( f"\n- 🔢商品ID:{good.goods_id}" \ f"\n- 💰商品价格:{good.price} 米游币" \ f"\n- 📅兑换时间:{good.time_text}" \ - f"\n- 🆔账户:{plan.account.bbs_uid}" + f"\n- 🆔账户:{plan.account.display_name}" msg += "\n\n" if not msg: msg = '您还没有兑换计划哦~\n\n' @@ -264,7 +264,7 @@ async def _( else: user.exchange_plans.add(plan) if not plan.account.device_fp: - logger.info(f"账号 {plan.account.bbs_uid} 未设置 device_fp,正在获取...") + logger.info(f"账号 {plan.account.display_name} 未设置 device_fp,正在获取...") fp_status, plan.account.device_fp = await get_device_fp(plan.account.device_id_ios) if not fp_status: await matcher.send( @@ -385,7 +385,7 @@ def exchange_notice(event: JobExecutionEvent): loop.create_task( send_private_msg( user_id=_user_id, - message=f"⚠️账户 {plan.account.bbs_uid}" + message=f"⚠️账户 {plan.account.display_name}" f"\n- {plan.good.general_name}" f"\n- 线程 {thread_id}" f"\n- 兑换请求发送失败" @@ -409,7 +409,7 @@ def exchange_notice(event: JobExecutionEvent): loop.create_task( send_private_msg( user_id=_user_id, - message=f"🎉账户 {plan.account.bbs_uid}" + message=f"🎉账户 {plan.account.display_name}" f"\n- {plan.good.general_name}" f"\n- 线程 {thread_id}" f"\n- 兑换成功" @@ -421,7 +421,7 @@ def exchange_notice(event: JobExecutionEvent): loop.create_task( send_private_msg( user_id=_user_id, - message=f"💦账户 {plan.account.bbs_uid}" + message=f"💦账户 {plan.account.display_name}" f"\n- {plan.good.general_name}" f"\n- 线程 {thread_id}" f"\n- 兑换失败" diff --git a/src/nonebot_plugin_mystool/command/plan.py b/src/nonebot_plugin_mystool/command/plan.py index e927d816..3bd4925c 100644 --- a/src/nonebot_plugin_mystool/command/plan.py +++ b/src/nonebot_plugin_mystool/command/plan.py @@ -227,12 +227,12 @@ async def perform_game_sign( game_record_status, records = await get_game_record(account) if not game_record_status: if matcher: - await matcher.send(f"⚠️账户 {account.bbs_uid} 获取游戏账号信息失败,请重新尝试") + await matcher.send(f"⚠️账户 {account.display_name} 获取游戏账号信息失败,请重新尝试") else: for user_id in user_ids: await send_private_msg( user_id=user_id, - message=f"⚠️账户 {account.bbs_uid} 获取游戏账号信息失败,请重新尝试" + message=f"⚠️账户 {account.display_name} 获取游戏账号信息失败,请重新尝试" ) continue games_has_record = [] @@ -245,12 +245,12 @@ async def perform_game_sign( get_info_status, info = await signer.get_info(account.platform) if not get_info_status: if matcher: - await matcher.send(f"⚠️账户 {account.bbs_uid} 获取签到记录失败") + await matcher.send(f"⚠️账户 {account.display_name} 获取签到记录失败") else: for user_id in user_ids: await send_private_msg( user_id=user_id, - message=f"⚠️账户 {account.bbs_uid} 获取签到记录失败" + message=f"⚠️账户 {account.display_name} 获取签到记录失败" ) else: signed = info.is_sign @@ -267,12 +267,12 @@ async def perform_game_sign( if not sign_status and (user.enable_notice or matcher): if sign_status.login_expired: - message = f"⚠️账户 {account.bbs_uid} 🎮『{signer.name}』签到时服务器返回登录失效,请尝试重新登录绑定账户" + message = f"⚠️账户 {account.display_name} 🎮『{signer.name}』签到时服务器返回登录失效,请尝试重新登录绑定账户" elif sign_status.need_verify: - message = (f"⚠️账户 {account.bbs_uid} 🎮『{signer.name}』签到时可能遇到验证码拦截," + message = (f"⚠️账户 {account.display_name} 🎮『{signer.name}』签到时可能遇到验证码拦截," "请尝试使用命令『/账号设置』更改设备平台,若仍失败请手动前往米游社签到") else: - message = f"⚠️账户 {account.bbs_uid} 🎮『{signer.name}』签到失败,请稍后再试" + message = f"⚠️账户 {account.display_name} 🎮『{signer.name}』签到失败,请稍后再试" if matcher: await matcher.send(message) elif user.enable_notice: @@ -289,12 +289,12 @@ async def perform_game_sign( get_info_status, info = await signer.get_info(account.platform) get_award_status, awards = await signer.get_rewards() if not get_info_status or not get_award_status: - msg = f"⚠️账户 {account.bbs_uid} 🎮『{signer.name}』获取签到结果失败!请手动前往米游社查看" + msg = f"⚠️账户 {account.display_name} 🎮『{signer.name}』获取签到结果失败!请手动前往米游社查看" else: award = awards[info.total_sign_day - 1] if info.is_sign: status = "签到成功!" if not signed else "已经签到过了" - msg = f"🪪账户 {account.bbs_uid}" \ + msg = f"🪪账户 {account.display_name}" \ f"\n🎮『{signer.name}』" \ f"\n🎮状态: {status}" \ f"\n{signer.record.nickname}·{signer.record.level}" \ @@ -305,7 +305,7 @@ async def perform_game_sign( onebot_img_msg = OneBotV11MessageSegment.image(img_file) qq_guild_img_msg = QQGuildMessageSegment.file_image(img_file) else: - msg = (f"⚠️账户 {account.bbs_uid} 🎮『{signer.name}』签到失败!请尝试重新签到," + msg = (f"⚠️账户 {account.display_name} 🎮『{signer.name}』签到失败!请尝试重新签到," "若多次失败请尝试重新登录绑定账户") if matcher: try: @@ -329,12 +329,12 @@ async def perform_game_sign( if not games_has_record: if matcher: - await matcher.send(f"⚠️您的米游社账户 {account.bbs_uid} 下不存在任何游戏账号,已跳过签到") + await matcher.send(f"⚠️您的米游社账户 {account.display_name} 下不存在任何游戏账号,已跳过签到") else: for user_id in user_ids: await send_private_msg( user_id=user_id, - message=f"⚠️您的米游社账户 {account.bbs_uid} 下不存在任何游戏账号,已跳过签到" + message=f"⚠️您的米游社账户 {account.display_name} 下不存在任何游戏账号,已跳过签到" ) # 如果全部登录失效,则关闭通知 @@ -361,20 +361,20 @@ async def perform_bbs_sign(user: UserData, user_ids: Iterable[str], matcher: Mat if not missions_state_status: if missions_state_status.login_expired: if matcher: - await matcher.send(f'⚠️账户 {account.bbs_uid} 登录失效,请重新登录') + await matcher.send(f'⚠️账户 {account.display_name} 登录失效,请重新登录') else: for user_id in user_ids: await send_private_msg( user_id=user_id, - message=f'⚠️账户 {account.bbs_uid} 登录失效,请重新登录' + message=f'⚠️账户 {account.display_name} 登录失效,请重新登录' ) if matcher: - await matcher.send(f'⚠️账户 {account.bbs_uid} 获取任务完成情况请求失败,你可以手动前往App查看') + await matcher.send(f'⚠️账户 {account.display_name} 获取任务完成情况请求失败,你可以手动前往App查看') else: for user_id in user_ids: await send_private_msg( user_id=user_id, - message=f'⚠️账户 {account.bbs_uid} 获取任务完成情况请求失败,你可以手动前往App查看' + message=f'⚠️账户 {account.display_name} 获取任务完成情况请求失败,你可以手动前往App查看' ) continue myb_before_mission = missions_state.current_myb @@ -387,11 +387,11 @@ async def perform_bbs_sign(user: UserData, user_ids: Iterable[str], matcher: Mat if not class_type: if matcher: await matcher.send( - f'⚠️🆔账户 {account.bbs_uid} 米游币任务目标分区『{class_name}』未找到,将跳过该分区') + f'⚠️🆔账户 {account.display_name} 米游币任务目标分区『{class_name}』未找到,将跳过该分区') continue mission_obj = class_type(account) if matcher: - await matcher.send(f'🆔账户 {account.bbs_uid} ⏳开始在分区『{class_type.name}』执行米游币任务...') + await matcher.send(f'🆔账户 {account.display_name} ⏳开始在分区『{class_type.name}』执行米游币任务...') # 执行任务 sign_status, read_status, like_status, share_status = ( @@ -413,7 +413,7 @@ async def perform_bbs_sign(user: UserData, user_ids: Iterable[str], matcher: Mat if matcher: await matcher.send( - f"🆔账户 {account.bbs_uid} 🎮『{class_type.name}』米游币任务执行情况:\n" + f"🆔账户 {account.display_name} 🎮『{class_type.name}』米游币任务执行情况:\n" f"📅签到:{'✓' if sign_status else '✕'} +{sign_points or '0'} 米游币🪙\n" f"📰阅读:{'✓' if read_status else '✕'}\n" f"❤️点赞:{'✓' if like_status else '✕'}\n" @@ -426,22 +426,22 @@ async def perform_bbs_sign(user: UserData, user_ids: Iterable[str], matcher: Mat if not missions_state_status: if missions_state_status.login_expired: if matcher: - await matcher.send(f'⚠️账户 {account.bbs_uid} 登录失效,请重新登录') + await matcher.send(f'⚠️账户 {account.display_name} 登录失效,请重新登录') else: for user_id in user_ids: await send_private_msg( user_id=user_id, - message=f'⚠️账户 {account.bbs_uid} 登录失效,请重新登录' + message=f'⚠️账户 {account.display_name} 登录失效,请重新登录' ) continue if matcher: await matcher.send( - f'⚠️账户 {account.bbs_uid} 获取任务完成情况请求失败,你可以手动前往App查看') + f'⚠️账户 {account.display_name} 获取任务完成情况请求失败,你可以手动前往App查看') else: for user_id in user_ids: await send_private_msg( user_id=user_id, - message=f'⚠️账户 {account.bbs_uid} 获取任务完成情况请求失败,你可以手动前往App查看' + message=f'⚠️账户 {account.display_name} 获取任务完成情况请求失败,你可以手动前往App查看' ) continue if all(current == mission.threshold for mission, current in missions_state.state_dict.values()): @@ -450,7 +450,7 @@ async def perform_bbs_sign(user: UserData, user_ids: Iterable[str], matcher: Mat notice_string = "⚠️今日米游币任务未全部完成" msg = f"{notice_string}" \ - f"\n🆔账户 {account.bbs_uid}" + f"\n🆔账户 {account.display_name}" for key_name, (mission, current) in missions_state.state_dict.items(): if key_name == BaseMission.SIGN: mission_name = "📅签到" @@ -494,12 +494,12 @@ async def genshin_note_check(user: UserData, user_ids: Iterable[str], matcher: M if not genshin_board_status: if matcher: if genshin_board_status.login_expired: - await matcher.send(f'⚠️账户 {account.bbs_uid} 登录失效,请重新登录') + await matcher.send(f'⚠️账户 {account.display_name} 登录失效,请重新登录') elif genshin_board_status.no_genshin_account: - await matcher.send(f'⚠️账户 {account.bbs_uid} 没有绑定任何原神账户,请绑定后再重试') + await matcher.send(f'⚠️账户 {account.display_name} 没有绑定任何原神账户,请绑定后再重试') elif genshin_board_status.need_verify: - await matcher.send(f'⚠️账户 {account.bbs_uid} 获取实时便笺时被人机验证阻拦') - await matcher.send(f'⚠️账户 {account.bbs_uid} 获取实时便笺请求失败,你可以手动前往App查看') + await matcher.send(f'⚠️账户 {account.display_name} 获取实时便笺时被人机验证阻拦') + await matcher.send(f'⚠️账户 {account.display_name} 获取实时便笺请求失败,你可以手动前往App查看') continue msg = '' @@ -551,7 +551,7 @@ async def genshin_note_check(user: UserData, user_ids: Iterable[str], matcher: M return msg += "❖原神·实时便笺❖" \ - f"\n🆔账户 {account.bbs_uid}" \ + f"\n🆔账户 {account.display_name}" \ f"\n⏳树脂数量:{note.current_resin} / 160" \ f"\n⏱️树脂{note.resin_recovery_text}" \ f"\n🕰️探索派遣:{note.current_expedition_num} / {note.max_expedition_num}" \ @@ -581,12 +581,12 @@ async def starrail_note_check(user: UserData, user_ids: Iterable[str], matcher: if not starrail_board_status: if matcher: if starrail_board_status.login_expired: - await matcher.send(f'⚠️账户 {account.bbs_uid} 登录失效,请重新登录') + await matcher.send(f'⚠️账户 {account.display_name} 登录失效,请重新登录') elif starrail_board_status.no_starrail_account: - await matcher.send(f'⚠️账户 {account.bbs_uid} 没有绑定任何星铁账户,请绑定后再重试') + await matcher.send(f'⚠️账户 {account.display_name} 没有绑定任何星铁账户,请绑定后再重试') elif starrail_board_status.need_verify: - await matcher.send(f'⚠️账户 {account.bbs_uid} 获取实时便笺时被人机验证阻拦') - await matcher.send(f'⚠️账户 {account.bbs_uid} 获取实时便笺请求失败,你可以手动前往App查看') + await matcher.send(f'⚠️账户 {account.display_name} 获取实时便笺时被人机验证阻拦') + await matcher.send(f'⚠️账户 {account.display_name} 获取实时便笺请求失败,你可以手动前往App查看') continue msg = '' @@ -638,7 +638,7 @@ async def starrail_note_check(user: UserData, user_ids: Iterable[str], matcher: return msg += "❖星穹铁道·实时便笺❖" \ - f"\n🆔账户 {account.bbs_uid}" \ + f"\n🆔账户 {account.display_name}" \ f"\n⏳开拓力数量:{note.current_stamina} / {note.max_stamina}" \ f"\n⏱开拓力{note.stamina_recover_text}" \ f"\n📒每日实训:{note.current_train_score} / {note.max_train_score}" \ From 68e09748a16fee690b2fec76caf660d7635d891e Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:30:59 +0800 Subject: [PATCH 08/19] =?UTF-8?q?feat(all):=20=E5=9C=A8=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E6=96=B9=E9=9D=A2=E9=87=87=E7=94=A8=20UserAc?= =?UTF-8?q?count.display=5Fname=20=E8=BE=93=E5=87=BA=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: 242 --- src/nonebot_plugin_mystool/api/common.py | 42 ++++++------ .../api/game_sign_api.py | 12 ++-- .../api/myb_missions_api.py | 28 ++++---- src/nonebot_plugin_mystool/command/address.py | 4 +- .../command/exchange.py | 10 +-- src/nonebot_plugin_mystool/command/plan.py | 68 +++++++++---------- 6 files changed, 82 insertions(+), 82 deletions(-) diff --git a/src/nonebot_plugin_mystool/api/common.py b/src/nonebot_plugin_mystool/api/common.py index f4ddd13d..218891a8 100644 --- a/src/nonebot_plugin_mystool/api/common.py +++ b/src/nonebot_plugin_mystool/api/common.py @@ -397,7 +397,7 @@ async def get_game_record(account: UserAccount, retry: bool = True) -> Tuple[Bas api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"获取用户游戏数据(GameRecord) - 用户 {account.bbs_uid} 登录失效") + f"获取用户游戏数据(GameRecord) - 用户 {account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(login_expired=True), None return BaseApiStatus(success=True), list( @@ -455,7 +455,7 @@ async def get_user_myb(account: UserAccount, retry: bool = True) -> Tuple[BaseAp api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"获取用户米游币 - 用户 {account.bbs_uid} 登录失效") + f"获取用户米游币 - 用户 {account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(login_expired=True), None return BaseApiStatus(success=True), int(api_result.data["points"]) @@ -497,7 +497,7 @@ async def device_login(account: UserAccount, retry: bool = True): api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"设备登录(device_login) - 用户 {account.bbs_uid} 登录失效") + f"设备登录(device_login) - 用户 {account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(login_expired=True) if res.json()["message"] != "OK": @@ -542,7 +542,7 @@ async def device_save(account: UserAccount, retry: bool = True): api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"设备保存(device_save) - 用户 {account.bbs_uid} 登录失效") + f"设备保存(device_save) - 用户 {account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(login_expired=True) if res.json()["message"] != "OK": @@ -679,7 +679,7 @@ async def get_address(account: UserAccount, retry: bool = True) -> Tuple[BaseApi api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"获取地址数据 - 用户 {account.bbs_uid} 登录失效") + f"获取地址数据 - 用户 {account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(login_expired=True), None address_list = list(map(Address.parse_obj, api_result.data["list"])) @@ -1362,28 +1362,28 @@ async def good_exchange(plan: ExchangePlan) -> Tuple[ExchangeStatus, Optional[Ex api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"米游币商品兑换 - 执行兑换: 用户 {plan.account.bbs_uid} 登录失效 - 请求发送时间: {start_time}") + f"米游币商品兑换 - 执行兑换: 用户 {plan.account.display_name} 登录失效 - 请求发送时间: {start_time}") logger.debug(f"网络请求返回: {res.text}") return ExchangeStatus(login_expired=True), None if api_result.success: logger.info( - f"米游币商品兑换: 用户 {plan.account.bbs_uid} 商品 {plan.good.goods_id} 兑换成功!可以自行确认 - 请求发送时间: {start_time}") + f"米游币商品兑换: 用户 {plan.account.display_name} 商品 {plan.good.goods_id} 兑换成功!可以自行确认 - 请求发送时间: {start_time}") logger.debug(f"网络请求返回: {res.text}") return ExchangeStatus(success=True), ExchangeResult(result=True, return_data=res.json(), plan=plan) else: logger.info( - f"米游币商品兑换: 用户 {plan.account.bbs_uid} 商品 {plan.good.goods_id} 兑换失败,可以自行确认 - 请求发送时间: {start_time}") + f"米游币商品兑换: 用户 {plan.account.display_name} 商品 {plan.good.goods_id} 兑换失败,可以自行确认 - 请求发送时间: {start_time}") logger.debug(f"网络请求返回: {res.text}") return ExchangeStatus(success=True), ExchangeResult(result=False, return_data=res.json(), plan=plan) except Exception as e: if is_incorrect_return(e): logger.error( - f"米游币商品兑换: 用户 {plan.account.bbs_uid} 商品 {plan.good.goods_id} 服务器没有正确返回 - 请求发送时间: {start_time}") + f"米游币商品兑换: 用户 {plan.account.display_name} 商品 {plan.good.goods_id} 服务器没有正确返回 - 请求发送时间: {start_time}") logger.debug(f"网络请求返回: {res.text}") return ExchangeStatus(incorrect_return=True), None else: logger.exception( - f"米游币商品兑换: 用户 {plan.account.bbs_uid} 商品 {plan.good.goods_id} 请求失败 - 请求发送时间: {start_time}") + f"米游币商品兑换: 用户 {plan.account.display_name} 商品 {plan.good.goods_id} 请求失败 - 请求发送时间: {start_time}") return ExchangeStatus(network_error=True), None @@ -1421,28 +1421,28 @@ def good_exchange_sync(plan: ExchangePlan) -> Tuple[ExchangeStatus, Optional[Exc api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"米游币商品兑换 - 执行兑换: 用户 {plan.account.bbs_uid} 登录失效 - 请求发送时间: {start_time}") + f"米游币商品兑换 - 执行兑换: 用户 {plan.account.display_name} 登录失效 - 请求发送时间: {start_time}") logger.debug(f"网络请求返回: {res.text}") return ExchangeStatus(login_expired=True), None if api_result.success: logger.info( - f"米游币商品兑换: 用户 {plan.account.bbs_uid} 商品 {plan.good.goods_id} 兑换成功!可以自行确认 - 请求发送时间: {start_time}") + f"米游币商品兑换: 用户 {plan.account.display_name} 商品 {plan.good.goods_id} 兑换成功!可以自行确认 - 请求发送时间: {start_time}") logger.debug(f"网络请求返回: {res.text}") return ExchangeStatus(success=True), ExchangeResult(result=True, return_data=res.json(), plan=plan) else: logger.info( - f"米游币商品兑换: 用户 {plan.account.bbs_uid} 商品 {plan.good.goods_id} 兑换失败,可以自行确认 - 请求发送时间: {start_time}") + f"米游币商品兑换: 用户 {plan.account.display_name} 商品 {plan.good.goods_id} 兑换失败,可以自行确认 - 请求发送时间: {start_time}") logger.debug(f"网络请求返回: {res.text}") return ExchangeStatus(success=True), ExchangeResult(result=False, return_data=res.json(), plan=plan) except Exception as e: if is_incorrect_return(e): logger.error( - f"米游币商品兑换: 用户 {plan.account.bbs_uid} 商品 {plan.good.goods_id} 服务器没有正确返回 - 请求发送时间: {start_time}") + f"米游币商品兑换: 用户 {plan.account.display_name} 商品 {plan.good.goods_id} 服务器没有正确返回 - 请求发送时间: {start_time}") logger.debug(f"网络请求返回: {res.text}") return ExchangeStatus(incorrect_return=True), None else: logger.exception( - f"米游币商品兑换: 用户 {plan.account.bbs_uid} 商品 {plan.good.goods_id} 请求失败 - 请求发送时间: {start_time}") + f"米游币商品兑换: 用户 {plan.account.display_name} 商品 {plan.good.goods_id} 请求失败 - 请求发送时间: {start_time}") return ExchangeStatus(network_error=True), None @@ -1491,17 +1491,17 @@ async def genshin_note(account: UserAccount) -> Tuple[ api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"原神实时便笺: 用户 {account.bbs_uid} 登录失效") + f"原神实时便笺: 用户 {account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return GenshinNoteStatus(login_expired=True), None if api_result.invalid_ds: logger.info( - f"原神实时便笺: 用户 {account.bbs_uid} DS 校验失败") + f"原神实时便笺: 用户 {account.display_name} DS 校验失败") logger.debug(f"网络请求返回: {res.text}") if api_result.retcode == 1034: logger.info( - f"原神实时便笺: 用户 {account.bbs_uid} 可能被验证码阻拦") + f"原神实时便笺: 用户 {account.display_name} 可能被验证码阻拦") logger.debug(f"网络请求返回: {res.text}") if not api_result.success: headers["DS"] = generate_ds() @@ -1568,17 +1568,17 @@ async def starrail_note(account: UserAccount) -> Tuple[ api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"崩铁实时便笺: 用户 {account.bbs_uid} 登录失效") + f"崩铁实时便笺: 用户 {account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return StarRailNoteStatus(login_expired=True), None if api_result.invalid_ds: logger.info( - f"崩铁实时便笺: 用户 {account.bbs_uid} DS 校验失败") + f"崩铁实时便笺: 用户 {account.display_name} DS 校验失败") logger.debug(f"网络请求返回: {res.text}") if api_result.retcode == 1034: logger.info( - f"崩铁实时便笺: 用户 {account.bbs_uid} 可能被验证码阻拦") + f"崩铁实时便笺: 用户 {account.display_name} 可能被验证码阻拦") logger.debug(f"网络请求返回: {res.text}") return StarRailNoteStatus(success=True), StarRailNote.parse_obj(api_result.data) except tenacity.RetryError as e: diff --git a/src/nonebot_plugin_mystool/api/game_sign_api.py b/src/nonebot_plugin_mystool/api/game_sign_api.py index 834e3fb0..f3c5771c 100644 --- a/src/nonebot_plugin_mystool/api/game_sign_api.py +++ b/src/nonebot_plugin_mystool/api/game_sign_api.py @@ -115,12 +115,12 @@ async def get_info( api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"获取签到数据 - 用户 {self.account.bbs_uid} 登录失效") + f"获取签到数据 - 用户 {self.account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(login_expired=True), None if api_result.invalid_ds: logger.info( - f"获取签到数据 - 用户 {self.account.bbs_uid} DS 校验失败") + f"获取签到数据 - 用户 {self.account.display_name} DS 校验失败") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(invalid_ds=True), None return BaseApiStatus(success=True), GameSignInfo.parse_obj(api_result.data) @@ -193,21 +193,21 @@ async def sign(self, api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"游戏签到 - 用户 {self.account.bbs_uid} 登录失效") + f"游戏签到 - 用户 {self.account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(login_expired=True), None elif api_result.invalid_ds: logger.info( - f"游戏签到 - 用户 {self.account.bbs_uid} DS 校验失败") + f"游戏签到 - 用户 {self.account.display_name} DS 校验失败") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(invalid_ds=True), None elif api_result.data.get("risk_code") != 0: logger.warning( - f"{plugin_config.preference.log_head}游戏签到 - 用户 {self.account.bbs_uid} 可能被人机验证阻拦") + f"{plugin_config.preference.log_head}游戏签到 - 用户 {self.account.display_name} 可能被人机验证阻拦") logger.debug(f"{plugin_config.preference.log_head}网络请求返回: {res.text}") return BaseApiStatus(need_verify=True), MmtData.parse_obj(api_result.data) else: - logger.success(f"游戏签到 - 用户 {self.account.bbs_uid} 签到成功") + logger.success(f"游戏签到 - 用户 {self.account.display_name} 签到成功") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(success=True), None diff --git a/src/nonebot_plugin_mystool/api/myb_missions_api.py b/src/nonebot_plugin_mystool/api/myb_missions_api.py index deebe5f1..db90b8d2 100644 --- a/src/nonebot_plugin_mystool/api/myb_missions_api.py +++ b/src/nonebot_plugin_mystool/api/myb_missions_api.py @@ -134,17 +134,17 @@ async def sign(self, retry: bool = True) -> Tuple[MissionStatus, Optional[int]]: api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.error( - f"米游币任务 - 讨论区签到: 用户 {self.account.bbs_uid} 登录失效") + f"米游币任务 - 讨论区签到: 用户 {self.account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return MissionStatus(login_expired=True), None elif api_result.invalid_ds: logger.error( - f"米游币任务 - 讨论区签到: 用户 {self.account.bbs_uid} DS 校验失败") + f"米游币任务 - 讨论区签到: 用户 {self.account.display_name} DS 校验失败") logger.debug(f"网络请求返回: {res.text}") return MissionStatus(invalid_ds=True), None elif api_result.retcode == 1034: logger.error( - f"米游币任务 - 讨论区签到: 用户 {self.account.bbs_uid} 需要完成人机验证") + f"米游币任务 - 讨论区签到: 用户 {self.account.display_name} 需要完成人机验证") logger.debug(f"网络请求返回: {res.text}") if plugin_config.preference.geetest_url: create_status, mmt_data = await create_verification(self.account) @@ -152,15 +152,15 @@ async def sign(self, retry: bool = True) -> Tuple[MissionStatus, Optional[int]]: if geetest_result := await get_validate(mmt_data.gt, mmt_data.challenge): if await verify_verification(mmt_data, geetest_result, self.account): logger.success( - f"米游币任务 - 讨论区签到: 用户 {self.account.bbs_uid} 人机验证通过") + f"米游币任务 - 讨论区签到: 用户 {self.account.display_name} 人机验证通过") continue else: logger.info( - f"米游币任务 - 讨论区签到: 用户 {self.account.bbs_uid} 未配置极验人机验证打码平台") + f"米游币任务 - 讨论区签到: 用户 {self.account.display_name} 未配置极验人机验证打码平台") return MissionStatus(need_verify=True), None elif api_result.retcode == 1008: logger.warning( - f"米游币任务 - 讨论区签到: 用户 {self.account.bbs_uid} 今日已经签到过了") + f"米游币任务 - 讨论区签到: 用户 {self.account.display_name} 今日已经签到过了") logger.debug(f"网络请求返回: {res.text}") return MissionStatus(success=True, already_signed=True), 0 return MissionStatus(success=True), api_result.data["points"] @@ -236,12 +236,12 @@ async def read(self, read_times: int = 5, retry: bool = True) -> MissionStatus: api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"米游币任务 - 阅读: 用户 {self.account.bbs_uid} 登录失效") + f"米游币任务 - 阅读: 用户 {self.account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return MissionStatus(login_expired=True) if api_result.invalid_ds: logger.info( - f"米游币任务 - 阅读: 用户 {self.account.bbs_uid} DS 校验失败") + f"米游币任务 - 阅读: 用户 {self.account.display_name} DS 校验失败") logger.debug(f"网络请求返回: {res.text}") return MissionStatus(invalid_ds=True) if api_result.message == "帖子不存在": @@ -297,12 +297,12 @@ async def like(self, like_times: int = 10, retry: bool = True) -> MissionStatus: api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"米游币任务 - 点赞: 用户 {self.account.bbs_uid} 登录失效") + f"米游币任务 - 点赞: 用户 {self.account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return MissionStatus(login_expired=True) if api_result.invalid_ds: logger.info( - f"米游币任务 - 点赞: 用户 {self.account.bbs_uid} DS 校验失败") + f"米游币任务 - 点赞: 用户 {self.account.display_name} DS 校验失败") logger.debug(f"网络请求返回: {res.text}") return MissionStatus(invalid_ds=True) if api_result.message == "帖子不存在": @@ -351,12 +351,12 @@ async def share(self, retry: bool = True): api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"米游币任务 - 分享: 用户 {self.account.bbs_uid} 登录失效") + f"米游币任务 - 分享: 用户 {self.account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return MissionStatus(login_expired=True) if api_result.invalid_ds: logger.info( - f"米游币任务 - 分享: 用户 {self.account.bbs_uid} DS 校验失败") + f"米游币任务 - 分享: 用户 {self.account.display_name} DS 校验失败") logger.debug(f"网络请求返回: {res.text}") return MissionStatus(invalid_ds=True) if api_result.message == "帖子不存在": @@ -466,7 +466,7 @@ async def get_missions(account: UserAccount, retry: bool = True) -> Tuple[BaseAp api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"获取米游币任务列表: 用户 {account.bbs_uid} 登录失效") + f"获取米游币任务列表: 用户 {account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(login_expired=True), None mission_list: List[MissionData] = [] @@ -503,7 +503,7 @@ async def get_missions_state(account: UserAccount, retry: bool = True) -> Tuple[ api_result = ApiResultHandler(res.json()) if api_result.login_expired: logger.info( - f"获取米游币任务完成情况: 用户 {account.bbs_uid} 登录失效") + f"获取米游币任务完成情况: 用户 {account.display_name} 登录失效") logger.debug(f"网络请求返回: {res.text}") return BaseApiStatus(login_expired=True), None state_dict = {} diff --git a/src/nonebot_plugin_mystool/command/address.py b/src/nonebot_plugin_mystool/command/address.py index d701dadf..1b44406c 100644 --- a/src/nonebot_plugin_mystool/command/address.py +++ b/src/nonebot_plugin_mystool/command/address.py @@ -63,7 +63,7 @@ async def _(event: Union[GeneralPrivateMessageEvent], state: T_State, bbs_uid=Ar state['address_list'] = address_list if not address_status: if address_status.login_expired: - await address_matcher.finish(f"⚠️账户 {account.bbs_uid} 登录失效,请重新登录") + await address_matcher.finish(f"⚠️账户 {account.display_name} 登录失效,请重新登录") await address_matcher.finish("⚠️获取失败,请稍后重新尝试") if address_list: @@ -96,6 +96,6 @@ async def _(_: Union[GeneralPrivateMessageEvent], state: T_State, address_id=Arg account: UserAccount = state["account"] account.address = address PluginDataManager.write_plugin_data() - await address_matcher.finish(f"🎉已成功设置账户 {account.bbs_uid} 的地址") + await address_matcher.finish(f"🎉已成功设置账户 {account.display_name} 的地址") else: await address_matcher.reject("⚠️您发送的地址ID与查询结果不匹配,请重新发送") diff --git a/src/nonebot_plugin_mystool/command/exchange.py b/src/nonebot_plugin_mystool/command/exchange.py index 21e515c7..6027a2ef 100644 --- a/src/nonebot_plugin_mystool/command/exchange.py +++ b/src/nonebot_plugin_mystool/command/exchange.py @@ -122,7 +122,7 @@ async def _( f"\n- 🔢商品ID:{good.goods_id}" \ f"\n- 💰商品价格:{good.price} 米游币" \ f"\n- 📅兑换时间:{good.time_text}" \ - f"\n- 🆔账户:{plan.account.bbs_uid}" + f"\n- 🆔账户:{plan.account.display_name}" msg += "\n\n" if not msg: msg = '您还没有兑换计划哦~\n\n' @@ -264,7 +264,7 @@ async def _( else: user.exchange_plans.add(plan) if not plan.account.device_fp: - logger.info(f"账号 {plan.account.bbs_uid} 未设置 device_fp,正在获取...") + logger.info(f"账号 {plan.account.display_name} 未设置 device_fp,正在获取...") fp_status, plan.account.device_fp = await get_device_fp(plan.account.device_id_ios) if not fp_status: await matcher.send( @@ -385,7 +385,7 @@ def exchange_notice(event: JobExecutionEvent): loop.create_task( send_private_msg( user_id=_user_id, - message=f"⚠️账户 {plan.account.bbs_uid}" + message=f"⚠️账户 {plan.account.display_name}" f"\n- {plan.good.general_name}" f"\n- 线程 {thread_id}" f"\n- 兑换请求发送失败" @@ -409,7 +409,7 @@ def exchange_notice(event: JobExecutionEvent): loop.create_task( send_private_msg( user_id=_user_id, - message=f"🎉账户 {plan.account.bbs_uid}" + message=f"🎉账户 {plan.account.display_name}" f"\n- {plan.good.general_name}" f"\n- 线程 {thread_id}" f"\n- 兑换成功" @@ -421,7 +421,7 @@ def exchange_notice(event: JobExecutionEvent): loop.create_task( send_private_msg( user_id=_user_id, - message=f"💦账户 {plan.account.bbs_uid}" + message=f"💦账户 {plan.account.display_name}" f"\n- {plan.good.general_name}" f"\n- 线程 {thread_id}" f"\n- 兑换失败" diff --git a/src/nonebot_plugin_mystool/command/plan.py b/src/nonebot_plugin_mystool/command/plan.py index e927d816..3bd4925c 100644 --- a/src/nonebot_plugin_mystool/command/plan.py +++ b/src/nonebot_plugin_mystool/command/plan.py @@ -227,12 +227,12 @@ async def perform_game_sign( game_record_status, records = await get_game_record(account) if not game_record_status: if matcher: - await matcher.send(f"⚠️账户 {account.bbs_uid} 获取游戏账号信息失败,请重新尝试") + await matcher.send(f"⚠️账户 {account.display_name} 获取游戏账号信息失败,请重新尝试") else: for user_id in user_ids: await send_private_msg( user_id=user_id, - message=f"⚠️账户 {account.bbs_uid} 获取游戏账号信息失败,请重新尝试" + message=f"⚠️账户 {account.display_name} 获取游戏账号信息失败,请重新尝试" ) continue games_has_record = [] @@ -245,12 +245,12 @@ async def perform_game_sign( get_info_status, info = await signer.get_info(account.platform) if not get_info_status: if matcher: - await matcher.send(f"⚠️账户 {account.bbs_uid} 获取签到记录失败") + await matcher.send(f"⚠️账户 {account.display_name} 获取签到记录失败") else: for user_id in user_ids: await send_private_msg( user_id=user_id, - message=f"⚠️账户 {account.bbs_uid} 获取签到记录失败" + message=f"⚠️账户 {account.display_name} 获取签到记录失败" ) else: signed = info.is_sign @@ -267,12 +267,12 @@ async def perform_game_sign( if not sign_status and (user.enable_notice or matcher): if sign_status.login_expired: - message = f"⚠️账户 {account.bbs_uid} 🎮『{signer.name}』签到时服务器返回登录失效,请尝试重新登录绑定账户" + message = f"⚠️账户 {account.display_name} 🎮『{signer.name}』签到时服务器返回登录失效,请尝试重新登录绑定账户" elif sign_status.need_verify: - message = (f"⚠️账户 {account.bbs_uid} 🎮『{signer.name}』签到时可能遇到验证码拦截," + message = (f"⚠️账户 {account.display_name} 🎮『{signer.name}』签到时可能遇到验证码拦截," "请尝试使用命令『/账号设置』更改设备平台,若仍失败请手动前往米游社签到") else: - message = f"⚠️账户 {account.bbs_uid} 🎮『{signer.name}』签到失败,请稍后再试" + message = f"⚠️账户 {account.display_name} 🎮『{signer.name}』签到失败,请稍后再试" if matcher: await matcher.send(message) elif user.enable_notice: @@ -289,12 +289,12 @@ async def perform_game_sign( get_info_status, info = await signer.get_info(account.platform) get_award_status, awards = await signer.get_rewards() if not get_info_status or not get_award_status: - msg = f"⚠️账户 {account.bbs_uid} 🎮『{signer.name}』获取签到结果失败!请手动前往米游社查看" + msg = f"⚠️账户 {account.display_name} 🎮『{signer.name}』获取签到结果失败!请手动前往米游社查看" else: award = awards[info.total_sign_day - 1] if info.is_sign: status = "签到成功!" if not signed else "已经签到过了" - msg = f"🪪账户 {account.bbs_uid}" \ + msg = f"🪪账户 {account.display_name}" \ f"\n🎮『{signer.name}』" \ f"\n🎮状态: {status}" \ f"\n{signer.record.nickname}·{signer.record.level}" \ @@ -305,7 +305,7 @@ async def perform_game_sign( onebot_img_msg = OneBotV11MessageSegment.image(img_file) qq_guild_img_msg = QQGuildMessageSegment.file_image(img_file) else: - msg = (f"⚠️账户 {account.bbs_uid} 🎮『{signer.name}』签到失败!请尝试重新签到," + msg = (f"⚠️账户 {account.display_name} 🎮『{signer.name}』签到失败!请尝试重新签到," "若多次失败请尝试重新登录绑定账户") if matcher: try: @@ -329,12 +329,12 @@ async def perform_game_sign( if not games_has_record: if matcher: - await matcher.send(f"⚠️您的米游社账户 {account.bbs_uid} 下不存在任何游戏账号,已跳过签到") + await matcher.send(f"⚠️您的米游社账户 {account.display_name} 下不存在任何游戏账号,已跳过签到") else: for user_id in user_ids: await send_private_msg( user_id=user_id, - message=f"⚠️您的米游社账户 {account.bbs_uid} 下不存在任何游戏账号,已跳过签到" + message=f"⚠️您的米游社账户 {account.display_name} 下不存在任何游戏账号,已跳过签到" ) # 如果全部登录失效,则关闭通知 @@ -361,20 +361,20 @@ async def perform_bbs_sign(user: UserData, user_ids: Iterable[str], matcher: Mat if not missions_state_status: if missions_state_status.login_expired: if matcher: - await matcher.send(f'⚠️账户 {account.bbs_uid} 登录失效,请重新登录') + await matcher.send(f'⚠️账户 {account.display_name} 登录失效,请重新登录') else: for user_id in user_ids: await send_private_msg( user_id=user_id, - message=f'⚠️账户 {account.bbs_uid} 登录失效,请重新登录' + message=f'⚠️账户 {account.display_name} 登录失效,请重新登录' ) if matcher: - await matcher.send(f'⚠️账户 {account.bbs_uid} 获取任务完成情况请求失败,你可以手动前往App查看') + await matcher.send(f'⚠️账户 {account.display_name} 获取任务完成情况请求失败,你可以手动前往App查看') else: for user_id in user_ids: await send_private_msg( user_id=user_id, - message=f'⚠️账户 {account.bbs_uid} 获取任务完成情况请求失败,你可以手动前往App查看' + message=f'⚠️账户 {account.display_name} 获取任务完成情况请求失败,你可以手动前往App查看' ) continue myb_before_mission = missions_state.current_myb @@ -387,11 +387,11 @@ async def perform_bbs_sign(user: UserData, user_ids: Iterable[str], matcher: Mat if not class_type: if matcher: await matcher.send( - f'⚠️🆔账户 {account.bbs_uid} 米游币任务目标分区『{class_name}』未找到,将跳过该分区') + f'⚠️🆔账户 {account.display_name} 米游币任务目标分区『{class_name}』未找到,将跳过该分区') continue mission_obj = class_type(account) if matcher: - await matcher.send(f'🆔账户 {account.bbs_uid} ⏳开始在分区『{class_type.name}』执行米游币任务...') + await matcher.send(f'🆔账户 {account.display_name} ⏳开始在分区『{class_type.name}』执行米游币任务...') # 执行任务 sign_status, read_status, like_status, share_status = ( @@ -413,7 +413,7 @@ async def perform_bbs_sign(user: UserData, user_ids: Iterable[str], matcher: Mat if matcher: await matcher.send( - f"🆔账户 {account.bbs_uid} 🎮『{class_type.name}』米游币任务执行情况:\n" + f"🆔账户 {account.display_name} 🎮『{class_type.name}』米游币任务执行情况:\n" f"📅签到:{'✓' if sign_status else '✕'} +{sign_points or '0'} 米游币🪙\n" f"📰阅读:{'✓' if read_status else '✕'}\n" f"❤️点赞:{'✓' if like_status else '✕'}\n" @@ -426,22 +426,22 @@ async def perform_bbs_sign(user: UserData, user_ids: Iterable[str], matcher: Mat if not missions_state_status: if missions_state_status.login_expired: if matcher: - await matcher.send(f'⚠️账户 {account.bbs_uid} 登录失效,请重新登录') + await matcher.send(f'⚠️账户 {account.display_name} 登录失效,请重新登录') else: for user_id in user_ids: await send_private_msg( user_id=user_id, - message=f'⚠️账户 {account.bbs_uid} 登录失效,请重新登录' + message=f'⚠️账户 {account.display_name} 登录失效,请重新登录' ) continue if matcher: await matcher.send( - f'⚠️账户 {account.bbs_uid} 获取任务完成情况请求失败,你可以手动前往App查看') + f'⚠️账户 {account.display_name} 获取任务完成情况请求失败,你可以手动前往App查看') else: for user_id in user_ids: await send_private_msg( user_id=user_id, - message=f'⚠️账户 {account.bbs_uid} 获取任务完成情况请求失败,你可以手动前往App查看' + message=f'⚠️账户 {account.display_name} 获取任务完成情况请求失败,你可以手动前往App查看' ) continue if all(current == mission.threshold for mission, current in missions_state.state_dict.values()): @@ -450,7 +450,7 @@ async def perform_bbs_sign(user: UserData, user_ids: Iterable[str], matcher: Mat notice_string = "⚠️今日米游币任务未全部完成" msg = f"{notice_string}" \ - f"\n🆔账户 {account.bbs_uid}" + f"\n🆔账户 {account.display_name}" for key_name, (mission, current) in missions_state.state_dict.items(): if key_name == BaseMission.SIGN: mission_name = "📅签到" @@ -494,12 +494,12 @@ async def genshin_note_check(user: UserData, user_ids: Iterable[str], matcher: M if not genshin_board_status: if matcher: if genshin_board_status.login_expired: - await matcher.send(f'⚠️账户 {account.bbs_uid} 登录失效,请重新登录') + await matcher.send(f'⚠️账户 {account.display_name} 登录失效,请重新登录') elif genshin_board_status.no_genshin_account: - await matcher.send(f'⚠️账户 {account.bbs_uid} 没有绑定任何原神账户,请绑定后再重试') + await matcher.send(f'⚠️账户 {account.display_name} 没有绑定任何原神账户,请绑定后再重试') elif genshin_board_status.need_verify: - await matcher.send(f'⚠️账户 {account.bbs_uid} 获取实时便笺时被人机验证阻拦') - await matcher.send(f'⚠️账户 {account.bbs_uid} 获取实时便笺请求失败,你可以手动前往App查看') + await matcher.send(f'⚠️账户 {account.display_name} 获取实时便笺时被人机验证阻拦') + await matcher.send(f'⚠️账户 {account.display_name} 获取实时便笺请求失败,你可以手动前往App查看') continue msg = '' @@ -551,7 +551,7 @@ async def genshin_note_check(user: UserData, user_ids: Iterable[str], matcher: M return msg += "❖原神·实时便笺❖" \ - f"\n🆔账户 {account.bbs_uid}" \ + f"\n🆔账户 {account.display_name}" \ f"\n⏳树脂数量:{note.current_resin} / 160" \ f"\n⏱️树脂{note.resin_recovery_text}" \ f"\n🕰️探索派遣:{note.current_expedition_num} / {note.max_expedition_num}" \ @@ -581,12 +581,12 @@ async def starrail_note_check(user: UserData, user_ids: Iterable[str], matcher: if not starrail_board_status: if matcher: if starrail_board_status.login_expired: - await matcher.send(f'⚠️账户 {account.bbs_uid} 登录失效,请重新登录') + await matcher.send(f'⚠️账户 {account.display_name} 登录失效,请重新登录') elif starrail_board_status.no_starrail_account: - await matcher.send(f'⚠️账户 {account.bbs_uid} 没有绑定任何星铁账户,请绑定后再重试') + await matcher.send(f'⚠️账户 {account.display_name} 没有绑定任何星铁账户,请绑定后再重试') elif starrail_board_status.need_verify: - await matcher.send(f'⚠️账户 {account.bbs_uid} 获取实时便笺时被人机验证阻拦') - await matcher.send(f'⚠️账户 {account.bbs_uid} 获取实时便笺请求失败,你可以手动前往App查看') + await matcher.send(f'⚠️账户 {account.display_name} 获取实时便笺时被人机验证阻拦') + await matcher.send(f'⚠️账户 {account.display_name} 获取实时便笺请求失败,你可以手动前往App查看') continue msg = '' @@ -638,7 +638,7 @@ async def starrail_note_check(user: UserData, user_ids: Iterable[str], matcher: return msg += "❖星穹铁道·实时便笺❖" \ - f"\n🆔账户 {account.bbs_uid}" \ + f"\n🆔账户 {account.display_name}" \ f"\n⏳开拓力数量:{note.current_stamina} / {note.max_stamina}" \ f"\n⏱开拓力{note.stamina_recover_text}" \ f"\n📒每日实训:{note.current_train_score} / {note.max_train_score}" \ From cd96ba76bbeea5e17f9d32f212cf7a89d6178f27 Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:32:59 +0800 Subject: [PATCH 09/19] =?UTF-8?q?fix(command):=20=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E9=81=97=E6=BC=8F=E7=9A=84=20account.display=5Fname=20?= =?UTF-8?q?=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #242 --- src/nonebot_plugin_mystool/command/setting.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nonebot_plugin_mystool/command/setting.py b/src/nonebot_plugin_mystool/command/setting.py index d9881ce6..40ed74d6 100644 --- a/src/nonebot_plugin_mystool/command/setting.py +++ b/src/nonebot_plugin_mystool/command/setting.py @@ -57,7 +57,7 @@ async def _(event: Union[GeneralMessageEvent], matcher: Matcher, state: T_State) state["bbs_uid"] = uid else: msg = "您有多个账号,您要更改以下哪个账号的设置?\n" - msg += "\n".join(map(lambda x: f"🆔{x}", user_account)) + msg += "\n".join(map(lambda x: f"🆔{x.display_name}", user_account)) msg += "\n🚪发送“退出”即可退出" await matcher.send(msg) @@ -154,11 +154,11 @@ async def _(event: Union[GeneralMessageEvent], state: T_State, setting_id=ArgStr return elif setting_id == '7': state["prepare_to_delete"] = True - await account_setting.reject(f"⚠️确认删除账号 {account.phone_number} ?发送 \"确认删除\" 以确定。") + await account_setting.reject(f"⚠️确认删除账号 {account.display_name} ?发送 \"确认删除\" 以确定。") elif setting_id == '确认删除' and state["prepare_to_delete"]: user_account.pop(account.bbs_uid) PluginDataManager.write_plugin_data() - await account_setting.finish(f"已删除账号 {account.phone_number} 的数据") + await account_setting.finish(f"已删除账号 {account.display_name} 的数据") else: await account_setting.reject("⚠️您的输入有误,请重新输入") From f2859ee2d735744c056519d26cbd2089984d65d3 Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Wed, 24 Jan 2024 16:22:43 +0800 Subject: [PATCH 10/19] =?UTF-8?q?fix(command):=20=E4=BF=AE=E5=A4=8D=20Attr?= =?UTF-8?q?ibuteError:=20'str'=20object=20has=20no=20attribute=20'display?= =?UTF-8?q?=5Fname'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #242 --- src/nonebot_plugin_mystool/command/setting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nonebot_plugin_mystool/command/setting.py b/src/nonebot_plugin_mystool/command/setting.py index 40ed74d6..4ceb4665 100644 --- a/src/nonebot_plugin_mystool/command/setting.py +++ b/src/nonebot_plugin_mystool/command/setting.py @@ -57,7 +57,7 @@ async def _(event: Union[GeneralMessageEvent], matcher: Matcher, state: T_State) state["bbs_uid"] = uid else: msg = "您有多个账号,您要更改以下哪个账号的设置?\n" - msg += "\n".join(map(lambda x: f"🆔{x.display_name}", user_account)) + msg += "\n".join(map(lambda x: f"🆔{x.display_name}", user_account.values())) msg += "\n🚪发送“退出”即可退出" await matcher.send(msg) From a293f480804702dbfeafc5e723d717bb673f46b1 Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Wed, 24 Jan 2024 16:27:18 +0800 Subject: [PATCH 11/19] build: version bump --- pyproject.toml | 2 +- src/nonebot_plugin_mystool/_version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f7f67e0b..6e7324c1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nonebot-plugin-mystool" -version = "v2.0.0-beta.1" +version = "v2.0.1-beta.1" description = "QQ聊天、频道机器人插件 | 米游社工具-每日米游币任务、游戏签到、商品兑换、免抓包登录、原神崩铁便笺提醒" license = "MIT" authors = [ diff --git a/src/nonebot_plugin_mystool/_version.py b/src/nonebot_plugin_mystool/_version.py index 983c70ce..afdfdefa 100644 --- a/src/nonebot_plugin_mystool/_version.py +++ b/src/nonebot_plugin_mystool/_version.py @@ -1 +1 @@ -__version__ = "v2.0.0-beta.1" +__version__ = "v2.0.1-beta.1" From bf3806390a17e4a7826257a6a43a0ac21e2dac96 Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Wed, 24 Jan 2024 16:42:14 +0800 Subject: [PATCH 12/19] =?UTF-8?q?docs:=20=E5=A2=9E=E5=8A=A0=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 894c0006..782f206e 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,18 @@ ## 📣 更新内容 +### 2024.1.24 - v2.0.1-beta.1 + +- 更新插件配置的 `preference.github_proxy` 默认值为 `https://mirror.ghproxy.com/` + > [!NOTE] + > `preference.github_proxy` 用于使用代理以更快地从 GitHub 下载 Source Han Sans 思源黑体 字体。 \ + > 只有新生成的配置文件会使用新默认值,对于之前创建的配置文件,如果想使用新默认值则需要手动修改。 + +- 显示米游社账号时除了显示米游社UID,还会显示登录时获取到的手机尾号4位,方便辨识账号 (#242) + > [!IMPORTANT] + > 目前还在考虑是否需要通过一个用户设置选项,来控制是否显示手机尾号,并默认关闭,以保护用户隐私 \ + > 如果觉得有必要可以在 Discussion 讨论页面 的对应话题提出。 + ### 2024.1.23 - v2.0.0-beta.1 - 项目结构重构,解决了开发时容易出现循环导入 (circular import) 之类的问题,结束了之前的混乱。~~虽然可能还是很乱(~~ :octocat: From 8e88483f2d0130bb5f4b2e734936136408a0dcf3 Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Wed, 24 Jan 2024 16:52:39 +0800 Subject: [PATCH 13/19] docs: fix indent [skip ci] --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 782f206e..68ffab79 100644 --- a/README.md +++ b/README.md @@ -17,14 +17,14 @@ ### 2024.1.24 - v2.0.1-beta.1 - 更新插件配置的 `preference.github_proxy` 默认值为 `https://mirror.ghproxy.com/` - > [!NOTE] - > `preference.github_proxy` 用于使用代理以更快地从 GitHub 下载 Source Han Sans 思源黑体 字体。 \ - > 只有新生成的配置文件会使用新默认值,对于之前创建的配置文件,如果想使用新默认值则需要手动修改。 +> [!NOTE] +> `preference.github_proxy` 用于使用代理以更快地从 GitHub 下载 Source Han Sans 思源黑体 字体。 \ +> 只有新生成的配置文件会使用新默认值,对于之前创建的配置文件,如果想使用新默认值则需要手动修改。 - 显示米游社账号时除了显示米游社UID,还会显示登录时获取到的手机尾号4位,方便辨识账号 (#242) - > [!IMPORTANT] - > 目前还在考虑是否需要通过一个用户设置选项,来控制是否显示手机尾号,并默认关闭,以保护用户隐私 \ - > 如果觉得有必要可以在 Discussion 讨论页面 的对应话题提出。 +> [!IMPORTANT] +> 目前还在考虑是否需要通过一个用户设置选项,来控制是否显示手机尾号,并默认关闭,以保护用户隐私 \ +> 如果觉得有必要可以在 Discussion 讨论页面 的对应话题提出。 ### 2024.1.23 - v2.0.0-beta.1 From 72e8547d1bc88c57c3cb969aea278cbb4911405f Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Sun, 28 Jan 2024 11:29:06 +0800 Subject: [PATCH 14/19] build: version bump --- pyproject.toml | 2 +- src/nonebot_plugin_mystool/_version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6e7324c1..b60c1c5e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nonebot-plugin-mystool" -version = "v2.0.1-beta.1" +version = "v2.0.1" description = "QQ聊天、频道机器人插件 | 米游社工具-每日米游币任务、游戏签到、商品兑换、免抓包登录、原神崩铁便笺提醒" license = "MIT" authors = [ diff --git a/src/nonebot_plugin_mystool/_version.py b/src/nonebot_plugin_mystool/_version.py index afdfdefa..659f38d7 100644 --- a/src/nonebot_plugin_mystool/_version.py +++ b/src/nonebot_plugin_mystool/_version.py @@ -1 +1 @@ -__version__ = "v2.0.1-beta.1" +__version__ = "v2.0.1" From 056c7ecda651b73175923458872d810b0460240a Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Sun, 28 Jan 2024 11:30:46 +0800 Subject: [PATCH 15/19] =?UTF-8?q?docs:=20=E5=A2=9E=E5=8A=A0=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e62e1a41..3f6ebb82 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ ## 📣 更新内容 -### 2024.1.24 - [v2.0.1-beta.1](https://github.com/Ljzd-PRO/nonebot-plugin-mystool/releases/tag/v2.0.1-beta.1) +### 2024.1.28 - v2.0.1 - 更新插件配置的 `preference.github_proxy` 默认值为 `https://mirror.ghproxy.com/` > [!NOTE] From d94cf835bbe5f5f77aa42113d1fa0cab8dedf6ff Mon Sep 17 00:00:00 2001 From: Ljzd PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Sat, 27 Jan 2024 18:05:24 +0800 Subject: [PATCH 16/19] =?UTF-8?q?build:=20=E6=9B=B4=E6=96=B0=E9=82=AE?= =?UTF-8?q?=E7=AE=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit cd27a63c453abfdf14fd6accc0ec097525527c61) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b60c1c5e..9fd5918d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ version = "v2.0.1" description = "QQ聊天、频道机器人插件 | 米游社工具-每日米游币任务、游戏签到、商品兑换、免抓包登录、原神崩铁便笺提醒" license = "MIT" authors = [ - "Ljzd-PRO ", + "Ljzd-PRO ", "Everything0519 <598139245@qq.com>" ] readme = "README.md" From 1507a531b18af0b0f709539869473457db9a9196 Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Sun, 28 Jan 2024 11:32:15 +0800 Subject: [PATCH 17/19] =?UTF-8?q?build:=20=E6=9B=B4=E6=96=B0pydantic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9fd5918d..5bd9380e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ nonebot-adapter-onebot = "^2.3.1" nonebot-adapter-qq = "^1.1.2" tenacity = "^8.2.3" qrcode = "^7.4.2" -pydantic = "^1.10.0" +pydantic = "^1.10.14" nonebot2 = ">=2.0.0" pytz = "^2023.3.post1" From 3c7400bb0d52aefc4aa0ce242e3b038c0bf7ead3 Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Mon, 29 Jan 2024 21:55:21 +0800 Subject: [PATCH 18/19] =?UTF-8?q?fix(model):=20=E4=BF=AE=E5=A4=8D=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E4=B8=8D=E4=BC=9A=E4=B8=BB=E5=8A=A8=E5=88=9B=E5=BB=BA?= =?UTF-8?q?data=E7=9B=AE=E5=BD=95=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #250 --- src/nonebot_plugin_mystool/model/config.py | 1 + src/nonebot_plugin_mystool/model/data.py | 1 + 2 files changed, 2 insertions(+) diff --git a/src/nonebot_plugin_mystool/model/config.py b/src/nonebot_plugin_mystool/model/config.py index 7f24b31c..1524b38d 100644 --- a/src/nonebot_plugin_mystool/model/config.py +++ b/src/nonebot_plugin_mystool/model/config.py @@ -243,6 +243,7 @@ class Config(BaseSettings.Config): plugin_config = PluginConfig() try: str_data = plugin_config.json(indent=4) + plugin_config_path.parent.mkdir(parents=True, exist_ok=True) with open(plugin_config_path, "w", encoding="utf-8") as f: f.write(str_data) except (AttributeError, TypeError, ValueError, PermissionError): diff --git a/src/nonebot_plugin_mystool/model/data.py b/src/nonebot_plugin_mystool/model/data.py index e9384a7c..f6a072cb 100644 --- a/src/nonebot_plugin_mystool/model/data.py +++ b/src/nonebot_plugin_mystool/model/data.py @@ -475,6 +475,7 @@ def load_plugin_data(cls): cls.plugin_data = PluginData() try: str_data = cls.plugin_data.json(indent=4) + plugin_data_path.parent.mkdir(parents=True, exist_ok=True) with open(plugin_data_path, "w", encoding="utf-8") as f: f.write(str_data) except (AttributeError, TypeError, ValueError, PermissionError): From 8aad2f9a7865f65450711d42f4dc7b12bf7857cf Mon Sep 17 00:00:00 2001 From: Ljzd PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Mon, 29 Jan 2024 22:04:34 +0800 Subject: [PATCH 19/19] =?UTF-8?q?docs:=20=E5=A2=9E=E5=8A=A0=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3f6ebb82..fe4fe0b5 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ ### 2024.1.28 - v2.0.1 +- 修复插件无法自动创建 `data` 目录以创建配置文件和数据文件的问题 (v2.0.1) + - 更新插件配置的 `preference.github_proxy` 默认值为 `https://mirror.ghproxy.com/` > [!NOTE] > `preference.github_proxy` 用于使用代理以更快地从 GitHub 下载 Source Han Sans 思源黑体 字体。 \