From 50aaaff6a55514a4ce5f3446a7ade7fa8fdc4c62 Mon Sep 17 00:00:00 2001 From: joseandluue Date: Sat, 20 Jul 2024 14:28:39 +0800 Subject: [PATCH 01/24] =?UTF-8?q?feat:=20=E5=AE=9E=E6=97=B6=E4=BE=BF?= =?UTF-8?q?=E7=AC=BA=E6=A0=B9=E6=8D=AE=E5=8F=AF=E7=AD=BE=E5=88=B0=E7=9A=84?= =?UTF-8?q?=E6=B8=B8=E6=88=8F=E8=BF=9B=E8=A1=8C=E8=87=AA=E5=8A=A8=E6=8E=A8?= =?UTF-8?q?=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/command/plan.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nonebot_plugin_mystool/command/plan.py b/src/nonebot_plugin_mystool/command/plan.py index b40dfd2d..f525f504 100644 --- a/src/nonebot_plugin_mystool/command/plan.py +++ b/src/nonebot_plugin_mystool/command/plan.py @@ -498,7 +498,7 @@ async def genshin_note_check(user: UserData, user_ids: Iterable[str], matcher: M for account in user.accounts.values(): note_notice_status.setdefault(account.bbs_uid, NoteNoticeStatus()) genshin_notice = note_notice_status[account.bbs_uid].genshin - if account.enable_resin or matcher: + if (account.enable_resin and 'GenshinImpact' in account.game_sign_games) or matcher: genshin_board_status, note = await genshin_note(account) if not genshin_board_status: if matcher: @@ -586,7 +586,7 @@ async def starrail_note_check(user: UserData, user_ids: Iterable[str], matcher: for account in user.accounts.values(): note_notice_status.setdefault(account.bbs_uid, NoteNoticeStatus()) starrail_notice = note_notice_status[account.bbs_uid].starrail - if account.enable_resin or matcher: + if (account.enable_resin and 'StarRail' in account.game_sign_games) or matcher: starrail_board_status, note = await starrail_note(account) if not starrail_board_status: if matcher: From 25a88d01bbc719ab95c6b13535dd9ca42030ab7e Mon Sep 17 00:00:00 2001 From: joseandluue Date: Mon, 22 Jul 2024 13:56:59 +0800 Subject: [PATCH 02/24] =?UTF-8?q?feat:=20=E7=BE=A4=E8=81=8A=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E7=AD=BE=E5=88=B0=E4=BD=BF=E7=94=A8=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/command/plan.py | 23 ++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/nonebot_plugin_mystool/command/plan.py b/src/nonebot_plugin_mystool/command/plan.py index f525f504..b0a5effb 100644 --- a/src/nonebot_plugin_mystool/command/plan.py +++ b/src/nonebot_plugin_mystool/command/plan.py @@ -4,7 +4,7 @@ from nonebot import on_command, get_adapters from nonebot.adapters.onebot.v11 import MessageSegment as OneBotV11MessageSegment, Adapter as OneBotV11Adapter, \ - MessageEvent as OneBotV11MessageEvent + MessageEvent as OneBotV11MessageEvent, Bot from nonebot.adapters.qq import MessageSegment as QQGuildMessageSegment, Adapter as QQGuildAdapter, \ MessageEvent as QQGuildMessageEvent from nonebot.adapters.qq.exception import AuditException @@ -44,11 +44,12 @@ @manually_game_sign.handle() -async def _(event: Union[GeneralMessageEvent], matcher: Matcher, command_arg=CommandArg()): +async def _(bot:Bot, event: Union[GeneralMessageEvent], matcher: Matcher, command_arg=CommandArg()): """ 手动游戏签到函数 """ user_id = event.get_user_id() + logger.info(f'event:{type(event)}|{event}') user = PluginDataManager.plugin_data.users.get(user_id) if not user or not user.accounts: await manually_game_sign.finish(f"⚠️你尚未绑定米游社账户,请先使用『{COMMAND_BEGIN}登录』进行登录") @@ -62,6 +63,7 @@ async def _(event: Union[GeneralMessageEvent], matcher: Matcher, command_arg=Com for user_id_, user_ in get_unique_users(): await manually_game_sign.send(f"⏳开始为用户 {user_id_} 执行游戏签到...") await perform_game_sign( + bot=bot, user=user_, user_ids=[], matcher=matcher, @@ -73,6 +75,7 @@ async def _(event: Union[GeneralMessageEvent], matcher: Matcher, command_arg=Com await manually_game_sign.finish(f"⚠️未找到用户 {specified_user_id}") await manually_game_sign.send(f"⏳开始为用户 {specified_user_id} 执行游戏签到...") await perform_game_sign( + bot=bot, user=specified_user, user_ids=[], matcher=matcher, @@ -80,7 +83,7 @@ async def _(event: Union[GeneralMessageEvent], matcher: Matcher, command_arg=Com ) else: await manually_game_sign.send("⏳开始游戏签到...") - await perform_game_sign(user=user, user_ids=[user_id], matcher=matcher, event=event) + await perform_game_sign(bot=bot, user=user, user_ids=[user_id], matcher=matcher, event=event) manually_bbs_sign = on_command(plugin_config.preference.command_start + '任务', priority=5, block=True) @@ -210,6 +213,7 @@ async def perform_game_sign( user: UserData, user_ids: Iterable[str], matcher: Matcher = None, + bot: Bot = None , event: Union[GeneralMessageEvent] = None ): """ @@ -239,6 +243,7 @@ async def perform_game_sign( ) continue games_has_record = [] + msgs_list = [] for class_type in BaseGameSign.available_game_signs: signer = class_type(account, records) if not signer.has_record: @@ -316,7 +321,10 @@ async def perform_game_sign( if matcher: try: if isinstance(event, OneBotV11MessageEvent): - await matcher.send(msg + onebot_img_msg) + if event.group_id: + msgs_list.append(msg + onebot_img_msg) + else: + await matcher.send(msg + onebot_img_msg) elif isinstance(event, QQGuildMessageEvent): await matcher.send(msg) await matcher.send(qq_guild_img_msg) @@ -332,6 +340,13 @@ async def perform_game_sign( await send_private_msg(use=adapter, user_id=user_id, message=msg) await send_private_msg(use=adapter, user_id=user_id, message=qq_guild_img_msg) await asyncio.sleep(plugin_config.preference.sleep_time) + if msgs_list: #在群聊触发游戏签到将使用合并消息 + def build_forward_msg(msg): + return {"type": "node", "data": {"nickname": "流萤", "user_id": "114514", "content": msg}} + #受限于LLOnebot,合并转发消息只能使用bot的身份无法自定义 + messages = [build_forward_msg(msg) for msg in msgs_list] + await bot.call_api("send_group_msg", group_id=event.group_id, message={"type": "at","data": {"qq": event.user_id}}) + await bot.call_api("send_group_forward_msg", group_id=event.group_id, messages=messages) if not games_has_record: if matcher: From 4c6f58873242b42c7395f44de50119a2328e4f9b Mon Sep 17 00:00:00 2001 From: joseandluue Date: Wed, 24 Jul 2024 09:42:39 +0800 Subject: [PATCH 03/24] =?UTF-8?q?fix:=20=E6=B8=B8=E6=88=8F=E7=AD=BE?= =?UTF-8?q?=E5=88=B0=E7=BE=A4=E8=81=8A=E5=90=88=E5=B9=B6=E6=B6=88=E6=81=AF?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/command/plan.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/nonebot_plugin_mystool/command/plan.py b/src/nonebot_plugin_mystool/command/plan.py index b0a5effb..639bb17e 100644 --- a/src/nonebot_plugin_mystool/command/plan.py +++ b/src/nonebot_plugin_mystool/command/plan.py @@ -4,7 +4,8 @@ from nonebot import on_command, get_adapters from nonebot.adapters.onebot.v11 import MessageSegment as OneBotV11MessageSegment, Adapter as OneBotV11Adapter, \ - MessageEvent as OneBotV11MessageEvent, Bot + MessageEvent as OneBotV11MessageEvent, GroupMessageEvent as OneBotV11GroupMessageEvent, \ + PrivateMessageEvent as OneBotV11PrivateMessageEvent, Bot from nonebot.adapters.qq import MessageSegment as QQGuildMessageSegment, Adapter as QQGuildAdapter, \ MessageEvent as QQGuildMessageEvent from nonebot.adapters.qq.exception import AuditException @@ -231,10 +232,11 @@ async def perform_game_sign( continue signed = False """是否已经完成过签到""" + msgs_list = [] game_record_status, records = await get_game_record(account) if not game_record_status: if matcher: - await matcher.send(f"⚠️账户 {account.display_name} 获取游戏账号信息失败,请重新尝试") + await matcher.send(f"⚠️账户 {account.display_name} 获取游戏账号信息失败,请重新尝试", at_sender=True) else: for user_id in user_ids: await send_private_msg( @@ -243,7 +245,7 @@ async def perform_game_sign( ) continue games_has_record = [] - msgs_list = [] + for class_type in BaseGameSign.available_game_signs: signer = class_type(account, records) if not signer.has_record: @@ -255,7 +257,7 @@ 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.display_name} 获取签到记录失败") + await matcher.send(f"⚠️账户 {account.display_name} 获取签到记录失败", at_sender=True) else: for user_id in user_ids: await send_private_msg( @@ -284,7 +286,10 @@ async def perform_game_sign( else: message = f"⚠️账户 {account.display_name} 🎮『{signer.name}』签到失败,请稍后再试" if matcher: - await matcher.send(message) + if isinstance(event, OneBotV11GroupMessageEvent): + msgs_list.append(message) + else: + await matcher.send(message) elif user.enable_notice: for user_id in user_ids: await send_private_msg(user_id=user_id, message=message) @@ -321,7 +326,7 @@ async def perform_game_sign( if matcher: try: if isinstance(event, OneBotV11MessageEvent): - if event.group_id: + if isinstance(event, OneBotV11GroupMessageEvent): msgs_list.append(msg + onebot_img_msg) else: await matcher.send(msg + onebot_img_msg) @@ -342,10 +347,10 @@ async def perform_game_sign( await asyncio.sleep(plugin_config.preference.sleep_time) if msgs_list: #在群聊触发游戏签到将使用合并消息 def build_forward_msg(msg): - return {"type": "node", "data": {"nickname": "流萤", "user_id": "114514", "content": msg}} #受限于LLOnebot,合并转发消息只能使用bot的身份无法自定义 + return {"type": "node", "data": {"nickname": "流萤", "user_id": "114514", "content": msg}} messages = [build_forward_msg(msg) for msg in msgs_list] - await bot.call_api("send_group_msg", group_id=event.group_id, message={"type": "at","data": {"qq": event.user_id}}) + await bot.call_api("send_group_msg", group_id=event.group_id, message={"type": "at","data": {"qq": str(event.user_id)}}) await bot.call_api("send_group_forward_msg", group_id=event.group_id, messages=messages) if not games_has_record: From 27aa30a294253996986cde6535f61c933b53a657 Mon Sep 17 00:00:00 2001 From: joseandluue Date: Thu, 25 Jul 2024 13:46:24 +0800 Subject: [PATCH 04/24] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=BD=93?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=B8=8D=E5=A1=AB=E5=86=99geetset=5Fparams?= =?UTF-8?q?=E6=97=B6=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/utils/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nonebot_plugin_mystool/utils/common.py b/src/nonebot_plugin_mystool/utils/common.py index c1a085d4..66b4a110 100644 --- a/src/nonebot_plugin_mystool/utils/common.py +++ b/src/nonebot_plugin_mystool/utils/common.py @@ -247,13 +247,13 @@ async def get_validate(user: UserData, gt: str = None, challenge: str = None, re return GeetestResult("", "") geetest_url = user.geetest_url params = {"gt": gt, "challenge": challenge} - params.update(user.geetest_params) + params.update(user.geetest_params or {}) else: if not (gt and challenge) or not plugin_config.preference.geetest_url: return GeetestResult("", "") geetest_url = plugin_config.preference.geetest_url params = {"gt": gt, "challenge": challenge} - params.update(plugin_config.preference.geetest_params) + params.update(plugin_config.preference.geetest_params or {}) content = deepcopy(plugin_config.preference.geetest_json or Preference().geetest_json) for key, value in content.items(): if isinstance(value, str): From dedbeedfcc1b611b5463c89671455708b07ead69 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 00:50:35 +0000 Subject: [PATCH 05/24] build(deps): bump nonebot-adapter-qq from 1.4.4 to 1.5.0 Bumps [nonebot-adapter-qq](https://github.com/nonebot/adapter-qq) from 1.4.4 to 1.5.0. - [Release notes](https://github.com/nonebot/adapter-qq/releases) - [Commits](https://github.com/nonebot/adapter-qq/compare/v1.4.4...v1.5.0) --- updated-dependencies: - dependency-name: nonebot-adapter-qq dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- poetry.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index d240a245..d54577f6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -491,13 +491,13 @@ typing-extensions = ">=4.0.0,<5.0.0" [[package]] name = "nonebot-adapter-qq" -version = "1.4.4" +version = "1.5.0" description = "QQ adapter for nonebot2" optional = false -python-versions = "<4.0,>=3.8" +python-versions = "<4.0,>=3.9" files = [ - {file = "nonebot_adapter_qq-1.4.4-py3-none-any.whl", hash = "sha256:238aea3f94a54907be426ebb402893882893dbdc15e9e603106c6399b5d26a7f"}, - {file = "nonebot_adapter_qq-1.4.4.tar.gz", hash = "sha256:258beebf06da2b699c792a8c86a8f41f2cb44cf2b8544678a24cdd2543ad57c6"}, + {file = "nonebot_adapter_qq-1.5.0-py3-none-any.whl", hash = "sha256:27e6bcbc733d41102c085c844008aa5f2651a5cb1b9f17a3972bb5548ee0b695"}, + {file = "nonebot_adapter_qq-1.5.0.tar.gz", hash = "sha256:1f46389389f99b19d1447c6032a34d6a7c0d1876468b63152e2ec68c3a042e29"}, ] [package.dependencies] From 2bac9b7c4010eb581ae76ce13900507e2273e0f0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Jul 2024 00:44:07 +0000 Subject: [PATCH 06/24] build(deps): bump tenacity from 8.5.0 to 9.0.0 Bumps [tenacity](https://github.com/jd/tenacity) from 8.5.0 to 9.0.0. - [Release notes](https://github.com/jd/tenacity/releases) - [Commits](https://github.com/jd/tenacity/compare/8.5.0...9.0.0) --- updated-dependencies: - dependency-name: tenacity dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- poetry.lock | 8 ++++---- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/poetry.lock b/poetry.lock index d240a245..32fb3c04 100644 --- a/poetry.lock +++ b/poetry.lock @@ -881,13 +881,13 @@ test = ["pylint", "pytest", "pytest-black", "pytest-cov", "pytest-pylint"] [[package]] name = "tenacity" -version = "8.5.0" +version = "9.0.0" description = "Retry code until it succeeds" optional = false python-versions = ">=3.8" files = [ - {file = "tenacity-8.5.0-py3-none-any.whl", hash = "sha256:b594c2a5945830c267ce6b79a166228323ed52718f30302c1359836112346687"}, - {file = "tenacity-8.5.0.tar.gz", hash = "sha256:8bc6c0c8a09b31e6cad13c47afbed1a567518250a9a171418582ed8d9c20ca78"}, + {file = "tenacity-9.0.0-py3-none-any.whl", hash = "sha256:93de0c98785b27fcf659856aa9f54bfbd399e29969b0621bc7f762bd441b4539"}, + {file = "tenacity-9.0.0.tar.gz", hash = "sha256:807f37ca97d62aa361264d497b0e31e92b8027044942bfa756160d908320d73b"}, ] [package.extras] @@ -1081,4 +1081,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = ">=3.9,<4.0" -content-hash = "9ba988eb3ad8918c68ad06068eae5f604ee2806cac60ed88cf144b13455260fc" +content-hash = "455d33bae3d892c5625ded999c015e465120af83fe5a468cb8c1a2e00ac84fd1" diff --git a/pyproject.toml b/pyproject.toml index 5943784c..ccb5041d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ Pillow = ">=9.5,<11.0" requests = "^2.31.0" nonebot-adapter-onebot = "^2.3.1" nonebot-adapter-qq = "^1.1.2" -tenacity = "^8.2.3" +tenacity = ">=8.2.3,<10.0.0" qrcode = "^7.4.2" pydantic = "^1.10.14" nonebot2 = ">=2.0.0" From 923f8960754b5e732d7f56d3eba92b6ab69c3d38 Mon Sep 17 00:00:00 2001 From: joseandluue Date: Wed, 31 Jul 2024 09:57:59 +0800 Subject: [PATCH 07/24] =?UTF-8?q?fix:=E6=88=AA=E5=8F=96=E8=B6=85=E8=AF=9Di?= =?UTF-8?q?d=E7=9A=84=E6=AD=A3=E5=88=99=E5=85=AC=E5=BC=8F=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/api/weibo.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/nonebot_plugin_mystool/api/weibo.py b/src/nonebot_plugin_mystool/api/weibo.py index f4d69fea..c8609e0e 100644 --- a/src/nonebot_plugin_mystool/api/weibo.py +++ b/src/nonebot_plugin_mystool/api/weibo.py @@ -185,13 +185,16 @@ async def format_chaohua_data(data: list): data = [ch for ch in data if ch.get('card_type') == '8'] chaohua_list = [] for onedata in data: - ch_id = re.findall("(?<=containerid=).*?(?=&)", onedata['scheme']) - one_dict = { - 'title_sub': onedata['title_sub'], - 'id': ch_id[0], - 'is_sign': onedata['buttons'][0]['name'] # '已签' / '签到' - } - chaohua_list.append(one_dict) + try: + ch_id = re.findall("(?<=containerid=)[^&]+", onedata['scheme']) + one_dict = { + 'title_sub': onedata.get('title_sub', None), + 'id': ch_id[0] if ch_id else None, + 'is_sign': onedata['buttons'][0]['name'] if onedata.get('buttons') else None # '已签' / '签到' + } + chaohua_list.append(one_dict) + except Exception as e: + logger.error(f"{type(e)}:{e}") return chaohua_list @classmethod From c9f5bea0951965862dddd7ebe77e1f94994fab11 Mon Sep 17 00:00:00 2001 From: joseandluue Date: Wed, 31 Jul 2024 13:54:13 +0800 Subject: [PATCH 08/24] =?UTF-8?q?refactor:=20=E6=89=8B=E5=8A=A8=E6=B8=B8?= =?UTF-8?q?=E6=88=8F=E7=AD=BE=E5=88=B0=E9=80=82=E9=85=8D=E7=BE=A4=E8=81=8A?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E6=B6=88=E6=81=AF=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/command/plan.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/nonebot_plugin_mystool/command/plan.py b/src/nonebot_plugin_mystool/command/plan.py index 639bb17e..6c615ede 100644 --- a/src/nonebot_plugin_mystool/command/plan.py +++ b/src/nonebot_plugin_mystool/command/plan.py @@ -50,10 +50,10 @@ async def _(bot:Bot, event: Union[GeneralMessageEvent], matcher: Matcher, comman 手动游戏签到函数 """ user_id = event.get_user_id() - logger.info(f'event:{type(event)}|{event}') + msgs_list = [] user = PluginDataManager.plugin_data.users.get(user_id) if not user or not user.accounts: - await manually_game_sign.finish(f"⚠️你尚未绑定米游社账户,请先使用『{COMMAND_BEGIN}登录』进行登录") + await manually_game_sign.finish(f"⚠️你尚未绑定米游社账户,请先使用『{COMMAND_BEGIN}登录』进行登录", at_sender=True) if command_arg: if (specified_user_id := str(command_arg)) == "*" or specified_user_id.isdigit(): if user_id not in read_admin_list(): @@ -62,7 +62,7 @@ async def _(bot:Bot, event: Union[GeneralMessageEvent], matcher: Matcher, comman if specified_user_id == "*": await manually_game_sign.send("⏳开始为所有用户执行游戏签到...") for user_id_, user_ in get_unique_users(): - await manually_game_sign.send(f"⏳开始为用户 {user_id_} 执行游戏签到...") + await msgs_list.append(f"⏳开始为用户 {user_id_} 执行游戏签到...") await perform_game_sign( bot=bot, user=user_, @@ -73,8 +73,8 @@ async def _(bot:Bot, event: Union[GeneralMessageEvent], matcher: Matcher, comman else: specified_user = PluginDataManager.plugin_data.users.get(specified_user_id) if not specified_user: - await manually_game_sign.finish(f"⚠️未找到用户 {specified_user_id}") - await manually_game_sign.send(f"⏳开始为用户 {specified_user_id} 执行游戏签到...") + await manually_game_sign.finish(f"⚠️未找到用户 {specified_user_id}", at_sender=True) + await msgs_list.append(f"⏳开始为用户 {specified_user_id} 执行游戏签到...") await perform_game_sign( bot=bot, user=specified_user, @@ -83,8 +83,8 @@ async def _(bot:Bot, event: Union[GeneralMessageEvent], matcher: Matcher, comman event=event ) else: - await manually_game_sign.send("⏳开始游戏签到...") - await perform_game_sign(bot=bot, user=user, user_ids=[user_id], matcher=matcher, event=event) + msgs_list.append("⏳开始游戏签到...") + await perform_game_sign(bot=bot, user=user, user_ids=[user_id], matcher=matcher, event=event, msgs_list=msgs_list) manually_bbs_sign = on_command(plugin_config.preference.command_start + '任务', priority=5, block=True) From cbeaa0f624034b89005ae7f7e2f062976fe2d606 Mon Sep 17 00:00:00 2001 From: joseandluue Date: Wed, 31 Jul 2024 13:58:12 +0800 Subject: [PATCH 09/24] =?UTF-8?q?feat:=20=E7=B1=B3=E6=B8=B8=E7=A4=BE?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E9=80=82=E9=85=8D=E7=BE=A4=E8=81=8A=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/command/plan.py | 56 +++++++++++++++------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/src/nonebot_plugin_mystool/command/plan.py b/src/nonebot_plugin_mystool/command/plan.py index 6c615ede..a95c8b77 100644 --- a/src/nonebot_plugin_mystool/command/plan.py +++ b/src/nonebot_plugin_mystool/command/plan.py @@ -99,23 +99,24 @@ async def _(bot:Bot, event: Union[GeneralMessageEvent], matcher: Matcher, comman @manually_bbs_sign.handle() -async def _(event: Union[GeneralMessageEvent], matcher: Matcher, command_arg=CommandArg()): +async def _(bot:Bot, event: Union[GeneralMessageEvent], matcher: Matcher, command_arg=CommandArg()): """ 手动米游币任务函数 """ user_id = event.get_user_id() user = PluginDataManager.plugin_data.users.get(user_id) + msgs_list = [] if not user or not user.accounts: - await manually_bbs_sign.finish(f"⚠️你尚未绑定米游社账户,请先使用『{COMMAND_BEGIN}登录』进行登录") + await manually_bbs_sign.finish(f"⚠️你尚未绑定米游社账户,请先使用『{COMMAND_BEGIN}登录』进行登录", at_sender=True) if command_arg: if (specified_user_id := str(command_arg)) == "*" or specified_user_id.isdigit(): if user_id not in read_admin_list(): await manually_bbs_sign.finish("⚠️你暂无权限执行此操作,只有管理员名单中的用户可以执行此操作") else: if specified_user_id == "*": - await manually_bbs_sign.send("⏳开始为所有用户执行米游币任务...") + await msgs_list.append("⏳开始为所有用户执行米游币任务...") for user_id_, user_ in get_unique_users(): - await manually_bbs_sign.send(f"⏳开始为用户 {user_id_} 执行米游币任务...") + await msgs_list.append(f"⏳开始为用户 {user_id_} 执行米游币任务...") await perform_bbs_sign( user=user_, user_ids=[], @@ -125,15 +126,15 @@ async def _(event: Union[GeneralMessageEvent], matcher: Matcher, command_arg=Com specified_user = PluginDataManager.plugin_data.users.get(specified_user_id) if not specified_user: await manually_bbs_sign.finish(f"⚠️未找到用户 {specified_user_id}") - await manually_bbs_sign.send(f"⏳开始为用户 {specified_user_id} 执行米游币任务...") + await msgs_list.append(f"⏳开始为用户 {specified_user_id} 执行米游币任务...") await perform_bbs_sign( user=specified_user, user_ids=[], matcher=matcher ) else: - await manually_bbs_sign.send("⏳开始执行米游币任务...") - await perform_bbs_sign(user=user, user_ids=[user_id], matcher=matcher) + msgs_list.append("⏳开始执行米游币任务...") + await perform_bbs_sign(bot=bot, user=user, user_ids=[user_id], matcher=matcher, event=event, msgs_list=msgs_list) class NoteNoticeStatus(BaseModel): @@ -369,7 +370,13 @@ def build_forward_msg(msg): PluginDataManager.write_plugin_data() -async def perform_bbs_sign(user: UserData, user_ids: Iterable[str], matcher: Matcher = None): +async def perform_bbs_sign( + user: UserData, + user_ids: Iterable[str], + matcher: Matcher = None, + bot: Bot = None , + event: Union[GeneralMessageEvent] = None , + msgs_list = None): """ 执行米游币任务函数,并发送给用户任务执行消息。 @@ -387,7 +394,7 @@ 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.display_name} 登录失效,请重新登录') + await matcher.send(f'⚠️账户 {account.display_name} 登录失效,请重新登录', at_sender=True) else: for user_id in user_ids: await send_private_msg( @@ -395,7 +402,7 @@ async def perform_bbs_sign(user: UserData, user_ids: Iterable[str], matcher: Mat message=f'⚠️账户 {account.display_name} 登录失效,请重新登录' ) if matcher: - await matcher.send(f'⚠️账户 {account.display_name} 获取任务完成情况请求失败,你可以手动前往App查看') + await matcher.send(f'⚠️账户 {account.display_name} 获取任务完成情况请求失败,你可以手动前往App查看', at_sender=True) else: for user_id in user_ids: await send_private_msg( @@ -409,18 +416,18 @@ async def perform_bbs_sign(user: UserData, user_ids: Iterable[str], matcher: Mat finished = all(current == mission.threshold for mission, current in missions_state.state_dict.values()) if not finished: if not account.mission_games: - await matcher.send( + msgs_list.append( f'⚠️🆔账户 {account.display_name} 未设置米游币任务目标分区,将跳过执行') for class_name in account.mission_games: class_type = BaseMission.available_games.get(class_name) if not class_type: if matcher: - await matcher.send( + msgs_list.append( f'⚠️🆔账户 {account.display_name} 米游币任务目标分区『{class_name}』未找到,将跳过该分区') continue mission_obj = class_type(account) if matcher: - await matcher.send(f'🆔账户 {account.display_name} ⏳开始在分区『{class_type.name}』执行米游币任务...') + msgs_list.append(f'🆔账户 {account.display_name} ⏳开始在分区『{class_type.name}』执行米游币任务...') # 执行任务 sign_status, read_status, like_status, share_status = ( @@ -441,7 +448,7 @@ async def perform_bbs_sign(user: UserData, user_ids: Iterable[str], matcher: Mat share_status = await mission_obj.share() if matcher: - await matcher.send( + msgs_list.append( f"🆔账户 {account.display_name} 🎮『{class_type.name}』米游币任务执行情况:\n" f"📅签到:{'✓' if sign_status else '✕'} +{sign_points or '0'} 米游币🪙\n" f"📰阅读:{'✓' if read_status else '✕'}\n" @@ -455,7 +462,7 @@ 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.display_name} 登录失效,请重新登录') + msgs_list.append(f'⚠️账户 {account.display_name} 登录失效,请重新登录') else: for user_id in user_ids: await send_private_msg( @@ -464,7 +471,7 @@ async def perform_bbs_sign(user: UserData, user_ids: Iterable[str], matcher: Mat ) continue if matcher: - await matcher.send( + msgs_list.append( f'⚠️账户 {account.display_name} 获取任务完成情况请求失败,你可以手动前往App查看') else: for user_id in user_ids: @@ -496,10 +503,16 @@ async def perform_bbs_sign(user: UserData, user_ids: Iterable[str], matcher: Mat f"\n💰当前米游币: {missions_state.current_myb}" if matcher: - await matcher.send(msg) + msgs_list.append(msg) else: for user_id in user_ids: await send_private_msg(user_id=user_id, message=msg) + + if isinstance(event, OneBotV11GroupMessageEvent): #在群聊触发游戏签到将使用合并消息 + await qqgroup_msg(bot, event, msgs_list) + else: + for msg in msgs_list: + await matcher.send(msg) # 如果全部登录失效,则关闭通知 if len(failed_accounts) == len(user.accounts): @@ -766,6 +779,15 @@ async def weibo_code_check(user: UserData, user_ids: Iterable[str], mode=0, matc await matcher.send(message) +async def qqgroup_msg(bot, event, msgs_list): + def build_forward_msg(msg): + #受限于LLOnebot,合并转发消息只能使用bot的身份无法自定义 + return {"type": "node", "data": {"nickname": "流萤", "user_id": "114514", "content": msg}} + messages = [build_forward_msg(msg) for msg in msgs_list] + await bot.call_api("send_group_msg", group_id=event.group_id, message={"type": "at","data": {"qq": str(event.user_id)}}) + await bot.call_api("send_group_forward_msg", group_id=event.group_id, messages=messages) + + @scheduler.scheduled_job("cron", hour='0', minute='0', id="daily_goodImg_update") def daily_update(): """ From 42cfa6a1bca346460dafbeef9f4c26a83da1b931 Mon Sep 17 00:00:00 2001 From: joseandluue Date: Wed, 31 Jul 2024 14:00:42 +0800 Subject: [PATCH 10/24] =?UTF-8?q?refactor:=20=E5=B0=9D=E8=AF=95=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=89=8B=E5=8A=A8=E6=B8=B8=E6=88=8F=E7=AD=BE=E5=88=B0?= =?UTF-8?q?=E7=A7=81=E8=81=8A=E5=92=8C=E7=BE=A4=E8=81=8A=E7=9A=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/command/plan.py | 33 +++++++++------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/nonebot_plugin_mystool/command/plan.py b/src/nonebot_plugin_mystool/command/plan.py index a95c8b77..45c57db3 100644 --- a/src/nonebot_plugin_mystool/command/plan.py +++ b/src/nonebot_plugin_mystool/command/plan.py @@ -216,7 +216,8 @@ async def perform_game_sign( user_ids: Iterable[str], matcher: Matcher = None, bot: Bot = None , - event: Union[GeneralMessageEvent] = None + event: Union[GeneralMessageEvent] = None , + msgs_list = None ): """ 执行游戏签到函数,并发送给用户签到消息。 @@ -233,11 +234,10 @@ async def perform_game_sign( continue signed = False """是否已经完成过签到""" - msgs_list = [] game_record_status, records = await get_game_record(account) if not game_record_status: if matcher: - await matcher.send(f"⚠️账户 {account.display_name} 获取游戏账号信息失败,请重新尝试", at_sender=True) + msgs_list.append(f"⚠️账户 {account.display_name} 获取游戏账号信息失败,请重新尝试") else: for user_id in user_ids: await send_private_msg( @@ -258,7 +258,7 @@ 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.display_name} 获取签到记录失败", at_sender=True) + msgs_list.append(f"⚠️账户 {account.display_name} 获取签到记录失败") else: for user_id in user_ids: await send_private_msg( @@ -274,7 +274,7 @@ async def perform_game_sign( if sign_status.need_verify: if plugin_config.preference.geetest_url or user.geetest_url: if matcher: - await matcher.send("⏳正在尝试完成人机验证,请稍后...") + msgs_list.append("⏳正在尝试完成人机验证,请稍后...") geetest_result = await get_validate(user, mmt_data.gt, mmt_data.challenge) sign_status, _ = await signer.sign(account.platform, mmt_data, geetest_result) @@ -287,10 +287,7 @@ async def perform_game_sign( else: message = f"⚠️账户 {account.display_name} 🎮『{signer.name}』签到失败,请稍后再试" if matcher: - if isinstance(event, OneBotV11GroupMessageEvent): - msgs_list.append(message) - else: - await matcher.send(message) + msgs_list.append(message) elif user.enable_notice: for user_id in user_ids: await send_private_msg(user_id=user_id, message=message) @@ -327,10 +324,7 @@ async def perform_game_sign( if matcher: try: if isinstance(event, OneBotV11MessageEvent): - if isinstance(event, OneBotV11GroupMessageEvent): - msgs_list.append(msg + onebot_img_msg) - else: - await matcher.send(msg + onebot_img_msg) + msgs_list.append(msg + onebot_img_msg) elif isinstance(event, QQGuildMessageEvent): await matcher.send(msg) await matcher.send(qq_guild_img_msg) @@ -346,13 +340,12 @@ async def perform_game_sign( await send_private_msg(use=adapter, user_id=user_id, message=msg) await send_private_msg(use=adapter, user_id=user_id, message=qq_guild_img_msg) await asyncio.sleep(plugin_config.preference.sleep_time) - if msgs_list: #在群聊触发游戏签到将使用合并消息 - def build_forward_msg(msg): - #受限于LLOnebot,合并转发消息只能使用bot的身份无法自定义 - return {"type": "node", "data": {"nickname": "流萤", "user_id": "114514", "content": msg}} - messages = [build_forward_msg(msg) for msg in msgs_list] - await bot.call_api("send_group_msg", group_id=event.group_id, message={"type": "at","data": {"qq": str(event.user_id)}}) - await bot.call_api("send_group_forward_msg", group_id=event.group_id, messages=messages) + + if isinstance(event, OneBotV11GroupMessageEvent): #在群聊触发游戏签到将使用合并消息 + await qqgroup_msg(bot, event, msgs_list) + else: + for msg in msgs_list: + await matcher.send(msg) if not games_has_record: if matcher: From 0719d6624a9f34ed955ff98fe7284dbe6b87d288 Mon Sep 17 00:00:00 2001 From: joseandluue Date: Wed, 31 Jul 2024 14:17:06 +0800 Subject: [PATCH 11/24] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9=E7=BE=A4?= =?UTF-8?q?=E8=81=8A=E6=8E=A8=E9=80=81=E6=B6=88=E6=81=AF=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/command/plan.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nonebot_plugin_mystool/command/plan.py b/src/nonebot_plugin_mystool/command/plan.py index 45c57db3..fca6c3c5 100644 --- a/src/nonebot_plugin_mystool/command/plan.py +++ b/src/nonebot_plugin_mystool/command/plan.py @@ -342,7 +342,7 @@ async def perform_game_sign( await asyncio.sleep(plugin_config.preference.sleep_time) if isinstance(event, OneBotV11GroupMessageEvent): #在群聊触发游戏签到将使用合并消息 - await qqgroup_msg(bot, event, msgs_list) + await send_qqGroup(bot, event, msgs_list) else: for msg in msgs_list: await matcher.send(msg) @@ -502,7 +502,7 @@ async def perform_bbs_sign( await send_private_msg(user_id=user_id, message=msg) if isinstance(event, OneBotV11GroupMessageEvent): #在群聊触发游戏签到将使用合并消息 - await qqgroup_msg(bot, event, msgs_list) + await send_qqGroup(bot, event, msgs_list) else: for msg in msgs_list: await matcher.send(msg) @@ -772,7 +772,7 @@ async def weibo_code_check(user: UserData, user_ids: Iterable[str], mode=0, matc await matcher.send(message) -async def qqgroup_msg(bot, event, msgs_list): +async def send_qqGroup(bot, event, msgs_list): def build_forward_msg(msg): #受限于LLOnebot,合并转发消息只能使用bot的身份无法自定义 return {"type": "node", "data": {"nickname": "流萤", "user_id": "114514", "content": msg}} From e55b6b0d05923a44bd814c9af9e8daa73c805142 Mon Sep 17 00:00:00 2001 From: jose Date: Sun, 4 Aug 2024 17:38:14 +0800 Subject: [PATCH 12/24] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E4=B8=BB=E5=8A=A8?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=97=B6=E6=B6=88=E6=81=AF=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E6=97=B6=E5=AF=BC=E8=87=B4=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E4=B8=AD=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/command/plan.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/nonebot_plugin_mystool/command/plan.py b/src/nonebot_plugin_mystool/command/plan.py index fca6c3c5..dea7a95a 100644 --- a/src/nonebot_plugin_mystool/command/plan.py +++ b/src/nonebot_plugin_mystool/command/plan.py @@ -341,11 +341,12 @@ async def perform_game_sign( await send_private_msg(use=adapter, user_id=user_id, message=qq_guild_img_msg) await asyncio.sleep(plugin_config.preference.sleep_time) - if isinstance(event, OneBotV11GroupMessageEvent): #在群聊触发游戏签到将使用合并消息 - await send_qqGroup(bot, event, msgs_list) - else: - for msg in msgs_list: - await matcher.send(msg) + if msgs_list: + if isinstance(event, OneBotV11GroupMessageEvent): #在群聊触发游戏签到将使用合并消息 + await send_qqGroup(bot, event, msgs_list) + else: + for msg in msgs_list: + await matcher.send(msg) if not games_has_record: if matcher: @@ -501,11 +502,12 @@ async def perform_bbs_sign( for user_id in user_ids: await send_private_msg(user_id=user_id, message=msg) - if isinstance(event, OneBotV11GroupMessageEvent): #在群聊触发游戏签到将使用合并消息 - await send_qqGroup(bot, event, msgs_list) - else: - for msg in msgs_list: - await matcher.send(msg) + if msgs_list: + if isinstance(event, OneBotV11GroupMessageEvent): #在群聊触发游戏签到将使用合并消息 + await send_qqGroup(bot, event, msgs_list) + else: + for msg in msgs_list: + await matcher.send(msg) # 如果全部登录失效,则关闭通知 if len(failed_accounts) == len(user.accounts): From 7ad5e31f600751455024bfd664dc35ab33f8644c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 00:07:56 +0000 Subject: [PATCH 13/24] build(deps-dev): bump flake8 from 7.0.0 to 7.1.1 Bumps [flake8](https://github.com/pycqa/flake8) from 7.0.0 to 7.1.1. - [Commits](https://github.com/pycqa/flake8/compare/7.0.0...7.1.1) --- updated-dependencies: - dependency-name: flake8 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- poetry.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/poetry.lock b/poetry.lock index b65e2076..40446e33 100644 --- a/poetry.lock +++ b/poetry.lock @@ -198,18 +198,18 @@ files = [ [[package]] name = "flake8" -version = "7.0.0" +version = "7.1.1" description = "the modular source code checker: pep8 pyflakes and co" optional = false python-versions = ">=3.8.1" files = [ - {file = "flake8-7.0.0-py2.py3-none-any.whl", hash = "sha256:a6dfbb75e03252917f2473ea9653f7cd799c3064e54d4c8140044c5c065f53c3"}, - {file = "flake8-7.0.0.tar.gz", hash = "sha256:33f96621059e65eec474169085dc92bf26e7b2d47366b70be2f67ab80dc25132"}, + {file = "flake8-7.1.1-py2.py3-none-any.whl", hash = "sha256:597477df7860daa5aa0fdd84bf5208a043ab96b8e96ab708770ae0364dd03213"}, + {file = "flake8-7.1.1.tar.gz", hash = "sha256:049d058491e228e03e67b390f311bbf88fce2dbaa8fa673e7aea87b7198b8d38"}, ] [package.dependencies] mccabe = ">=0.7.0,<0.8.0" -pycodestyle = ">=2.11.0,<2.12.0" +pycodestyle = ">=2.12.0,<2.13.0" pyflakes = ">=3.2.0,<3.3.0" [[package]] @@ -678,13 +678,13 @@ xmp = ["defusedxml"] [[package]] name = "pycodestyle" -version = "2.11.1" +version = "2.12.1" description = "Python style guide checker" optional = false python-versions = ">=3.8" files = [ - {file = "pycodestyle-2.11.1-py2.py3-none-any.whl", hash = "sha256:44fe31000b2d866f2e41841b18528a505fbd7fef9017b04eff4e2648a0fadc67"}, - {file = "pycodestyle-2.11.1.tar.gz", hash = "sha256:41ba0e7afc9752dfb53ced5489e89f8186be00e599e712660695b7a75ff2663f"}, + {file = "pycodestyle-2.12.1-py2.py3-none-any.whl", hash = "sha256:46f0fb92069a7c28ab7bb558f05bfc0110dac69a0cd23c61ea0040283a9d78b3"}, + {file = "pycodestyle-2.12.1.tar.gz", hash = "sha256:6838eae08bbce4f6accd5d5572075c63626a15ee3e6f842df996bf62f6d73521"}, ] [[package]] From 8b7a83984ebe656e18725db9a1a0bd347b82c8bd Mon Sep 17 00:00:00 2001 From: joseandluue Date: Tue, 6 Aug 2024 15:15:51 +0800 Subject: [PATCH 14/24] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=A2=91?= =?UTF-8?q?=E9=81=93=E7=A7=81=E8=81=8A=E4=B8=8D=E5=93=8D=E5=BA=94=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/command/plan.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/nonebot_plugin_mystool/command/plan.py b/src/nonebot_plugin_mystool/command/plan.py index fca6c3c5..68dec170 100644 --- a/src/nonebot_plugin_mystool/command/plan.py +++ b/src/nonebot_plugin_mystool/command/plan.py @@ -2,7 +2,7 @@ import threading from typing import Union, Optional, Iterable, Dict -from nonebot import on_command, get_adapters +from nonebot import on_command, get_adapters, get_bot from nonebot.adapters.onebot.v11 import MessageSegment as OneBotV11MessageSegment, Adapter as OneBotV11Adapter, \ MessageEvent as OneBotV11MessageEvent, GroupMessageEvent as OneBotV11GroupMessageEvent, \ PrivateMessageEvent as OneBotV11PrivateMessageEvent, Bot @@ -45,10 +45,11 @@ @manually_game_sign.handle() -async def _(bot:Bot, event: Union[GeneralMessageEvent], matcher: Matcher, command_arg=CommandArg()): +async def _(event: Union[GeneralMessageEvent], matcher: Matcher, command_arg=CommandArg()): """ 手动游戏签到函数 """ + bot = get_bot() user_id = event.get_user_id() msgs_list = [] user = PluginDataManager.plugin_data.users.get(user_id) @@ -99,10 +100,11 @@ async def _(bot:Bot, event: Union[GeneralMessageEvent], matcher: Matcher, comman @manually_bbs_sign.handle() -async def _(bot:Bot, event: Union[GeneralMessageEvent], matcher: Matcher, command_arg=CommandArg()): +async def _(event: Union[GeneralMessageEvent], matcher: Matcher, command_arg=CommandArg()): """ 手动米游币任务函数 """ + bot = get_bot() user_id = event.get_user_id() user = PluginDataManager.plugin_data.users.get(user_id) msgs_list = [] @@ -215,7 +217,7 @@ async def perform_game_sign( user: UserData, user_ids: Iterable[str], matcher: Matcher = None, - bot: Bot = None , + bot: Optional[Bot] = None , event: Union[GeneralMessageEvent] = None , msgs_list = None ): @@ -367,7 +369,7 @@ async def perform_bbs_sign( user: UserData, user_ids: Iterable[str], matcher: Matcher = None, - bot: Bot = None , + bot: Optional[Bot] = None , event: Union[GeneralMessageEvent] = None , msgs_list = None): """ From 8bb942a04ad61d5914247b007fdd7fe470ee5e30 Mon Sep 17 00:00:00 2001 From: Ljzd PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Sat, 10 Aug 2024 14:18:41 +0800 Subject: [PATCH 15/24] =?UTF-8?q?fix:=20=E8=A1=A5=E5=85=85=20await?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/command/login.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nonebot_plugin_mystool/command/login.py b/src/nonebot_plugin_mystool/command/login.py index 9c556262..e818aad5 100644 --- a/src/nonebot_plugin_mystool/command/login.py +++ b/src/nonebot_plugin_mystool/command/login.py @@ -93,7 +93,7 @@ async def handle_first_receive(event: Union[GeneralMessageEvent]): logger.success(f"用户 {bbs_uid} 成功获取 game_token: {game_token}") break elif login_status.qrcode_expired: - get_cookie.finish("⚠️二维码已过期,登录失败") + await get_cookie.finish("⚠️二维码已过期,登录失败") elif not login_status: await asyncio.sleep(plugin_config.preference.qrcode_query_interval) continue @@ -153,7 +153,7 @@ async def handle_first_receive(event: Union[GeneralMessageEvent]): account.cookies.update(cookies) PluginDataManager.write_plugin_data() else: - get_cookie.finish("⚠️获取二维码扫描状态超时,请尝试重新登录") + await get_cookie.finish("⚠️获取二维码扫描状态超时,请尝试重新登录") if not login_status: notice_text = "⚠️登录失败:" From dd2f0a78bfebec0697a6f8a458fa7b0bc23b3dd0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 00:55:52 +0000 Subject: [PATCH 16/24] build(deps): bump nonebot2 from 2.3.2 to 2.3.3 Bumps [nonebot2](https://github.com/nonebot/nonebot2) from 2.3.2 to 2.3.3. - [Release notes](https://github.com/nonebot/nonebot2/releases) - [Changelog](https://github.com/nonebot/nonebot2/blob/master/CHANGELOG.md) - [Commits](https://github.com/nonebot/nonebot2/compare/v2.3.2...v2.3.3) --- updated-dependencies: - dependency-name: nonebot2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 40446e33..35e33ffa 100644 --- a/poetry.lock +++ b/poetry.lock @@ -542,13 +542,13 @@ strenum = ">=0.4.8,<0.5.0" [[package]] name = "nonebot2" -version = "2.3.2" +version = "2.3.3" description = "An asynchronous python bot framework." optional = false python-versions = "<4.0,>=3.9" files = [ - {file = "nonebot2-2.3.2-py3-none-any.whl", hash = "sha256:c51aa3c1f23d8062ce6d13c8423dcb9a8bf0c44f21687916095f825da79a9a55"}, - {file = "nonebot2-2.3.2.tar.gz", hash = "sha256:af52e27e03e7fe147f2b642151eec81f264d058efe53b974eb08b5d90177cd14"}, + {file = "nonebot2-2.3.3-py3-none-any.whl", hash = "sha256:5bc8d073091347f29c4a1a2f927c24a8941e5d286c77139376259318b9bbfc68"}, + {file = "nonebot2-2.3.3.tar.gz", hash = "sha256:4fa7707de5d708c27cc49493bc78a07fee2ba01f5516835a2ea5fbebb49b9dfa"}, ] [package.dependencies] From 6d808f6515139450e672483deb6ad527bb2fbb3b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 00:56:04 +0000 Subject: [PATCH 17/24] build(deps): bump nonebot-plugin-send-anything-anywhere Bumps [nonebot-plugin-send-anything-anywhere](https://github.com/nonepkg/nonebot-plugin-all4one) from 0.6.1 to 0.7.1. - [Release notes](https://github.com/nonepkg/nonebot-plugin-all4one/releases) - [Commits](https://github.com/nonepkg/nonebot-plugin-all4one/commits) --- updated-dependencies: - dependency-name: nonebot-plugin-send-anything-anywhere dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- poetry.lock | 12 ++++++------ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/poetry.lock b/poetry.lock index 40446e33..7e255913 100644 --- a/poetry.lock +++ b/poetry.lock @@ -524,19 +524,19 @@ pydantic = ">=1.10.0,<2.5.0 || >2.5.0,<2.5.1 || >2.5.1,<3.0.0" [[package]] name = "nonebot-plugin-send-anything-anywhere" -version = "0.6.1" +version = "0.7.1" description = "An adaptor for nonebot2 adaptors" optional = false -python-versions = "<4.0,>=3.8" +python-versions = "<4.0,>=3.9" files = [ - {file = "nonebot_plugin_send_anything_anywhere-0.6.1-py3-none-any.whl", hash = "sha256:d1ac0df520f950b61ff27d3abda39c4bb2023797f3b7df2a23517ad53f3a7f29"}, - {file = "nonebot_plugin_send_anything_anywhere-0.6.1.tar.gz", hash = "sha256:89a695c5e356a423b8641f79082353b50ee431585988de2c2ae77f8ea00ac3e9"}, + {file = "nonebot_plugin_send_anything_anywhere-0.7.1-py3-none-any.whl", hash = "sha256:b52044272be9a7bc77bd7a53ef700481c071fd4e889ae21a0411d0df22d13c16"}, + {file = "nonebot_plugin_send_anything_anywhere-0.7.1.tar.gz", hash = "sha256:ec9c7ba59c824238b812950146a894acc88ca8da98f500de15217feebcd5e868"}, ] [package.dependencies] anyio = ">=3.3.0,<5.0.0" filetype = ">=1.2.0,<2.0.0" -nonebot2 = ">=2.0.0,<3.0.0" +nonebot2 = ">=2.3.0,<3.0.0" pydantic = ">=1.10.0,<2.5.0 || >2.5.0,<2.5.1 || >2.5.1,<3.0.0" strenum = ">=0.4.8,<0.5.0" @@ -1081,4 +1081,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = ">=3.9,<4.0" -content-hash = "455d33bae3d892c5625ded999c015e465120af83fe5a468cb8c1a2e00ac84fd1" +content-hash = "97934919b5c8444fce8e43215f3660bd0769fc217629480a08417bdbe4434ea9" diff --git a/pyproject.toml b/pyproject.toml index ccb5041d..c960dc6f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ packages = [ python = ">=3.9,<4.0" httpx = ">=0.24.1,<0.28.0" nonebot_plugin_apscheduler = ">=0.2.0" -nonebot-plugin-send-anything-anywhere = ">=0.5,<0.7" +nonebot-plugin-send-anything-anywhere = ">=0.5,<0.8" ntplib = "^0.4.0" Pillow = ">=9.5,<11.0" requests = "^2.31.0" From b8002fd98886258d16d8696219dcde516766e639 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 00:56:16 +0000 Subject: [PATCH 18/24] build(deps): bump nonebot-adapter-qq from 1.5.0 to 1.5.1 Bumps [nonebot-adapter-qq](https://github.com/nonebot/adapter-qq) from 1.5.0 to 1.5.1. - [Release notes](https://github.com/nonebot/adapter-qq/releases) - [Commits](https://github.com/nonebot/adapter-qq/compare/v1.5.0...v1.5.1) --- updated-dependencies: - dependency-name: nonebot-adapter-qq dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 40446e33..f5aa2e32 100644 --- a/poetry.lock +++ b/poetry.lock @@ -491,13 +491,13 @@ typing-extensions = ">=4.0.0,<5.0.0" [[package]] name = "nonebot-adapter-qq" -version = "1.5.0" +version = "1.5.1" description = "QQ adapter for nonebot2" optional = false python-versions = "<4.0,>=3.9" files = [ - {file = "nonebot_adapter_qq-1.5.0-py3-none-any.whl", hash = "sha256:27e6bcbc733d41102c085c844008aa5f2651a5cb1b9f17a3972bb5548ee0b695"}, - {file = "nonebot_adapter_qq-1.5.0.tar.gz", hash = "sha256:1f46389389f99b19d1447c6032a34d6a7c0d1876468b63152e2ec68c3a042e29"}, + {file = "nonebot_adapter_qq-1.5.1-py3-none-any.whl", hash = "sha256:d98a264087e2e92024673cbbefc963804b4a85b680599d9bebc5d3c606c8cd22"}, + {file = "nonebot_adapter_qq-1.5.1.tar.gz", hash = "sha256:02cd9c6204fa8a711569fd59fd518826fb484a3ad5bcb45868a754091005a6ea"}, ] [package.dependencies] From b7e17b6d032966b95a000e656d059824f31762f4 Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Mon, 19 Aug 2024 21:28:52 +0800 Subject: [PATCH 19/24] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BA=8C?= =?UTF-8?q?=E7=BB=B4=E7=A0=81=E7=99=BB=E5=BD=95=E6=8F=90=E7=A4=BA=E5=B7=B2?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=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 #357 --- src/nonebot_plugin_mystool/api/common.py | 2 +- src/nonebot_plugin_mystool/model/config.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nonebot_plugin_mystool/api/common.py b/src/nonebot_plugin_mystool/api/common.py index 42af57eb..4e53130f 100644 --- a/src/nonebot_plugin_mystool/api/common.py +++ b/src/nonebot_plugin_mystool/api/common.py @@ -1688,7 +1688,7 @@ async def verify_verification( async def fetch_game_token_qrcode( device_id: str, - app_id: str = "1", + app_id: str, retry: bool = True ) -> Tuple[BaseApiStatus, Optional[Tuple[str, str]]]: """ diff --git a/src/nonebot_plugin_mystool/model/config.py b/src/nonebot_plugin_mystool/model/config.py index 3abd7e46..cd93ad68 100644 --- a/src/nonebot_plugin_mystool/model/config.py +++ b/src/nonebot_plugin_mystool/model/config.py @@ -97,8 +97,8 @@ class Preference(BaseModel): """是否启用管理员名单""" admin_list_path: Optional[Path] = data_path / "admin_list.txt" """管理员名单文件路径""" - game_token_app_id: str = "1" - """米游社二维码登录的应用标识符(可用的任何值都没有区别,但是必须传递此参数)""" + game_token_app_id: str = "2" + """米游社二维码登录的应用标识符""" qrcode_query_interval: float = 1 """检查米游社登录二维码扫描情况的请求间隔(单位:秒)""" qrcode_wait_time: float = 120 From 77ad00ceac8d816340320629cc5a5261c06cee6b Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Mon, 19 Aug 2024 21:39:08 +0800 Subject: [PATCH 20/24] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #349 --- src/nonebot_plugin_mystool/api/myb_missions_api.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/nonebot_plugin_mystool/api/myb_missions_api.py b/src/nonebot_plugin_mystool/api/myb_missions_api.py index d0b19827..862bec64 100644 --- a/src/nonebot_plugin_mystool/api/myb_missions_api.py +++ b/src/nonebot_plugin_mystool/api/myb_missions_api.py @@ -151,12 +151,20 @@ async def sign(self, user: UserData, retry: bool = True) -> Tuple[MissionStatus, logger.debug(f"网络请求返回: {res.text}") if plugin_config.preference.geetest_url or user.geetest_url: create_status, mmt_data = await create_verification(self.account) + logger.debug( + f"米游币任务 - 讨论区签到: " + f"用户 {self.account.display_name} 创建了人机验证任务,mmt_data: {mmt_data}" + ) if create_status: if geetest_result := await get_validate(user, mmt_data.gt, mmt_data.challenge): if await verify_verification(mmt_data, geetest_result, self.account): logger.success( f"米游币任务 - 讨论区签到: 用户 {self.account.display_name} 人机验证通过") continue + logger.debug( + f"米游币任务 - 讨论区签到: " + f"用户 {self.account.display_name} 人机验证失败,geetest_result: {geetest_result}" + ) else: logger.info( f"米游币任务 - 讨论区签到: 用户 {self.account.display_name} 未配置极验人机验证打码平台") From ca3d52edcd9bbd67c5e7cfe89d6d2d73dcbf117b Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Mon, 19 Aug 2024 21:43:34 +0800 Subject: [PATCH 21/24] =?UTF-8?q?build:=20=E6=9B=B4=E6=96=B0=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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 ccb5041d..5b4b005b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nonebot-plugin-mystool" -version = "v2.7.0" +version = "v2.8.0" description = "QQ聊天、频道机器人插件 | 米游社工具-每日米游币任务、游戏签到、商品兑换、免抓包登录、原神崩铁便笺提醒" license = "MIT" authors = [ diff --git a/src/nonebot_plugin_mystool/_version.py b/src/nonebot_plugin_mystool/_version.py index ee378b69..ea62d1e8 100644 --- a/src/nonebot_plugin_mystool/_version.py +++ b/src/nonebot_plugin_mystool/_version.py @@ -1 +1 @@ -__version__ = "v2.7.0" +__version__ = "v2.8.0" From 4146176207c7d89ae23f4ed800d0f1930d7da359 Mon Sep 17 00:00:00 2001 From: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Mon, 19 Aug 2024 22:04:45 +0800 Subject: [PATCH 22/24] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=20CHANGELOG.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a903fdca..928906d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,16 +3,19 @@ ### 更新内容 #### 💡 新特性 -- 支持指定要进行签到的游戏(游戏签到)(#291) - by @Joseandluue - - 通过 `/账号设置` 命令更改游戏签到限定范围 +- 米游币任务 — 讨论区签到 的人机验证增加更多的日志输出 +- 群聊中使用时构建合并的消息/聊天记录再进行推送 (#353) - by @dontdot +- 实时便笺根据可签到的游戏进行自动推送 (#352) - by @dontdot #### 🐛 修复 -- 修复体力阈值设置需要发送两次的问题 (#342) - by @Joseandluue -- 修复米游币任务讨论区签到在人机验证成功后签到失败的问题 (#323, #309) -- 撤销上个版本兑换时间的相关变更,以修复错误的兑换时间 (#341, #342) +- 修复二维码登录提示已过期的问题 (#357) - by @tym2008 +- 修复二维码登录相关的部分反馈文本没有发送的问题 (#357) +- 修复QQ频道私聊不响应的问题 (#356) - by @dontdot +- 修复手动触发米游社任务时,消息列表为空导致任务中断的问题 (#354) - by @dontdot +- 修复截取微博超话id的正则公式错误 (#352) - by @dontdot +- 修复当用户不填写偏好设置 `geetest_params` 时报错的问题 (#352) - by @dontdot -#### 🔧 杂项 -- 撤销上个版本 OneBot 协议推送米游币任务结果时不配上图片的变更 +[//]: # (#### 🔧 杂项) ### 更新方式 @@ -34,4 +37,4 @@ - V1 (`>=v1.0.0, Date: Mon, 19 Aug 2024 22:09:34 +0800 Subject: [PATCH 23/24] style: Update src/nonebot_plugin_mystool/api/myb_missions_api.py Co-authored-by: code-review-doctor[bot] <72320148+code-review-doctor[bot]@users.noreply.github.com> --- src/nonebot_plugin_mystool/api/myb_missions_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nonebot_plugin_mystool/api/myb_missions_api.py b/src/nonebot_plugin_mystool/api/myb_missions_api.py index 862bec64..741bee32 100644 --- a/src/nonebot_plugin_mystool/api/myb_missions_api.py +++ b/src/nonebot_plugin_mystool/api/myb_missions_api.py @@ -152,7 +152,7 @@ async def sign(self, user: UserData, retry: bool = True) -> Tuple[MissionStatus, if plugin_config.preference.geetest_url or user.geetest_url: create_status, mmt_data = await create_verification(self.account) logger.debug( - f"米游币任务 - 讨论区签到: " + "米游币任务 - 讨论区签到: " f"用户 {self.account.display_name} 创建了人机验证任务,mmt_data: {mmt_data}" ) if create_status: From bedaa2b0d09cfbb9dc4ffbcee71a5b4f2a2534d8 Mon Sep 17 00:00:00 2001 From: Ljzd PRO <63289359+Ljzd-PRO@users.noreply.github.com> Date: Mon, 19 Aug 2024 22:09:55 +0800 Subject: [PATCH 24/24] style: Update src/nonebot_plugin_mystool/api/myb_missions_api.py Co-authored-by: code-review-doctor[bot] <72320148+code-review-doctor[bot]@users.noreply.github.com> --- src/nonebot_plugin_mystool/api/myb_missions_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nonebot_plugin_mystool/api/myb_missions_api.py b/src/nonebot_plugin_mystool/api/myb_missions_api.py index 741bee32..076983eb 100644 --- a/src/nonebot_plugin_mystool/api/myb_missions_api.py +++ b/src/nonebot_plugin_mystool/api/myb_missions_api.py @@ -162,7 +162,7 @@ async def sign(self, user: UserData, retry: bool = True) -> Tuple[MissionStatus, f"米游币任务 - 讨论区签到: 用户 {self.account.display_name} 人机验证通过") continue logger.debug( - f"米游币任务 - 讨论区签到: " + "米游币任务 - 讨论区签到: " f"用户 {self.account.display_name} 人机验证失败,geetest_result: {geetest_result}" ) else: