From 8de332b4abd676dd92b353dbf9a81881c14422b6 Mon Sep 17 00:00:00 2001 From: Cateon Huo <2221533105@qq.com> Date: Sun, 17 Dec 2023 17:13:43 +0800 Subject: [PATCH 01/18] =?UTF-8?q?:sparkles:=20=E6=9B=B4=E6=96=B0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/bug_report.yaml | 11 +- README.md | 18 +- nonebot_plugin_skland_arksign/alc_parser.py | 6 +- nonebot_plugin_skland_arksign/command.py | 285 ++++++++++++---- nonebot_plugin_skland_arksign/constants.py | 4 +- .../b488a7927868_remove_unique_note.py | 33 ++ .../f9eda5d9d24e_database_update.py | 41 +++ nonebot_plugin_skland_arksign/model.py | 5 +- nonebot_plugin_skland_arksign/sched.py | 2 +- nonebot_plugin_skland_arksign/signin.py | 4 +- nonebot_plugin_skland_arksign/utils.py | 33 ++ pdm.lock | 306 +++++++++++++----- pyproject.toml | 26 +- 13 files changed, 590 insertions(+), 184 deletions(-) create mode 100644 nonebot_plugin_skland_arksign/migrations/b488a7927868_remove_unique_note.py create mode 100644 nonebot_plugin_skland_arksign/migrations/f9eda5d9d24e_database_update.py diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index ab62aa2..9298714 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -57,17 +57,12 @@ body: validations: required: true - # Env | VM Arch - - type: dropdown + # Env | Nonebot 2 Version + - type: textarea id: env-nb2-ver attributes: label: Nonebot 2 版本 - description: 选择运行机器人 Nonebot 2 的系统架构 - options: - - 2.0.1 - - 2.1.0 - - 2.1.1 - - 其它(请在下方说明) + description: 选择运行机器人 Nonebot 2 的版本 validations: required: true diff --git a/README.md b/README.md index 0079da8..62ca616 100644 --- a/README.md +++ b/README.md @@ -167,8 +167,6 @@ skland del 游戏账号ID/备注 skland list ``` -> [!WARNING] -> 仅超级用户可用 ### 更新账号 @@ -176,8 +174,6 @@ skland list skland update 游戏账号ID/备注 [-u 可选UID] [-t 可选token] [-n 可选备注] ``` -> [!WARNING] -> 仅超级用户可用 ### 立即手动签到 @@ -200,11 +196,7 @@ skland signin !all ## ♿️ FAQ -1. 为什么这么多仅超级用户可用的命令? - 因为当前的数据库模型没有记录添加者的信息,只记录了需要发送到的用户信息,所以暂时只能通过超级用户来操作 - 未来可能会加入权限系统,以及增加数据库模型字段 - -2. 使用例子? +1. 使用例子? ```shell skland add 114514 1919810 -n hhhaaa @@ -218,22 +210,22 @@ skland signin !all skland signin 1919810 ``` -3. 为什么我刚获取token并绑定好,一会就用不了了? +2. 为什么我刚获取token并绑定好,一会就用不了了? - 当您使用浏览器获取token时,**不要去登出账号,否则鹰角网络通行证会失效!** - 如果要添加多个账号,请删除浏览器缓存。或者使用浏览器自带的隐私浏览模式,拿到Token后,关闭隐私窗口,再登录一次即可 - 注意:电脑在用密码登录后,手机客户端有可能会被挤掉,但一定不要点客户端里的清理会话,否则所有的登录状态**都会被清空!** -4. 报错`{'code': 10001, 'message': '当前用户未经授权'}`? +3. 报错`{'code': 10001, 'message': '当前用户未经授权'}`? - 参考 [#更新账号](#更新账号) 一栏重新绑定游戏账号ID - 参考issue:[#29](https://github.com/GuGuMur/nonebot-plugin-skland-arksign/issues/29) -5. 报错`Client error '400 Bad Request' for url xxx`? +4. 报错`Client error '400 Bad Request' for url xxx`? - 请检查token复制过程中是否有错漏,以及游戏账号ID是否与您输入的token相符 -6. 报错`Client error '401 Unauthorized' for url xxx`? +5. 报错`Client error '401 Unauthorized' for url xxx`? - 参考 [#配置](#配置) 一栏修改`skland_timestamp_delay`的数值 - 参考值:`5`,`10` diff --git a/nonebot_plugin_skland_arksign/alc_parser.py b/nonebot_plugin_skland_arksign/alc_parser.py index ae74239..4dacee4 100644 --- a/nonebot_plugin_skland_arksign/alc_parser.py +++ b/nonebot_plugin_skland_arksign/alc_parser.py @@ -16,12 +16,12 @@ ), Subcommand( "del", - Args["identifier", str], + Args["identifier", str]["position?", int], help_text="使用uid或者备注删除一个签到账号", ), Subcommand( "update", - Args["identifier", str], + Args["identifier", str]["position?", int], [ Option("-u|--uid", Args["uid", str]), Option("-t|--token", Args["token", str]), @@ -36,7 +36,7 @@ ), Subcommand( "signin", - Args["identifier", str], + Args["identifier", str]["position?", int], help_text="使用uid或者备注立刻签到一个账号", ), meta=CommandMeta( diff --git a/nonebot_plugin_skland_arksign/command.py b/nonebot_plugin_skland_arksign/command.py index 4e7273d..f79a22a 100644 --- a/nonebot_plugin_skland_arksign/command.py +++ b/nonebot_plugin_skland_arksign/command.py @@ -1,17 +1,18 @@ +from typing import TYPE_CHECKING from sqlalchemy import select from nonebot.log import logger from nonebot.params import Depends from nonebot.typing import T_State from nonebot.adapters import Bot, Event from nonebot.permission import SUPERUSER -from nonebot_plugin_alconna import on_alconna +from nonebot_plugin_alconna import on_alconna, AlconnaMatcher, UniMessage from sqlalchemy.ext.asyncio import AsyncSession from nonebot_plugin_datastore import get_session from nonebot_plugin_saa import Text, PlatformTarget from nonebot_plugin_session_saa import get_saa_target from nonebot_plugin_session import EventSession, extract_session -from .utils import cleantext +from .utils import cleantext, report_maker, compare_user_info from .sched import sched_sign from .signin import run_signin from .alc_parser import skland_alc @@ -42,19 +43,31 @@ async def add( db_session: AsyncSession = Depends(get_session), ): logger.debug(f"匹配到的参数:{state}") - user_account = get_saa_target(event_session) - if not user_account: + send_to_dict = get_saa_target(event_session).dict() + event_session_dict = event_session.dict() + if not send_to_dict: await skland.finish("未能获取到当前会话的可发送用户信息,请检查") - logger.debug(f"当前会话的用户信息:{user_account.dict()}") - - # 判断是否为私信/群聊 + # logger.debug(f"当前会话的用户信息:{send_to_target.dict()}") # 先添加一个record - stmt = select(SklandSubscribe).where(SklandSubscribe.uid == uid) - result = await db_session.scalar(stmt) - if result: - await skland.finish("该UID已经被注册,请检查") - new_record = SklandSubscribe(user=user_account.dict(), uid=uid, token=token, cred="", note=note) + # 1. 检查UID是否被注册 + async with db_session.begin(): + stmt = select(SklandSubscribe).where(SklandSubscribe.uid == uid) + result = await db_session.scalar(stmt) + if result: + await skland.finish("该UID已经被您或其他用户注册,请检查") + + # 2. 检查用户绑定的 note 是否与自己绑的重复 + if note is not None: + async with db_session.begin(): + stmt = select(SklandSubscribe).where(SklandSubscribe.note == note) + result: list[SklandSubscribe] = (await db_session.scalars(stmt)).all() + result = [i for i in result if compare_user_info(i.user, event_session_dict)] + if result: + await skland.finish("该note已经被您注册,请检查") + + # 3. 绑定到数据库里 + new_record = SklandSubscribe(uid=uid, user=event_session_dict, sendto=send_to_dict, token=token, cred="", note=note) db_session.add(new_record) await db_session.commit() await db_session.refresh(new_record) @@ -78,7 +91,7 @@ async def add( # 这是私信 else: if not token: - await skland.finish("请提供token!") + await skland.finish("请通过 /森空岛 update 指令提供token!") await skland.send(cleantext(f""" [森空岛明日方舟签到器]已添加新账号! @@ -144,30 +157,79 @@ async def bind( # 删除功能可以在各处使用 @skland.assign("del") -async def del_( +async def del_1( bot: Bot, event: Event, + state: T_State, identifier: str, + matcher: AlconnaMatcher, event_session: EventSession = Depends(extract_session), db_session: AsyncSession = Depends(get_session), ): - # identifier 可以是uid或者备注, 需要都尝试一下 - stmt = select(SklandSubscribe).where((SklandSubscribe.uid == identifier) | (SklandSubscribe.note == identifier)) - result = await db_session.scalar(stmt) + is_group = state.get("is_group") + flag: bool = False + # SUPERUSER:返回全部 + if await SUPERUSER(bot, event): + flag = True + stmt = select(SklandSubscribe).where((SklandSubscribe.uid == identifier) | (SklandSubscribe.note == identifier)) + result = (await db_session.scalars(stmt)).all() + if not result: + await skland.finish("未能查询到任何账号,请检查") + + # QQ群管理:返回当前群聊的所有绑定 + if is_group and flag is False: + if not bot.adapter.get_name() == "OneBot V11": + await skland.finish("当前的森空岛签到插件无法提供Onebot V11外的群聊绑定记录...") + if TYPE_CHECKING: + from nonebot.adapters.onebot.v11.bot import Bot as OneBotV11Bot + + assert isinstance(bot, OneBotV11Bot) + from nonebot.adapters.onebot.v11 import GROUP_ADMIN, GROUP_OWNER + + if not (await GROUP_ADMIN(bot, event) or await GROUP_OWNER(bot, event)): + await skland.finish("您不是本群的管理员或群主,无法在此进行删除账号操作!") + + stmt = select(SklandSubscribe).where( + SklandSubscribe.sendto.group_id == event_session.id2 + and (SklandSubscribe.uid == identifier) | (SklandSubscribe.note == identifier) + ) + result = (await db_session.scalars(stmt)).all() + if not result: + await skland.finish("未能查询到任何账号,请检查") + state["prompt"] = ( + "本群可删除的森空岛签到账号如下:\n" + report_maker(list(result), is_group) + "请输入对应序号完成删除操作!" + ) + + # 普通用户的list:返回该用户绑定的所有账号 + if flag is False: + stmt = select(SklandSubscribe).where((SklandSubscribe.uid == identifier) | (SklandSubscribe.note == identifier)) + result: list[SklandSubscribe] = (await db_session.scalars(stmt)).all() + + result = [i for i in result if compare_user_info(i.user, event_session.dict())] if not result: - await skland.finish("未能使用uid或备注匹配到任何账号,请检查") + await skland.finish("未能查询到任何账号,请检查") + if len(result) == 1: + matcher.set_path_arg("position", 0) - if not await SUPERUSER(bot, event): - user = get_saa_target(event_session) - if not user: - await skland.finish("未能获取到当前会话的用户信息,请检查") + state["prompt"] = ( + "您可手动删除的森空岛签到账号如下:\n" + report_maker(list(result), is_group) + "请输入对应序号完成删除操作!" + ) + state["all_accounts"] = result - if user.dict() != result.user: - await skland.finish("您无权删除该账号!") +@skland.got_path("~del.position", prompt=UniMessage.template("{prompt}")) +async def del_2( + bot: Bot, + event: Event, + state: T_State, + matcher: AlconnaMatcher, + position: int, + event_session: EventSession = Depends(skland_session_extract), + db_session: AsyncSession = Depends(get_session), +): + result = state["all_accounts"][position] uid = result.uid note = result.note or "无" - await db_session.delete(result) await db_session.commit() @@ -183,56 +245,93 @@ async def list_( bot: Bot, event: Event, state: T_State, + event_session: EventSession = Depends(skland_session_extract), db_session: AsyncSession = Depends(get_session), ): - if not await SUPERUSER(bot, event): - await skland.finish("您无权查看账号列表!") - is_group = state.get("is_group") - - def show_token(token: str): - if not token: - return "未绑定" - else: - if is_group: - return "已绑定" - return token - - def report_maker(subscribes: list[SklandSubscribe]): - report = [] - for i in subscribes: - report.append(cleantext(f""" - UID:{i.uid} - TOKEN:{show_token(i.token)} - 备注:{i.note} - """)) - return "\n\n".join(report) - - stmt = select(SklandSubscribe) - result = (await db_session.scalars(stmt)).all() - if not result: - await skland.finish("未能查询到任何账号,请检查") - await skland.finish(report_maker(list(result))) + flag: bool = False + # SUPERUSER 的 list:返回全部 + if await SUPERUSER(bot, event): + flag = True + stmt = select(SklandSubscribe) + result = (await db_session.scalars(stmt)).all() + if not result: + await skland.finish("未能查询到任何账号,请检查") + await skland.finish("机器人绑定的所有森空岛签到账号如下:" + report_maker(list(result), is_group)) + + # QQ群管理的list:返回当前群聊的所有绑定 + if is_group and flag is False: + if not bot.adapter.get_name() == "OneBot V11": + await skland.finish("当前的森空岛签到插件无法提供Onebot V11外的群聊绑定记录...") + if TYPE_CHECKING: + from nonebot.adapters.onebot.v11.bot import Bot as OneBotV11Bot + + assert isinstance(bot, OneBotV11Bot) + from nonebot.adapters.onebot.v11 import GROUP_ADMIN, GROUP_OWNER + + if not (await GROUP_ADMIN(bot, event) or await GROUP_OWNER(bot, event)): + await skland.finish("您不是本群的管理员或群主,请通过私聊获取您的个人绑定记录!") + + stmt = select(SklandSubscribe).where(SklandSubscribe.sendto.group_id == event_session.id2) + result = (await db_session.scalars(stmt)).all() + if not result: + await skland.finish("未能查询到任何账号,请检查") + await skland.finish("本群绑定的森空岛签到账号如下:" + report_maker(list(result), is_group)) + + # 普通用户的list:返回该用户绑定的所有账号 + if flag is False: + stmt = select(SklandSubscribe) + result: list[SklandSubscribe] = (await db_session.scalars(stmt)).all() + result = [i for i in result if compare_user_info(i.user, event_session.dict())] + if not result: + await skland.finish("未能查询到任何账号,请检查") + await skland.finish("您绑定的森空岛签到账号如下:" + report_maker(list(result)), is_group) @skland.assign("update", parameterless=[Depends(skland_session_extract)]) -async def update( +async def update_1( bot: Bot, event: Event, + state: T_State, identifier: str, + matcher: AlconnaMatcher, uid: str | None = None, token: str | None = None, note: str | None = None, + event_session: EventSession = Depends(skland_session_extract), db_session: AsyncSession = Depends(get_session), ): - if not await SUPERUSER(bot, event): - await skland.finish("您无权更新账号信息!") - + is_group = state.get("is_group") stmt = select(SklandSubscribe).where((SklandSubscribe.uid == identifier) | (SklandSubscribe.note == identifier)) - result = await db_session.scalar(stmt) + result = (await db_session.scalars(stmt)).all() + if not await SUPERUSER(bot, event): + result = [i for i in result if compare_user_info(i.user, event_session.dict())] if not result: await skland.finish("未能使用uid或备注匹配到任何账号,请检查") + if len(result) == 1: + matcher.set_path_arg("position", 0) + state["prompt"] = ( + "以下是您能管理的所有账号:\n" + report_maker(result, is_group) + "请回复对应序号来完成您的 update 指令!" + ) + state["all_accounts"] = result + + +@skland.got_path("~update.position", prompt=UniMessage.template("{prompt}")) +async def update_2( + bot: Bot, + event: Event, + identifier: str, + matcher: AlconnaMatcher, + state: T_State, + position: int, + uid: str | None = None, + token: str | None = None, + note: str | None = None, + event_session: EventSession = Depends(skland_session_extract), + db_session: AsyncSession = Depends(get_session), +): + result = state["all_accounts"][position] if uid: result.uid = uid if token: @@ -257,20 +356,78 @@ async def signin_all(): # 手动签到功能可以在各处使用 @skland.assign("signin") -async def signin( +async def signin_1( bot: Bot, event: Event, + state: T_State, identifier: str, + matcher: AlconnaMatcher, + event_session: EventSession = Depends(skland_session_extract), db_session: AsyncSession = Depends(get_session), ): - if not await SUPERUSER(bot, event): - await skland.finish("您无权手动签到!") - - stmt = select(SklandSubscribe).where((SklandSubscribe.uid == identifier) | (SklandSubscribe.note == identifier)) - result = await db_session.scalar(stmt) + is_group = state.get("is_group") + flag: bool = False + + # SUPERUSER:返回全部 + if await SUPERUSER(bot, event): + flag = True + stmt = select(SklandSubscribe).where((SklandSubscribe.uid == identifier) | (SklandSubscribe.note == identifier)) + result = (await db_session.scalars(stmt)).all() + + # QQ群管理:返回当前群聊的所有绑定 + if is_group and flag is False: + if not bot.adapter.get_name() == "OneBot V11": + await skland.finish("当前的森空岛签到插件无法提供Onebot V11外的群聊绑定记录...") + if TYPE_CHECKING: + from nonebot.adapters.onebot.v11.bot import Bot as OneBotV11Bot + + assert isinstance(bot, OneBotV11Bot) + from nonebot.adapters.onebot.v11 import GROUP_ADMIN, GROUP_OWNER + + if not (await GROUP_ADMIN(bot, event) or await GROUP_OWNER(bot, event)): + await skland.finish("您不是本群的管理员或群主,请通过私聊完成您的个人手动签到!") + + stmt = select(SklandSubscribe).where( + SklandSubscribe.sendto.group_id == event_session.id2 + and (SklandSubscribe.uid == identifier) | (SklandSubscribe.note == identifier) + ) + result = (await db_session.scalars(stmt)).all() + if not result: + await skland.finish("未能查询到任何账号,请检查") + state["prompt"] = ( + "本群可手动签到的森空岛签到账号如下:\n" + + report_maker(list(result), is_group) + + "请输入对应序号完成签到操作!" + ) + + # 普通用户的list:返回该用户绑定的所有账号 + if flag is False: + stmt = select(SklandSubscribe).where((SklandSubscribe.uid == identifier) | (SklandSubscribe.note == identifier)) + result: list[SklandSubscribe] = (await db_session.scalars(stmt)).all() + + result = [i for i in result if compare_user_info(i.user, event_session.dict())] if not result: - await skland.finish("未能使用uid或备注匹配到任何账号,请检查") + await skland.finish("未能查询到任何账号,请检查") + if len(result) == 1: + matcher.set_path_arg("position", 0) + + state["prompt"] = ( + "您可手动签到的森空岛签到账号如下:\n" + report_maker(list(result), is_group) + "请输入对应序号完成签到操作!" + ) + state["all_accounts"] = result + +@skland.got_path("~signin.position", prompt=UniMessage.template("{prompt}")) +async def signin_2( + bot: Bot, + event: Event, + state: T_State, + matcher: AlconnaMatcher, + position: int, + event_session: EventSession = Depends(skland_session_extract), + db_session: AsyncSession = Depends(get_session), +): + result = state["all_accounts"][position] sign_res = await run_signin(uid=result.uid, token=result.token) await skland.finish(cleantext(f""" [森空岛明日方舟签到器]已为账号{result.uid}手动签到! diff --git a/nonebot_plugin_skland_arksign/constants.py b/nonebot_plugin_skland_arksign/constants.py index 024c0a8..c3eef63 100644 --- a/nonebot_plugin_skland_arksign/constants.py +++ b/nonebot_plugin_skland_arksign/constants.py @@ -12,14 +12,14 @@ class _CONSTANTS: @property def REQUEST_HEADERS_BASE(self) -> dict[str, str]: return { - "User-Agent": "Skland/1.5.1 (com.hypergryph.skland; build:100501001; Android 34; ) Okhttp/4.11.0", + "User-Agent": "Skland/1.7.0 (com.hypergryph.skland; build:100700063; Android 34; ) Okhttp/4.11.0", "Accept-Encoding": "gzip", "Connection": "close", } @property def SIGN_HEADERS_BASE(self) -> dict[str, str]: - return {"platform": "1", "timestamp": "", "dId": "de9759a5afaa634f", "vName": "1.5.1"} + return {"platform": "1", "timestamp": "", "dId": "de9759a5afaa634f", "vName": "1.7.0"} CONSTANTS = _CONSTANTS() diff --git a/nonebot_plugin_skland_arksign/migrations/b488a7927868_remove_unique_note.py b/nonebot_plugin_skland_arksign/migrations/b488a7927868_remove_unique_note.py new file mode 100644 index 0000000..29a1a25 --- /dev/null +++ b/nonebot_plugin_skland_arksign/migrations/b488a7927868_remove_unique_note.py @@ -0,0 +1,33 @@ +"""remove_unique_note + +Revision ID: b488a7927868 +Revises: f9eda5d9d24e +Create Date: 2023-12-17 11:14:36.273477 + +""" + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = "b488a7927868" +down_revision = "f9eda5d9d24e" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table("skland_subscribe", schema=None) as batch_op: + batch_op.drop_constraint("uq_skland_subscribe_note", type_="unique") + + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table("skland_subscribe", schema=None) as batch_op: + batch_op.create_unique_constraint("uq_skland_subscribe_note", ["note"]) + + # ### end Alembic commands ### diff --git a/nonebot_plugin_skland_arksign/migrations/f9eda5d9d24e_database_update.py b/nonebot_plugin_skland_arksign/migrations/f9eda5d9d24e_database_update.py new file mode 100644 index 0000000..1c64749 --- /dev/null +++ b/nonebot_plugin_skland_arksign/migrations/f9eda5d9d24e_database_update.py @@ -0,0 +1,41 @@ +"""database_update + +Revision ID: f9eda5d9d24e +Revises: d89239244530 +Create Date: 2023-12-17 10:43:59.367604 + +""" + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql +from sqlalchemy.dialects import sqlite + +# revision identifiers, used by Alembic. +revision = "f9eda5d9d24e" +down_revision = "d89239244530" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + with op.batch_alter_table("skland_subscribe", schema=None) as batch_op: + batch_op.add_column( + sa.Column( + "sendto", sa.JSON().with_variant(postgresql.JSONB(astext_type=sa.Text()), "postgresql"), nullable=True + ) + ) + op.execute("UPDATE skland_subscribe SET sendto = user") + with op.batch_alter_table("skland_subscribe", schema=None) as batch_op: + batch_op.alter_column("user", existing_type=sqlite.JSON(), nullable=True) + + + +def downgrade() -> None: + with op.batch_alter_table("skland_subscribe", schema=None) as batch_op: + batch_op.alter_column("user", existing_type=sqlite.JSON(), nullable=False) + + op.execute("UPDATE skland_subscribe SET user = sendto") + with op.batch_alter_table("skland_subscribe", schema=None) as batch_op: + batch_op.drop_column("sendto") + diff --git a/nonebot_plugin_skland_arksign/model.py b/nonebot_plugin_skland_arksign/model.py index f1707bc..f5466f4 100644 --- a/nonebot_plugin_skland_arksign/model.py +++ b/nonebot_plugin_skland_arksign/model.py @@ -11,7 +11,8 @@ class SklandSubscribe(Model): __table_args__ = {"extend_existing": True} uid: Mapped[str] = mapped_column(String, primary_key=True, doc="森空岛账号ID") - user: Mapped[dict] = mapped_column(JSON().with_variant(JSONB, "postgresql"), doc="订阅用户信息") + user: Mapped[dict] = mapped_column(JSON().with_variant(JSONB, "postgresql"), doc="订阅用户信息", nullable=True) + sendto: Mapped[dict] = mapped_column(JSON().with_variant(JSONB, "postgresql"), doc="发送位置", nullable=True) cred: Mapped[str] = mapped_column(String, doc="森空岛账号CRED") token: Mapped[str] = mapped_column(String, doc="森空岛账号TOKEN", nullable=True) - note: Mapped[str] = mapped_column(String, doc="备注", nullable=True, unique=True) + note: Mapped[str] = mapped_column(String, doc="备注", nullable=True) diff --git a/nonebot_plugin_skland_arksign/sched.py b/nonebot_plugin_skland_arksign/sched.py index 8a2e49d..c61c03d 100644 --- a/nonebot_plugin_skland_arksign/sched.py +++ b/nonebot_plugin_skland_arksign/sched.py @@ -24,7 +24,7 @@ async def sched_sign(): sub_groups: dict[PlatformTarget, list[SignResult]] = {} for sub in subscribes: - target = PlatformTarget.deserialize(sub.user) + target = PlatformTarget.deserialize(sub.sendto) logger.debug(f"target: {target.dict()}") if not sub.token: await Text(f"账号{sub.uid}未绑定Token,请重新绑定!").send_to(target) diff --git a/nonebot_plugin_skland_arksign/signin.py b/nonebot_plugin_skland_arksign/signin.py index 5a12a96..75b2fc6 100644 --- a/nonebot_plugin_skland_arksign/signin.py +++ b/nonebot_plugin_skland_arksign/signin.py @@ -139,11 +139,11 @@ def parse(sign_response: dict[str, Any]) -> SignResult: resource.update(award.get("resource", {})) text += f"奖励ID:{resource['id']}\n" text += f"签到奖励:{resource['name']} × {award.get('count')}\n" - text += f"类型:{resource['type']} {award.get('type', '')}\n" + text += f"类型:{resource['type']} {award.get('type', '')}\n\n" else: status = False text = f"[{server}] {drname} UID:{uid} 签到失败\n请检查以下信息:\n{sign_response}" - return SignResult(status, text) + return SignResult(status, text.strip()) async with AsyncClient() as client: sign_response = await client.post( diff --git a/nonebot_plugin_skland_arksign/utils.py b/nonebot_plugin_skland_arksign/utils.py index 14ea395..35ae523 100644 --- a/nonebot_plugin_skland_arksign/utils.py +++ b/nonebot_plugin_skland_arksign/utils.py @@ -1,5 +1,38 @@ +from .model import SklandSubscribe + + def cleantext(text: str) -> str: lines = text.strip().split("\n") cleaned_lines = [line.strip() for line in lines] result = "\n".join(cleaned_lines) return result + + +def compare_user_info(dict1, dict2: dict[any, any]): + # excludes = ["bot_id", "level", "id2", "id3"] + # includes = [i for i in dict2.keys() if i not in excludes] + includes = ["bot_type", "platform", "id1"] + filter1 = {k: dict1[k] for k in includes} + filter2 = {k: dict2[k] for k in includes} + return filter1 == filter2 + + +def show_token(token: str, is_group: bool) -> str: + if not token: + return "未绑定" + else: + if is_group: + return "已绑定" + return token + + +def report_maker(subscribes: list[SklandSubscribe], is_group: bool) -> str: + report = [] + for n, i in enumerate(subscribes): + report.append(cleantext(f""" + {n}: + UID:{i.uid} + TOKEN:{show_token(i.token,is_group)} + 备注:{i.note} + """)) + return "\n\n".join(report) diff --git a/pdm.lock b/pdm.lock index 15ce2c6..290e480 100644 --- a/pdm.lock +++ b/pdm.lock @@ -3,10 +3,84 @@ [metadata] groups = ["default", "dev", "test"] -cross_platform = true -static_urls = false -lock_version = "4.3" -content_hash = "sha256:71249f04f728c33109a46f6c0d2c390819d6345ae56d9b2e452024e53461e44d" +strategy = ["cross_platform"] +lock_version = "4.4" +content_hash = "sha256:a5077193d762fd9211002e55dc142694d79eefdb277089c92b5520fda975bcd9" + +[[package]] +name = "aiohttp" +version = "3.9.1" +requires_python = ">=3.8" +summary = "Async http client/server framework (asyncio)" +dependencies = [ + "aiosignal>=1.1.2", + "async-timeout<5.0,>=4.0; python_version < \"3.11\"", + "attrs>=17.3.0", + "frozenlist>=1.1.1", + "multidict<7.0,>=4.5", + "yarl<2.0,>=1.0", +] +files = [ + {file = "aiohttp-3.9.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:e1f80197f8b0b846a8d5cf7b7ec6084493950d0882cc5537fb7b96a69e3c8590"}, + {file = "aiohttp-3.9.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c72444d17777865734aa1a4d167794c34b63e5883abb90356a0364a28904e6c0"}, + {file = "aiohttp-3.9.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9b05d5cbe9dafcdc733262c3a99ccf63d2f7ce02543620d2bd8db4d4f7a22f83"}, + {file = "aiohttp-3.9.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5c4fa235d534b3547184831c624c0b7c1e262cd1de847d95085ec94c16fddcd5"}, + {file = "aiohttp-3.9.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:289ba9ae8e88d0ba16062ecf02dd730b34186ea3b1e7489046fc338bdc3361c4"}, + {file = "aiohttp-3.9.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:bff7e2811814fa2271be95ab6e84c9436d027a0e59665de60edf44e529a42c1f"}, + {file = "aiohttp-3.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:81b77f868814346662c96ab36b875d7814ebf82340d3284a31681085c051320f"}, + {file = "aiohttp-3.9.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3b9c7426923bb7bd66d409da46c41e3fb40f5caf679da624439b9eba92043fa6"}, + {file = "aiohttp-3.9.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:8d44e7bf06b0c0a70a20f9100af9fcfd7f6d9d3913e37754c12d424179b4e48f"}, + {file = "aiohttp-3.9.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:22698f01ff5653fe66d16ffb7658f582a0ac084d7da1323e39fd9eab326a1f26"}, + {file = "aiohttp-3.9.1-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:ca7ca5abfbfe8d39e653870fbe8d7710be7a857f8a8386fc9de1aae2e02ce7e4"}, + {file = "aiohttp-3.9.1-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:8d7f98fde213f74561be1d6d3fa353656197f75d4edfbb3d94c9eb9b0fc47f5d"}, + {file = "aiohttp-3.9.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:5216b6082c624b55cfe79af5d538e499cd5f5b976820eac31951fb4325974501"}, + {file = "aiohttp-3.9.1-cp310-cp310-win32.whl", hash = "sha256:0e7ba7ff228c0d9a2cd66194e90f2bca6e0abca810b786901a569c0de082f489"}, + {file = "aiohttp-3.9.1-cp310-cp310-win_amd64.whl", hash = "sha256:c7e939f1ae428a86e4abbb9a7c4732bf4706048818dfd979e5e2839ce0159f23"}, + {file = "aiohttp-3.9.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:df9cf74b9bc03d586fc53ba470828d7b77ce51b0582d1d0b5b2fb673c0baa32d"}, + {file = "aiohttp-3.9.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ecca113f19d5e74048c001934045a2b9368d77b0b17691d905af18bd1c21275e"}, + {file = "aiohttp-3.9.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:8cef8710fb849d97c533f259103f09bac167a008d7131d7b2b0e3a33269185c0"}, + {file = "aiohttp-3.9.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bea94403a21eb94c93386d559bce297381609153e418a3ffc7d6bf772f59cc35"}, + {file = "aiohttp-3.9.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:91c742ca59045dce7ba76cab6e223e41d2c70d79e82c284a96411f8645e2afff"}, + {file = "aiohttp-3.9.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6c93b7c2e52061f0925c3382d5cb8980e40f91c989563d3d32ca280069fd6a87"}, + {file = "aiohttp-3.9.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ee2527134f95e106cc1653e9ac78846f3a2ec1004cf20ef4e02038035a74544d"}, + {file = "aiohttp-3.9.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:11ff168d752cb41e8492817e10fb4f85828f6a0142b9726a30c27c35a1835f01"}, + {file = "aiohttp-3.9.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:b8c3a67eb87394386847d188996920f33b01b32155f0a94f36ca0e0c635bf3e3"}, + {file = "aiohttp-3.9.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:c7b5d5d64e2a14e35a9240b33b89389e0035e6de8dbb7ffa50d10d8b65c57449"}, + {file = "aiohttp-3.9.1-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:69985d50a2b6f709412d944ffb2e97d0be154ea90600b7a921f95a87d6f108a2"}, + {file = "aiohttp-3.9.1-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:c9110c06eaaac7e1f5562caf481f18ccf8f6fdf4c3323feab28a93d34cc646bd"}, + {file = "aiohttp-3.9.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d737e69d193dac7296365a6dcb73bbbf53bb760ab25a3727716bbd42022e8d7a"}, + {file = "aiohttp-3.9.1-cp311-cp311-win32.whl", hash = "sha256:4ee8caa925aebc1e64e98432d78ea8de67b2272252b0a931d2ac3bd876ad5544"}, + {file = "aiohttp-3.9.1-cp311-cp311-win_amd64.whl", hash = "sha256:a34086c5cc285be878622e0a6ab897a986a6e8bf5b67ecb377015f06ed316587"}, + {file = "aiohttp-3.9.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f800164276eec54e0af5c99feb9494c295118fc10a11b997bbb1348ba1a52065"}, + {file = "aiohttp-3.9.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:500f1c59906cd142d452074f3811614be04819a38ae2b3239a48b82649c08821"}, + {file = "aiohttp-3.9.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0b0a6a36ed7e164c6df1e18ee47afbd1990ce47cb428739d6c99aaabfaf1b3af"}, + {file = "aiohttp-3.9.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69da0f3ed3496808e8cbc5123a866c41c12c15baaaead96d256477edf168eb57"}, + {file = "aiohttp-3.9.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:176df045597e674fa950bf5ae536be85699e04cea68fa3a616cf75e413737eb5"}, + {file = "aiohttp-3.9.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b796b44111f0cab6bbf66214186e44734b5baab949cb5fb56154142a92989aeb"}, + {file = "aiohttp-3.9.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f27fdaadce22f2ef950fc10dcdf8048407c3b42b73779e48a4e76b3c35bca26c"}, + {file = "aiohttp-3.9.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bcb6532b9814ea7c5a6a3299747c49de30e84472fa72821b07f5a9818bce0f66"}, + {file = "aiohttp-3.9.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:54631fb69a6e44b2ba522f7c22a6fb2667a02fd97d636048478db2fd8c4e98fe"}, + {file = "aiohttp-3.9.1-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:4b4c452d0190c5a820d3f5c0f3cd8a28ace48c54053e24da9d6041bf81113183"}, + {file = "aiohttp-3.9.1-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:cae4c0c2ca800c793cae07ef3d40794625471040a87e1ba392039639ad61ab5b"}, + {file = "aiohttp-3.9.1-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:565760d6812b8d78d416c3c7cfdf5362fbe0d0d25b82fed75d0d29e18d7fc30f"}, + {file = "aiohttp-3.9.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:54311eb54f3a0c45efb9ed0d0a8f43d1bc6060d773f6973efd90037a51cd0a3f"}, + {file = "aiohttp-3.9.1-cp312-cp312-win32.whl", hash = "sha256:85c3e3c9cb1d480e0b9a64c658cd66b3cfb8e721636ab8b0e746e2d79a7a9eed"}, + {file = "aiohttp-3.9.1-cp312-cp312-win_amd64.whl", hash = "sha256:11cb254e397a82efb1805d12561e80124928e04e9c4483587ce7390b3866d213"}, + {file = "aiohttp-3.9.1.tar.gz", hash = "sha256:8fc49a87ac269d4529da45871e2ffb6874e87779c3d0e2ccd813c0899221239d"}, +] + +[[package]] +name = "aiosignal" +version = "1.3.1" +requires_python = ">=3.7" +summary = "aiosignal: a list of registered asynchronous callbacks" +dependencies = [ + "frozenlist>=1.1.0", +] +files = [ + {file = "aiosignal-1.3.1-py3-none-any.whl", hash = "sha256:f8376fb07dd1e86a584e4fcdec80b36b7f81aac666ebc724e2c090300dd83b17"}, + {file = "aiosignal-1.3.1.tar.gz", hash = "sha256:54cd96e15e1649b75d6c87526a6ff0b6c1b0dd3459f43d9ca11d48c339b68cfc"}, +] [[package]] name = "aiosqlite" @@ -65,7 +139,7 @@ files = [ [[package]] name = "arclet-alconna" -version = "1.7.36" +version = "1.7.39" requires_python = ">=3.8" summary = "A High-performance, Generality, Humane Command Line Arguments Parser Library." dependencies = [ @@ -74,8 +148,8 @@ dependencies = [ "typing-extensions>=4.5.0", ] files = [ - {file = "arclet_alconna-1.7.36-py3-none-any.whl", hash = "sha256:9bfe081f1bfa9883c28cd242c1587c9ea9cd0abd2b13c84ce26270cdbb0f4374"}, - {file = "arclet_alconna-1.7.36.tar.gz", hash = "sha256:680ea48485db0dbed32083a6a1160e5520d8acec0425e8f423d999c0f27bf0ab"}, + {file = "arclet_alconna-1.7.39-py3-none-any.whl", hash = "sha256:7743892bc496cc630c44ed552a68ad9782efa44289362cb07c05bb197f880f89"}, + {file = "arclet_alconna-1.7.39.tar.gz", hash = "sha256:90b466c8471ef9e10be4053efa19663c6806b521100abdb398abe19dab49b113"}, ] [[package]] @@ -131,6 +205,26 @@ files = [ {file = "async-asgi-testclient-1.4.11.tar.gz", hash = "sha256:4449ac85d512d661998ec61f91c9ae01851639611d748d81ae7f816736551792"}, ] +[[package]] +name = "async-timeout" +version = "4.0.3" +requires_python = ">=3.7" +summary = "Timeout context manager for asyncio programs" +files = [ + {file = "async-timeout-4.0.3.tar.gz", hash = "sha256:4640d96be84d82d02ed59ea2b7105a0f7b33abe8703703cd0ab0bf87c427522f"}, + {file = "async_timeout-4.0.3-py3-none-any.whl", hash = "sha256:7405140ff1230c310e51dc27b3145b9092d659ce68ff733fb0cefe3ee42be028"}, +] + +[[package]] +name = "attrs" +version = "23.1.0" +requires_python = ">=3.7" +summary = "Classes Without Boilerplate" +files = [ + {file = "attrs-23.1.0-py3-none-any.whl", hash = "sha256:1f28b4522cdc2fb4256ac1a020c78acf9cba2c6b461ccd2c126f3aa8e8335d04"}, + {file = "attrs-23.1.0.tar.gz", hash = "sha256:6279836d581513a26f1bf235f9acd333bc9115683f14f7e8fae46c98fc50e015"}, +] + [[package]] name = "binaryornot" version = "0.4.4" @@ -145,10 +239,11 @@ files = [ [[package]] name = "black" -version = "23.11.0" +version = "23.12.0" requires_python = ">=3.8" summary = "The uncompromising code formatter." dependencies = [ + "aiohttp>=3.7.4; sys_platform != \"win32\" or implementation_name != \"pypy\" and extra == \"d\"", "click>=8.0.0", "mypy-extensions>=0.4.3", "packaging>=22.0", @@ -158,16 +253,20 @@ dependencies = [ "typing-extensions>=4.0.1; python_version < \"3.11\"", ] files = [ - {file = "black-23.11.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:dbea0bb8575c6b6303cc65017b46351dc5953eea5c0a59d7b7e3a2d2f433a911"}, - {file = "black-23.11.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:412f56bab20ac85927f3a959230331de5614aecda1ede14b373083f62ec24e6f"}, - {file = "black-23.11.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d136ef5b418c81660ad847efe0e55c58c8208b77a57a28a503a5f345ccf01394"}, - {file = "black-23.11.0-cp310-cp310-win_amd64.whl", hash = "sha256:6c1cac07e64433f646a9a838cdc00c9768b3c362805afc3fce341af0e6a9ae9f"}, - {file = "black-23.11.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cf57719e581cfd48c4efe28543fea3d139c6b6f1238b3f0102a9c73992cbb479"}, - {file = "black-23.11.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:698c1e0d5c43354ec5d6f4d914d0d553a9ada56c85415700b81dc90125aac244"}, - {file = "black-23.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:760415ccc20f9e8747084169110ef75d545f3b0932ee21368f63ac0fee86b221"}, - {file = "black-23.11.0-cp311-cp311-win_amd64.whl", hash = "sha256:58e5f4d08a205b11800332920e285bd25e1a75c54953e05502052738fe16b3b5"}, - {file = "black-23.11.0-py3-none-any.whl", hash = "sha256:54caaa703227c6e0c87b76326d0862184729a69b73d3b7305b6288e1d830067e"}, - {file = "black-23.11.0.tar.gz", hash = "sha256:4c68855825ff432d197229846f971bc4d6666ce90492e5b02013bcaca4d9ab05"}, + {file = "black-23.12.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:67f19562d367468ab59bd6c36a72b2c84bc2f16b59788690e02bbcb140a77175"}, + {file = "black-23.12.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:bbd75d9f28a7283b7426160ca21c5bd640ca7cd8ef6630b4754b6df9e2da8462"}, + {file = "black-23.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:593596f699ca2dcbbbdfa59fcda7d8ad6604370c10228223cd6cf6ce1ce7ed7e"}, + {file = "black-23.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:12d5f10cce8dc27202e9a252acd1c9a426c83f95496c959406c96b785a92bb7d"}, + {file = "black-23.12.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:e73c5e3d37e5a3513d16b33305713237a234396ae56769b839d7c40759b8a41c"}, + {file = "black-23.12.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ba09cae1657c4f8a8c9ff6cfd4a6baaf915bb4ef7d03acffe6a2f6585fa1bd01"}, + {file = "black-23.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ace64c1a349c162d6da3cef91e3b0e78c4fc596ffde9413efa0525456148873d"}, + {file = "black-23.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:72db37a2266b16d256b3ea88b9affcdd5c41a74db551ec3dd4609a59c17d25bf"}, + {file = "black-23.12.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:fdf6f23c83078a6c8da2442f4d4eeb19c28ac2a6416da7671b72f0295c4a697b"}, + {file = "black-23.12.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:39dda060b9b395a6b7bf9c5db28ac87b3c3f48d4fdff470fa8a94ab8271da47e"}, + {file = "black-23.12.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7231670266ca5191a76cb838185d9be59cfa4f5dd401b7c1c70b993c58f6b1b5"}, + {file = "black-23.12.0-cp312-cp312-win_amd64.whl", hash = "sha256:193946e634e80bfb3aec41830f5d7431f8dd5b20d11d89be14b84a97c6b8bc75"}, + {file = "black-23.12.0-py3-none-any.whl", hash = "sha256:a7c07db8200b5315dc07e331dda4d889a56f6bf4db6a9c2a526fa3166a81614f"}, + {file = "black-23.12.0.tar.gz", hash = "sha256:330a327b422aca0634ecd115985c1c7fd7bdb5b5a2ef8aa9888a82e2ebe9437a"}, ] [[package]] @@ -372,6 +471,61 @@ files = [ {file = "fleep-1.0.1.tar.gz", hash = "sha256:c8f62b258ee5364d7f6c1ed1f3f278e99020fc3f0a60a24ad1e10846e31d104c"}, ] +[[package]] +name = "frozenlist" +version = "1.4.1" +requires_python = ">=3.8" +summary = "A list-like structure which implements collections.abc.MutableSequence" +files = [ + {file = "frozenlist-1.4.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:f9aa1878d1083b276b0196f2dfbe00c9b7e752475ed3b682025ff20c1c1f51ac"}, + {file = "frozenlist-1.4.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:29acab3f66f0f24674b7dc4736477bcd4bc3ad4b896f5f45379a67bce8b96868"}, + {file = "frozenlist-1.4.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:74fb4bee6880b529a0c6560885fce4dc95936920f9f20f53d99a213f7bf66776"}, + {file = "frozenlist-1.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:590344787a90ae57d62511dd7c736ed56b428f04cd8c161fcc5e7232c130c69a"}, + {file = "frozenlist-1.4.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:068b63f23b17df8569b7fdca5517edef76171cf3897eb68beb01341131fbd2ad"}, + {file = "frozenlist-1.4.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5c849d495bf5154cd8da18a9eb15db127d4dba2968d88831aff6f0331ea9bd4c"}, + {file = "frozenlist-1.4.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9750cc7fe1ae3b1611bb8cfc3f9ec11d532244235d75901fb6b8e42ce9229dfe"}, + {file = "frozenlist-1.4.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a9b2de4cf0cdd5bd2dee4c4f63a653c61d2408055ab77b151c1957f221cabf2a"}, + {file = "frozenlist-1.4.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:0633c8d5337cb5c77acbccc6357ac49a1770b8c487e5b3505c57b949b4b82e98"}, + {file = "frozenlist-1.4.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:27657df69e8801be6c3638054e202a135c7f299267f1a55ed3a598934f6c0d75"}, + {file = "frozenlist-1.4.1-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:f9a3ea26252bd92f570600098783d1371354d89d5f6b7dfd87359d669f2109b5"}, + {file = "frozenlist-1.4.1-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:4f57dab5fe3407b6c0c1cc907ac98e8a189f9e418f3b6e54d65a718aaafe3950"}, + {file = "frozenlist-1.4.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:e02a0e11cf6597299b9f3bbd3f93d79217cb90cfd1411aec33848b13f5c656cc"}, + {file = "frozenlist-1.4.1-cp310-cp310-win32.whl", hash = "sha256:a828c57f00f729620a442881cc60e57cfcec6842ba38e1b19fd3e47ac0ff8dc1"}, + {file = "frozenlist-1.4.1-cp310-cp310-win_amd64.whl", hash = "sha256:f56e2333dda1fe0f909e7cc59f021eba0d2307bc6f012a1ccf2beca6ba362439"}, + {file = "frozenlist-1.4.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:a0cb6f11204443f27a1628b0e460f37fb30f624be6051d490fa7d7e26d4af3d0"}, + {file = "frozenlist-1.4.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b46c8ae3a8f1f41a0d2ef350c0b6e65822d80772fe46b653ab6b6274f61d4a49"}, + {file = "frozenlist-1.4.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:fde5bd59ab5357e3853313127f4d3565fc7dad314a74d7b5d43c22c6a5ed2ced"}, + {file = "frozenlist-1.4.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:722e1124aec435320ae01ee3ac7bec11a5d47f25d0ed6328f2273d287bc3abb0"}, + {file = "frozenlist-1.4.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2471c201b70d58a0f0c1f91261542a03d9a5e088ed3dc6c160d614c01649c106"}, + {file = "frozenlist-1.4.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c757a9dd70d72b076d6f68efdbb9bc943665ae954dad2801b874c8c69e185068"}, + {file = "frozenlist-1.4.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f146e0911cb2f1da549fc58fc7bcd2b836a44b79ef871980d605ec392ff6b0d2"}, + {file = "frozenlist-1.4.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4f9c515e7914626b2a2e1e311794b4c35720a0be87af52b79ff8e1429fc25f19"}, + {file = "frozenlist-1.4.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:c302220494f5c1ebeb0912ea782bcd5e2f8308037b3c7553fad0e48ebad6ad82"}, + {file = "frozenlist-1.4.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:442acde1e068288a4ba7acfe05f5f343e19fac87bfc96d89eb886b0363e977ec"}, + {file = "frozenlist-1.4.1-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:1b280e6507ea8a4fa0c0a7150b4e526a8d113989e28eaaef946cc77ffd7efc0a"}, + {file = "frozenlist-1.4.1-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:fe1a06da377e3a1062ae5fe0926e12b84eceb8a50b350ddca72dc85015873f74"}, + {file = "frozenlist-1.4.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:db9e724bebd621d9beca794f2a4ff1d26eed5965b004a97f1f1685a173b869c2"}, + {file = "frozenlist-1.4.1-cp311-cp311-win32.whl", hash = "sha256:e774d53b1a477a67838a904131c4b0eef6b3d8a651f8b138b04f748fccfefe17"}, + {file = "frozenlist-1.4.1-cp311-cp311-win_amd64.whl", hash = "sha256:fb3c2db03683b5767dedb5769b8a40ebb47d6f7f45b1b3e3b4b51ec8ad9d9825"}, + {file = "frozenlist-1.4.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:1979bc0aeb89b33b588c51c54ab0161791149f2461ea7c7c946d95d5f93b56ae"}, + {file = "frozenlist-1.4.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:cc7b01b3754ea68a62bd77ce6020afaffb44a590c2289089289363472d13aedb"}, + {file = "frozenlist-1.4.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:c9c92be9fd329ac801cc420e08452b70e7aeab94ea4233a4804f0915c14eba9b"}, + {file = "frozenlist-1.4.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5c3894db91f5a489fc8fa6a9991820f368f0b3cbdb9cd8849547ccfab3392d86"}, + {file = "frozenlist-1.4.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ba60bb19387e13597fb059f32cd4d59445d7b18b69a745b8f8e5db0346f33480"}, + {file = "frozenlist-1.4.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8aefbba5f69d42246543407ed2461db31006b0f76c4e32dfd6f42215a2c41d09"}, + {file = "frozenlist-1.4.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:780d3a35680ced9ce682fbcf4cb9c2bad3136eeff760ab33707b71db84664e3a"}, + {file = "frozenlist-1.4.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9acbb16f06fe7f52f441bb6f413ebae6c37baa6ef9edd49cdd567216da8600cd"}, + {file = "frozenlist-1.4.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:23b701e65c7b36e4bf15546a89279bd4d8675faabc287d06bbcfac7d3c33e1e6"}, + {file = "frozenlist-1.4.1-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:3e0153a805a98f5ada7e09826255ba99fb4f7524bb81bf6b47fb702666484ae1"}, + {file = "frozenlist-1.4.1-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:dd9b1baec094d91bf36ec729445f7769d0d0cf6b64d04d86e45baf89e2b9059b"}, + {file = "frozenlist-1.4.1-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:1a4471094e146b6790f61b98616ab8e44f72661879cc63fa1049d13ef711e71e"}, + {file = "frozenlist-1.4.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:5667ed53d68d91920defdf4035d1cdaa3c3121dc0b113255124bcfada1cfa1b8"}, + {file = "frozenlist-1.4.1-cp312-cp312-win32.whl", hash = "sha256:beee944ae828747fd7cb216a70f120767fc9f4f00bacae8543c14a6831673f89"}, + {file = "frozenlist-1.4.1-cp312-cp312-win_amd64.whl", hash = "sha256:64536573d0a2cb6e625cf309984e2d873979709f2cf22839bf2d61790b448ad5"}, + {file = "frozenlist-1.4.1-py3-none-any.whl", hash = "sha256:04ced3e6a46b4cfffe20f9ae482818e34eba9b5fb0ce4056e4cc9b6e212d09b7"}, + {file = "frozenlist-1.4.1.tar.gz", hash = "sha256:c037a86e8513059a2613aaba4d817bb90b9d9b6b69aace3ce9c877e8c8ed402b"}, +] + [[package]] name = "greenlet" version = "3.0.1" @@ -488,34 +642,34 @@ files = [ [[package]] name = "httpx" -version = "0.25.1" +version = "0.25.2" requires_python = ">=3.8" summary = "The next generation HTTP client." dependencies = [ "anyio", "certifi", - "httpcore", + "httpcore==1.*", "idna", "sniffio", ] files = [ - {file = "httpx-0.25.1-py3-none-any.whl", hash = "sha256:fec7d6cc5c27c578a391f7e87b9aa7d3d8fbcd034f6399f9f79b45bcc12a866a"}, - {file = "httpx-0.25.1.tar.gz", hash = "sha256:ffd96d5cf901e63863d9f1b4b6807861dbea4d301613415d9e6e57ead15fc5d0"}, + {file = "httpx-0.25.2-py3-none-any.whl", hash = "sha256:a05d3d052d9b2dfce0e3896636467f8a5342fb2b902c819428e1ac65413ca118"}, + {file = "httpx-0.25.2.tar.gz", hash = "sha256:8b8fcaa0c8ea7b05edd69a094e63a2094c4efcb48129fb757361bc423c0ad9e8"}, ] [[package]] name = "httpx" -version = "0.25.1" +version = "0.25.2" extras = ["http2"] requires_python = ">=3.8" summary = "The next generation HTTP client." dependencies = [ "h2<5,>=3", - "httpx==0.25.1", + "httpx==0.25.2", ] files = [ - {file = "httpx-0.25.1-py3-none-any.whl", hash = "sha256:fec7d6cc5c27c578a391f7e87b9aa7d3d8fbcd034f6399f9f79b45bcc12a866a"}, - {file = "httpx-0.25.1.tar.gz", hash = "sha256:ffd96d5cf901e63863d9f1b4b6807861dbea4d301613415d9e6e57ead15fc5d0"}, + {file = "httpx-0.25.2-py3-none-any.whl", hash = "sha256:a05d3d052d9b2dfce0e3896636467f8a5342fb2b902c819428e1ac65413ca118"}, + {file = "httpx-0.25.2.tar.gz", hash = "sha256:8b8fcaa0c8ea7b05edd69a094e63a2094c4efcb48129fb757361bc423c0ad9e8"}, ] [[package]] @@ -560,12 +714,12 @@ files = [ [[package]] name = "isort" -version = "5.12.0" +version = "5.13.2" requires_python = ">=3.8.0" summary = "A Python utility / library to sort Python imports." files = [ - {file = "isort-5.12.0-py3-none-any.whl", hash = "sha256:f84c2818376e66cf843d497486ea8fed8700b340f308f076c6fb1229dff318b6"}, - {file = "isort-5.12.0.tar.gz", hash = "sha256:8bef7dde241278824a6d83f44a544709b065191b95b6e50894bdc722fcba0504"}, + {file = "isort-5.13.2-py3-none-any.whl", hash = "sha256:8ca5e72a8d85860d5a3fa69b8745237f2939afe12dbf656afbcb47fe72d947a6"}, + {file = "isort-5.13.2.tar.gz", hash = "sha256:48fdfcb9face5d58a4f6dde2e72a1fb8dcaf8ab26f95ab49fab84c2ddefb0109"}, ] [[package]] @@ -763,7 +917,7 @@ files = [ [[package]] name = "nb-cli" -version = "1.2.6" +version = "1.2.8" requires_python = ">=3.8, <4.0" summary = "CLI for nonebot2" dependencies = [ @@ -783,8 +937,8 @@ dependencies = [ "wcwidth~=0.2", ] files = [ - {file = "nb-cli-1.2.6.tar.gz", hash = "sha256:33ca8ffdb721ea50751c47788789c84cd7594afc888ccfb2439f06ff95cbbd7c"}, - {file = "nb_cli-1.2.6-py3-none-any.whl", hash = "sha256:2aa52e0d21fb8a5a08662b691fa6cd521c99140aa0e24a81503264129f4b3045"}, + {file = "nb-cli-1.2.8.tar.gz", hash = "sha256:8e17c73ca494ce16b3a18a18d4d611b5ffb27e37ee3de2c7a510c7e32b7df002"}, + {file = "nb_cli-1.2.8-py3-none-any.whl", hash = "sha256:080a07c4bb94f93a662844d7f1fe8b9672cb61daf6a9c3ae74bbc42ed17a35a7"}, ] [[package]] @@ -831,19 +985,19 @@ files = [ [[package]] name = "nonebot-plugin-alconna" -version = "0.33.5" +version = "0.34.1" requires_python = ">=3.8" summary = "Alconna Adapter for Nonebot" dependencies = [ "arclet-alconna-tools<0.7.0,>=0.6.7", - "arclet-alconna<2.0.0,>=1.7.31", + "arclet-alconna<2.0.0,>=1.7.38", "fleep>=1.0.1", "nepattern<0.6.0,>=0.5.14", "nonebot2>=2.1.0", ] files = [ - {file = "nonebot_plugin_alconna-0.33.5-py3-none-any.whl", hash = "sha256:57414d52fbe586479c6a372a58213346ceeccf7aeec261a18df5351f9a489069"}, - {file = "nonebot_plugin_alconna-0.33.5.tar.gz", hash = "sha256:ecb5213402cff4cd93a04e7a8c618d434972ca144eb2a6010df6e85b47f520fa"}, + {file = "nonebot_plugin_alconna-0.34.1-py3-none-any.whl", hash = "sha256:c8e71ffad194e30f14ae7a53e29483b2a59328df2fc8d4ba9e1c407f2f76bf0d"}, + {file = "nonebot_plugin_alconna-0.34.1.tar.gz", hash = "sha256:12a8809bd3ee96ecaa25b20ad3950f7078eb1d109ad2f6656c581ddcdb3244d6"}, ] [[package]] @@ -892,7 +1046,7 @@ files = [ [[package]] name = "nonebot-plugin-send-anything-anywhere" -version = "0.3.2" +version = "0.4.0" requires_python = ">=3.8,<4.0" summary = "An adaptor for nonebot2 adaptors" dependencies = [ @@ -902,37 +1056,37 @@ dependencies = [ "strenum<0.5.0,>=0.4.8", ] files = [ - {file = "nonebot_plugin_send_anything_anywhere-0.3.2-py3-none-any.whl", hash = "sha256:2dac60653f49aa25f3a08eb75544ecb155e30b2496f1f7a16e27ddc76ff09796"}, - {file = "nonebot_plugin_send_anything_anywhere-0.3.2.tar.gz", hash = "sha256:19a54c8f69d01f2000b1f2536eea4076acd8fe219f7f0d9060a8120bd7052d52"}, + {file = "nonebot_plugin_send_anything_anywhere-0.4.0-py3-none-any.whl", hash = "sha256:d089729458e247d4717db195fe679ca2d47b86394f1dc20ce9f06eea300c2227"}, + {file = "nonebot_plugin_send_anything_anywhere-0.4.0.tar.gz", hash = "sha256:c72d4cfbed963ba07a9e29cb40fd0174dce01a49f6f9944f4bbfda0bb8322630"}, ] [[package]] name = "nonebot-plugin-session" -version = "0.2.0" +version = "0.2.3" requires_python = ">=3.8,<4.0" summary = "Nonebot2 会话信息提取与会话id定义" dependencies = [ - "nonebot2[fastapi]<3.0.0,>=2.0.0", + "nonebot2<3.0.0,>=2.0.0", "strenum<0.5.0,>=0.4.8", ] files = [ - {file = "nonebot_plugin_session-0.2.0-py3-none-any.whl", hash = "sha256:00859872b7c7d2967e1eaabf161c8a47dc83bc85791629b659922b2f425d4854"}, - {file = "nonebot_plugin_session-0.2.0.tar.gz", hash = "sha256:5f92706dfeb6e21dcce04998bc3b8dafc59f5af50d2908aceeed0faf9d88a67c"}, + {file = "nonebot_plugin_session-0.2.3-py3-none-any.whl", hash = "sha256:5f652a0c082231c1cea72deb994a81e50f77ba532e14d30fdec09772f69079fd"}, + {file = "nonebot_plugin_session-0.2.3.tar.gz", hash = "sha256:33af37400f5005927c4ff861e593774bedc314fba00cfe06f482e582d9f447b7"}, ] [[package]] name = "nonebot-plugin-session-saa" -version = "0.1.0" +version = "0.1.1" requires_python = ">=3.8,<4.0" summary = "session 插件 saa 扩展" dependencies = [ - "nonebot-plugin-send-anything-anywhere<0.4.0,>=0.3.1", + "nonebot-plugin-send-anything-anywhere<0.5.0,>=0.4.0", "nonebot-plugin-session<0.3.0,>=0.2.0", "nonebot2[fastapi]<3.0.0,>=2.0.1", ] files = [ - {file = "nonebot_plugin_session_saa-0.1.0-py3-none-any.whl", hash = "sha256:eb067e1e81261f85aae550a37aad1d6e1be20c64b78e60c34812d2d44fed487d"}, - {file = "nonebot_plugin_session_saa-0.1.0.tar.gz", hash = "sha256:a278ed490160722d6e1e0c165993a9ee3fed093814e87fdb6a2a0cc20fb5d2d4"}, + {file = "nonebot_plugin_session_saa-0.1.1-py3-none-any.whl", hash = "sha256:ba9666bf49534df6129dd9170b55d20cbc80b86693a1370948dcf210a5feabce"}, + {file = "nonebot_plugin_session_saa-0.1.1.tar.gz", hash = "sha256:d0fc55d91e5ca2a21948069816b82cb94d7091a45b345d89f3eaf08c3ffb8579"}, ] [[package]] @@ -1056,8 +1210,8 @@ files = [ [[package]] name = "pre-commit" -version = "3.5.0" -requires_python = ">=3.8" +version = "3.6.0" +requires_python = ">=3.9" summary = "A framework for managing and maintaining multi-language pre-commit hooks." dependencies = [ "cfgv>=2.0.0", @@ -1067,8 +1221,8 @@ dependencies = [ "virtualenv>=20.10.0", ] files = [ - {file = "pre_commit-3.5.0-py2.py3-none-any.whl", hash = "sha256:841dc9aef25daba9a0238cd27984041fa0467b4199fc4852e27950664919f660"}, - {file = "pre_commit-3.5.0.tar.gz", hash = "sha256:5804465c675b659b0862f07907f96295d490822a450c4c40e747d0b1c6ebcb32"}, + {file = "pre_commit-3.6.0-py2.py3-none-any.whl", hash = "sha256:c255039ef399049a5544b6ce13d135caba8f2c28c3b4033277a788f434308376"}, + {file = "pre_commit-3.6.0.tar.gz", hash = "sha256:d30bad9abf165f7785c15a21a1f46da7d0677cb00ee7ff4c579fd38922efe15d"}, ] [[package]] @@ -1188,20 +1342,20 @@ files = [ [[package]] name = "pytest-asyncio" -version = "0.21.1" -requires_python = ">=3.7" +version = "0.23.2" +requires_python = ">=3.8" summary = "Pytest support for asyncio" dependencies = [ "pytest>=7.0.0", ] files = [ - {file = "pytest-asyncio-0.21.1.tar.gz", hash = "sha256:40a7eae6dded22c7b604986855ea48400ab15b069ae38116e8c01238e9eeb64d"}, - {file = "pytest_asyncio-0.21.1-py3-none-any.whl", hash = "sha256:8666c1c8ac02631d7c51ba282e0c69a8a452b211ffedf2599099845da5c5c37b"}, + {file = "pytest-asyncio-0.23.2.tar.gz", hash = "sha256:c16052382554c7b22d48782ab3438d5b10f8cf7a4bdcae7f0f67f097d95beecc"}, + {file = "pytest_asyncio-0.23.2-py3-none-any.whl", hash = "sha256:ea9021364e32d58f0be43b91c6233fb8d2224ccef2398d6837559e587682808f"}, ] [[package]] name = "pytest-xdist" -version = "3.4.0" +version = "3.5.0" requires_python = ">=3.7" summary = "pytest xdist plugin for distributed testing, most importantly across multiple CPUs" dependencies = [ @@ -1209,8 +1363,8 @@ dependencies = [ "pytest>=6.2.0", ] files = [ - {file = "pytest-xdist-3.4.0.tar.gz", hash = "sha256:3a94a931dd9e268e0b871a877d09fe2efb6175c2c23d60d56a6001359002b832"}, - {file = "pytest_xdist-3.4.0-py3-none-any.whl", hash = "sha256:e513118bf787677a427e025606f55e95937565e06dfaac8d87f55301e57ae607"}, + {file = "pytest-xdist-3.5.0.tar.gz", hash = "sha256:cbb36f3d67e0c478baa57fa4edc8843887e0f6cfc42d677530a36d7472b32d8a"}, + {file = "pytest_xdist-3.5.0-py3-none-any.whl", hash = "sha256:d075629c7e00b611df89f490a5063944bee7a4362a5ff11c7cc7824a03dfce24"}, ] [[package]] @@ -1321,27 +1475,27 @@ files = [ [[package]] name = "ruff" -version = "0.1.6" +version = "0.1.8" requires_python = ">=3.7" summary = "An extremely fast Python linter and code formatter, written in Rust." files = [ - {file = "ruff-0.1.6-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:88b8cdf6abf98130991cbc9f6438f35f6e8d41a02622cc5ee130a02a0ed28703"}, - {file = "ruff-0.1.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:5c549ed437680b6105a1299d2cd30e4964211606eeb48a0ff7a93ef70b902248"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1cf5f701062e294f2167e66d11b092bba7af6a057668ed618a9253e1e90cfd76"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:05991ee20d4ac4bb78385360c684e4b417edd971030ab12a4fbd075ff535050e"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:87455a0c1f739b3c069e2f4c43b66479a54dea0276dd5d4d67b091265f6fd1dc"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:683aa5bdda5a48cb8266fcde8eea2a6af4e5700a392c56ea5fb5f0d4bfdc0240"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:137852105586dcbf80c1717facb6781555c4e99f520c9c827bd414fac67ddfb6"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:bd98138a98d48a1c36c394fd6b84cd943ac92a08278aa8ac8c0fdefcf7138f35"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a0cd909d25f227ac5c36d4e7e681577275fb74ba3b11d288aff7ec47e3ae745"}, - {file = "ruff-0.1.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:e8fd1c62a47aa88a02707b5dd20c5ff20d035d634aa74826b42a1da77861b5ff"}, - {file = "ruff-0.1.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:fd89b45d374935829134a082617954120d7a1470a9f0ec0e7f3ead983edc48cc"}, - {file = "ruff-0.1.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:491262006e92f825b145cd1e52948073c56560243b55fb3b4ecb142f6f0e9543"}, - {file = "ruff-0.1.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:ea284789861b8b5ca9d5443591a92a397ac183d4351882ab52f6296b4fdd5462"}, - {file = "ruff-0.1.6-py3-none-win32.whl", hash = "sha256:1610e14750826dfc207ccbcdd7331b6bd285607d4181df9c1c6ae26646d6848a"}, - {file = "ruff-0.1.6-py3-none-win_amd64.whl", hash = "sha256:4558b3e178145491e9bc3b2ee3c4b42f19d19384eaa5c59d10acf6e8f8b57e33"}, - {file = "ruff-0.1.6-py3-none-win_arm64.whl", hash = "sha256:03910e81df0d8db0e30050725a5802441c2022ea3ae4fe0609b76081731accbc"}, - {file = "ruff-0.1.6.tar.gz", hash = "sha256:1b09f29b16c6ead5ea6b097ef2764b42372aebe363722f1605ecbcd2b9207184"}, + {file = "ruff-0.1.8-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:7de792582f6e490ae6aef36a58d85df9f7a0cfd1b0d4fe6b4fb51803a3ac96fa"}, + {file = "ruff-0.1.8-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:c8e3255afd186c142eef4ec400d7826134f028a85da2146102a1172ecc7c3696"}, + {file = "ruff-0.1.8-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ff78a7583020da124dd0deb835ece1d87bb91762d40c514ee9b67a087940528b"}, + {file = "ruff-0.1.8-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bd8ee69b02e7bdefe1e5da2d5b6eaaddcf4f90859f00281b2333c0e3a0cc9cd6"}, + {file = "ruff-0.1.8-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a05b0ddd7ea25495e4115a43125e8a7ebed0aa043c3d432de7e7d6e8e8cd6448"}, + {file = "ruff-0.1.8-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:e6f08ca730f4dc1b76b473bdf30b1b37d42da379202a059eae54ec7fc1fbcfed"}, + {file = "ruff-0.1.8-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f35960b02df6b827c1b903091bb14f4b003f6cf102705efc4ce78132a0aa5af3"}, + {file = "ruff-0.1.8-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7d076717c67b34c162da7c1a5bda16ffc205e0e0072c03745275e7eab888719f"}, + {file = "ruff-0.1.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b6a21ab023124eafb7cef6d038f835cb1155cd5ea798edd8d9eb2f8b84be07d9"}, + {file = "ruff-0.1.8-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:ce697c463458555027dfb194cb96d26608abab920fa85213deb5edf26e026664"}, + {file = "ruff-0.1.8-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:db6cedd9ffed55548ab313ad718bc34582d394e27a7875b4b952c2d29c001b26"}, + {file = "ruff-0.1.8-py3-none-musllinux_1_2_i686.whl", hash = "sha256:05ffe9dbd278965271252704eddb97b4384bf58b971054d517decfbf8c523f05"}, + {file = "ruff-0.1.8-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:5daaeaf00ae3c1efec9742ff294b06c3a2a9db8d3db51ee4851c12ad385cda30"}, + {file = "ruff-0.1.8-py3-none-win32.whl", hash = "sha256:e49fbdfe257fa41e5c9e13c79b9e79a23a79bd0e40b9314bc53840f520c2c0b3"}, + {file = "ruff-0.1.8-py3-none-win_amd64.whl", hash = "sha256:f41f692f1691ad87f51708b823af4bb2c5c87c9248ddd3191c8f088e66ce590a"}, + {file = "ruff-0.1.8-py3-none-win_arm64.whl", hash = "sha256:aa8ee4f8440023b0a6c3707f76cadce8657553655dcbb5fc9b2f9bb9bee389f6"}, + {file = "ruff-0.1.8.tar.gz", hash = "sha256:f7ee467677467526cfe135eab86a40a0e8db43117936ac4f9b469ce9cdb3fb62"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index dbd74ff..9975be1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "nonebot-plugin-skland-arksign" -version = "0.6.4" +version = "0.7.0" description = "用于每日定时签到森空岛明日方舟的Nonebot插件" authors = [ {name = "GuGuMur", email = "222153315@qq.com"}, @@ -8,14 +8,14 @@ authors = [ ] dependencies = [ "nonebot2>=2.1.2", - "httpx>=0.25.1", + "httpx>=0.25.2", "pydantic>=1.10.13", "nonebot-plugin-apscheduler>=0.3.0", - "nonebot-plugin-alconna>=0.33.5", + "nonebot-plugin-alconna>=0.34.1", "nonebot-plugin-datastore>=1.1.2", - "nonebot-plugin-session>=0.2.0", - "nonebot-plugin-session-saa>=0.1.0", - "nonebot-plugin-send-anything-anywhere>=0.3.2", + "nonebot-plugin-session>=0.2.3", + "nonebot-plugin-session-saa>=0.1.1", + "nonebot-plugin-send-anything-anywhere>=0.4.0", ] requires-python = ">=3.10" readme = "README.md" @@ -32,18 +32,18 @@ build-backend = "pdm.backend" [tool.pdm.dev-dependencies] dev = [ - "pre-commit>=3.5.0", - "black>=23.11.0", - "ruff>=0.1.6", - "isort>=5.12.0", - "nb-cli>=1.2.6", + "pre-commit>=3.6.0", + "black>=23.12.0", + "ruff>=0.1.8", + "isort>=5.13.2", + "nb-cli>=1.2.8", "nonebot-adapter-onebot>=2.3.1", ] test = [ "nonebug>=0.3.5", "pytest>=7.4.3", - "pytest-asyncio>=0.21.1", - "pytest-xdist>=3.4.0", + "pytest-asyncio>=0.23.2", + "pytest-xdist>=3.5.0", ] [tool.nonebot] From 581f598c3c942c1cdfd3b3751db2252a9d0aff00 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 17 Dec 2023 09:15:48 +0000 Subject: [PATCH 02/18] :lipstick: auto fix by pre-commit hooks --- nonebot_plugin_skland_arksign/command.py | 5 +++-- .../migrations/b488a7927868_remove_unique_note.py | 2 -- .../migrations/f9eda5d9d24e_database_update.py | 7 ++----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/nonebot_plugin_skland_arksign/command.py b/nonebot_plugin_skland_arksign/command.py index f79a22a..ea02281 100644 --- a/nonebot_plugin_skland_arksign/command.py +++ b/nonebot_plugin_skland_arksign/command.py @@ -1,23 +1,24 @@ from typing import TYPE_CHECKING + from sqlalchemy import select from nonebot.log import logger from nonebot.params import Depends from nonebot.typing import T_State from nonebot.adapters import Bot, Event from nonebot.permission import SUPERUSER -from nonebot_plugin_alconna import on_alconna, AlconnaMatcher, UniMessage from sqlalchemy.ext.asyncio import AsyncSession from nonebot_plugin_datastore import get_session from nonebot_plugin_saa import Text, PlatformTarget from nonebot_plugin_session_saa import get_saa_target from nonebot_plugin_session import EventSession, extract_session +from nonebot_plugin_alconna import UniMessage, AlconnaMatcher, on_alconna -from .utils import cleantext, report_maker, compare_user_info from .sched import sched_sign from .signin import run_signin from .alc_parser import skland_alc from .model import SklandSubscribe from .depends import skland_session_extract +from .utils import cleantext, report_maker, compare_user_info SessionId1 = str BindUid = str diff --git a/nonebot_plugin_skland_arksign/migrations/b488a7927868_remove_unique_note.py b/nonebot_plugin_skland_arksign/migrations/b488a7927868_remove_unique_note.py index 29a1a25..2477178 100644 --- a/nonebot_plugin_skland_arksign/migrations/b488a7927868_remove_unique_note.py +++ b/nonebot_plugin_skland_arksign/migrations/b488a7927868_remove_unique_note.py @@ -7,8 +7,6 @@ """ from alembic import op -import sqlalchemy as sa - # revision identifiers, used by Alembic. revision = "b488a7927868" diff --git a/nonebot_plugin_skland_arksign/migrations/f9eda5d9d24e_database_update.py b/nonebot_plugin_skland_arksign/migrations/f9eda5d9d24e_database_update.py index 1c64749..a9cf389 100644 --- a/nonebot_plugin_skland_arksign/migrations/f9eda5d9d24e_database_update.py +++ b/nonebot_plugin_skland_arksign/migrations/f9eda5d9d24e_database_update.py @@ -6,10 +6,9 @@ """ -from alembic import op import sqlalchemy as sa -from sqlalchemy.dialects import postgresql -from sqlalchemy.dialects import sqlite +from alembic import op +from sqlalchemy.dialects import sqlite, postgresql # revision identifiers, used by Alembic. revision = "f9eda5d9d24e" @@ -30,7 +29,6 @@ def upgrade() -> None: batch_op.alter_column("user", existing_type=sqlite.JSON(), nullable=True) - def downgrade() -> None: with op.batch_alter_table("skland_subscribe", schema=None) as batch_op: batch_op.alter_column("user", existing_type=sqlite.JSON(), nullable=False) @@ -38,4 +36,3 @@ def downgrade() -> None: op.execute("UPDATE skland_subscribe SET user = sendto") with op.batch_alter_table("skland_subscribe", schema=None) as batch_op: batch_op.drop_column("sendto") - From 25ee373f8d8a71d2421a10afe4dbf7011ee4a8ba Mon Sep 17 00:00:00 2001 From: Cateon Huo <2221533105@qq.com> Date: Sun, 24 Dec 2023 11:15:53 +0800 Subject: [PATCH 03/18] tweak --- README.md | 1 + nonebot_plugin_skland_arksign/__init__.py | 4 + nonebot_plugin_skland_arksign/alc_parser.py | 12 +- nonebot_plugin_skland_arksign/command.py | 226 +++++------------- nonebot_plugin_skland_arksign/depends.py | 64 ++++++ nonebot_plugin_skland_arksign/utils.py | 7 +- pdm.lock | 239 ++++---------------- pyproject.toml | 6 +- 8 files changed, 184 insertions(+), 375 deletions(-) diff --git a/README.md b/README.md index 62ca616..b6a5b4d 100644 --- a/README.md +++ b/README.md @@ -224,6 +224,7 @@ skland signin !all 4. 报错`Client error '400 Bad Request' for url xxx`? - 请检查token复制过程中是否有错漏,以及游戏账号ID是否与您输入的token相符 +- 参考[#立即手动签到](#立即手动签到) 一栏执行手动签到操作 5. 报错`Client error '401 Unauthorized' for url xxx`? diff --git a/nonebot_plugin_skland_arksign/__init__.py b/nonebot_plugin_skland_arksign/__init__.py index 6d6e4d7..a0c1adb 100644 --- a/nonebot_plugin_skland_arksign/__init__.py +++ b/nonebot_plugin_skland_arksign/__init__.py @@ -11,6 +11,10 @@ from nonebot_plugin_saa import enable_auto_select_bot from .command import skland as skland +# from .command import skland_del as skland_del +# from .command import skland_list as skland_list +# from .command import skland_update as skland_update +# from .command import skland_signin as skland_signin from .sched import scheduler as scheduler enable_auto_select_bot() diff --git a/nonebot_plugin_skland_arksign/alc_parser.py b/nonebot_plugin_skland_arksign/alc_parser.py index 4dacee4..cfcfc9f 100644 --- a/nonebot_plugin_skland_arksign/alc_parser.py +++ b/nonebot_plugin_skland_arksign/alc_parser.py @@ -2,7 +2,7 @@ from .config import plugin_config -skland_alc = Alconna( +skland_cmd = Alconna( "skland", Subcommand( "add", @@ -10,6 +10,11 @@ Option("-n|--note", Args["note", str]), help_text="添加一个新的签到账号", ), + Subcommand( + "bind", + Args["token", str], + help_text="在私聊绑定一个在群聊中添加的签到账号", + ), Subcommand( "list", help_text="列出所有签到账号", @@ -29,11 +34,6 @@ ], help_text="使用uid或者备注更新一个签到账号", ), - Subcommand( - "bind", - Args["token", str], - help_text="在私聊绑定一个在群聊中添加的签到账号", - ), Subcommand( "signin", Args["identifier", str]["position?", int], diff --git a/nonebot_plugin_skland_arksign/command.py b/nonebot_plugin_skland_arksign/command.py index ea02281..7487e33 100644 --- a/nonebot_plugin_skland_arksign/command.py +++ b/nonebot_plugin_skland_arksign/command.py @@ -1,24 +1,22 @@ -from typing import TYPE_CHECKING - from sqlalchemy import select from nonebot.log import logger from nonebot.params import Depends from nonebot.typing import T_State from nonebot.adapters import Bot, Event from nonebot.permission import SUPERUSER +from nonebot_plugin_alconna import on_alconna, AlconnaMatcher, UniMessage, AlconnaArg from sqlalchemy.ext.asyncio import AsyncSession from nonebot_plugin_datastore import get_session from nonebot_plugin_saa import Text, PlatformTarget from nonebot_plugin_session_saa import get_saa_target -from nonebot_plugin_session import EventSession, extract_session -from nonebot_plugin_alconna import UniMessage, AlconnaMatcher, on_alconna +from nonebot_plugin_session import EventSession +from .utils import cleantext, report_maker, compare_user_info from .sched import sched_sign from .signin import run_signin -from .alc_parser import skland_alc +from .alc_parser import skland_cmd from .model import SklandSubscribe -from .depends import skland_session_extract -from .utils import cleantext, report_maker, compare_user_info +from .depends import skland_session_extract, skland_list_subscribes SessionId1 = str BindUid = str @@ -26,12 +24,16 @@ wait_bind_dict: dict[SessionId1, BindUid] = {} skland = on_alconna( - skland_alc, + skland_cmd, aliases={"skd", "skl", "森空岛"}, use_cmd_start=True, # use_cmd_sep=True, auto_send_output=True, ) +skland_list = skland.dispatch("list") +skland_del = skland.dispatch("del") +skland_update = skland.dispatch("update") +skland_signin = skland.dispatch("signin") @skland.assign("add") @@ -40,7 +42,7 @@ async def add( uid: str, token: str | None = None, note: str | None = None, - event_session: EventSession = Depends(skland_session_extract), + event_session: EventSession = Depends(skland_list_subscribes), db_session: AsyncSession = Depends(get_session), ): logger.debug(f"匹配到的参数:{state}") @@ -108,7 +110,7 @@ async def add( async def bind( state: T_State, token: str, - event_session: EventSession = Depends(skland_session_extract), + event_session: EventSession = Depends(skland_list_subscribes), db_session: AsyncSession = Depends(get_session), ): logger.debug(f"匹配到的参数:{state}") @@ -156,79 +158,53 @@ async def bind( await msg.send_to(PlatformTarget.deserialize(user)) -# 删除功能可以在各处使用 -@skland.assign("del") +@skland_list.handle() +async def list_( + bot: Bot, + event: Event, + state: T_State, + event_session: EventSession = Depends(skland_list_subscribes), + db_session: AsyncSession = Depends(get_session), +): + is_group = state.get("is_group") + all_subscribes: list[SklandSubscribe] = state.get("all_subscribes") + + await skland.finish("您可查询的森空岛签到账号如下:\n" + report_maker(all_subscribes, is_group)) + + +@skland_del.handle() async def del_1( bot: Bot, event: Event, state: T_State, identifier: str, matcher: AlconnaMatcher, - event_session: EventSession = Depends(extract_session), + position: AlconnaArg("position"), + event_session: EventSession = Depends(skland_list_subscribes), db_session: AsyncSession = Depends(get_session), ): is_group = state.get("is_group") - flag: bool = False - # SUPERUSER:返回全部 - if await SUPERUSER(bot, event): - flag = True - stmt = select(SklandSubscribe).where((SklandSubscribe.uid == identifier) | (SklandSubscribe.note == identifier)) - result = (await db_session.scalars(stmt)).all() - if not result: - await skland.finish("未能查询到任何账号,请检查") - - # QQ群管理:返回当前群聊的所有绑定 - if is_group and flag is False: - if not bot.adapter.get_name() == "OneBot V11": - await skland.finish("当前的森空岛签到插件无法提供Onebot V11外的群聊绑定记录...") - if TYPE_CHECKING: - from nonebot.adapters.onebot.v11.bot import Bot as OneBotV11Bot - - assert isinstance(bot, OneBotV11Bot) - from nonebot.adapters.onebot.v11 import GROUP_ADMIN, GROUP_OWNER - - if not (await GROUP_ADMIN(bot, event) or await GROUP_OWNER(bot, event)): - await skland.finish("您不是本群的管理员或群主,无法在此进行删除账号操作!") - - stmt = select(SklandSubscribe).where( - SklandSubscribe.sendto.group_id == event_session.id2 - and (SklandSubscribe.uid == identifier) | (SklandSubscribe.note == identifier) - ) - result = (await db_session.scalars(stmt)).all() - if not result: - await skland.finish("未能查询到任何账号,请检查") - state["prompt"] = ( - "本群可删除的森空岛签到账号如下:\n" + report_maker(list(result), is_group) + "请输入对应序号完成删除操作!" - ) - - # 普通用户的list:返回该用户绑定的所有账号 - if flag is False: - stmt = select(SklandSubscribe).where((SklandSubscribe.uid == identifier) | (SklandSubscribe.note == identifier)) - result: list[SklandSubscribe] = (await db_session.scalars(stmt)).all() - - result = [i for i in result if compare_user_info(i.user, event_session.dict())] - if not result: - await skland.finish("未能查询到任何账号,请检查") - if len(result) == 1: - matcher.set_path_arg("position", 0) + all_subscribes: list[SklandSubscribe] = state.get("all_subscribes") + all_subscribes = [i for i in all_subscribes if (i.uid == identifier) | (i.note == identifier)] state["prompt"] = ( - "您可手动删除的森空岛签到账号如下:\n" + report_maker(list(result), is_group) + "请输入对应序号完成删除操作!" + "您可执行操作的森空岛签到账号如下:\n" + report_maker(all_subscribes, is_group) + "\n请输入对应序号完成操作!" ) - state["all_accounts"] = result + if len(all_subscribes) == 1: + matcher.set_path_arg("position", 0) -@skland.got_path("~del.position", prompt=UniMessage.template("{prompt}")) +@skland_del.got_path("position", prompt=UniMessage.template("{prompt}")) async def del_2( bot: Bot, event: Event, state: T_State, matcher: AlconnaMatcher, - position: int, - event_session: EventSession = Depends(skland_session_extract), + position: int = AlconnaArg("position"), + event_session: EventSession = Depends(skland_list_subscribes), db_session: AsyncSession = Depends(get_session), ): - result = state["all_accounts"][position] + result = state["all_subscribes"][position] uid = result.uid note = result.note or "无" await db_session.delete(result) @@ -241,55 +217,7 @@ async def del_2( """)) -@skland.assign("list", parameterless=[Depends(skland_session_extract)]) -async def list_( - bot: Bot, - event: Event, - state: T_State, - event_session: EventSession = Depends(skland_session_extract), - db_session: AsyncSession = Depends(get_session), -): - is_group = state.get("is_group") - flag: bool = False - # SUPERUSER 的 list:返回全部 - if await SUPERUSER(bot, event): - flag = True - stmt = select(SklandSubscribe) - result = (await db_session.scalars(stmt)).all() - if not result: - await skland.finish("未能查询到任何账号,请检查") - await skland.finish("机器人绑定的所有森空岛签到账号如下:" + report_maker(list(result), is_group)) - - # QQ群管理的list:返回当前群聊的所有绑定 - if is_group and flag is False: - if not bot.adapter.get_name() == "OneBot V11": - await skland.finish("当前的森空岛签到插件无法提供Onebot V11外的群聊绑定记录...") - if TYPE_CHECKING: - from nonebot.adapters.onebot.v11.bot import Bot as OneBotV11Bot - - assert isinstance(bot, OneBotV11Bot) - from nonebot.adapters.onebot.v11 import GROUP_ADMIN, GROUP_OWNER - - if not (await GROUP_ADMIN(bot, event) or await GROUP_OWNER(bot, event)): - await skland.finish("您不是本群的管理员或群主,请通过私聊获取您的个人绑定记录!") - - stmt = select(SklandSubscribe).where(SklandSubscribe.sendto.group_id == event_session.id2) - result = (await db_session.scalars(stmt)).all() - if not result: - await skland.finish("未能查询到任何账号,请检查") - await skland.finish("本群绑定的森空岛签到账号如下:" + report_maker(list(result), is_group)) - - # 普通用户的list:返回该用户绑定的所有账号 - if flag is False: - stmt = select(SklandSubscribe) - result: list[SklandSubscribe] = (await db_session.scalars(stmt)).all() - result = [i for i in result if compare_user_info(i.user, event_session.dict())] - if not result: - await skland.finish("未能查询到任何账号,请检查") - await skland.finish("您绑定的森空岛签到账号如下:" + report_maker(list(result)), is_group) - - -@skland.assign("update", parameterless=[Depends(skland_session_extract)]) +@skland_update.handle() async def update_1( bot: Bot, event: Event, @@ -302,6 +230,7 @@ async def update_1( event_session: EventSession = Depends(skland_session_extract), db_session: AsyncSession = Depends(get_session), ): + # 动token的操作 还是自己来吧 is_group = state.get("is_group") stmt = select(SklandSubscribe).where((SklandSubscribe.uid == identifier) | (SklandSubscribe.note == identifier)) result = (await db_session.scalars(stmt)).all() @@ -315,24 +244,24 @@ async def update_1( state["prompt"] = ( "以下是您能管理的所有账号:\n" + report_maker(result, is_group) + "请回复对应序号来完成您的 update 指令!" ) - state["all_accounts"] = result + state["all_subscribes"] = result -@skland.got_path("~update.position", prompt=UniMessage.template("{prompt}")) +@skland_update.got_path("position", prompt=UniMessage.template("{prompt}")) async def update_2( bot: Bot, event: Event, identifier: str, matcher: AlconnaMatcher, state: T_State, - position: int, + position: int = AlconnaArg("position"), uid: str | None = None, token: str | None = None, note: str | None = None, - event_session: EventSession = Depends(skland_session_extract), + event_session: EventSession = Depends(skland_list_subscribes), db_session: AsyncSession = Depends(get_session), ): - result = state["all_accounts"][position] + result = state["all_subscribes"][position] if uid: result.uid = uid if token: @@ -349,86 +278,45 @@ async def update_2( """)) -@skland.assign("signin.identifier", "!all") +@skland_signin.assign("identifier", "!all") async def signin_all(): await sched_sign() await skland.finish("所有账号已经手动重新触发签到!") # 手动签到功能可以在各处使用 -@skland.assign("signin") +@skland_signin.handle() async def signin_1( bot: Bot, event: Event, state: T_State, identifier: str, matcher: AlconnaMatcher, - event_session: EventSession = Depends(skland_session_extract), + event_session: EventSession = Depends(skland_list_subscribes), db_session: AsyncSession = Depends(get_session), ): is_group = state.get("is_group") - flag: bool = False - - # SUPERUSER:返回全部 - if await SUPERUSER(bot, event): - flag = True - stmt = select(SklandSubscribe).where((SklandSubscribe.uid == identifier) | (SklandSubscribe.note == identifier)) - result = (await db_session.scalars(stmt)).all() - - # QQ群管理:返回当前群聊的所有绑定 - if is_group and flag is False: - if not bot.adapter.get_name() == "OneBot V11": - await skland.finish("当前的森空岛签到插件无法提供Onebot V11外的群聊绑定记录...") - if TYPE_CHECKING: - from nonebot.adapters.onebot.v11.bot import Bot as OneBotV11Bot - - assert isinstance(bot, OneBotV11Bot) - from nonebot.adapters.onebot.v11 import GROUP_ADMIN, GROUP_OWNER - - if not (await GROUP_ADMIN(bot, event) or await GROUP_OWNER(bot, event)): - await skland.finish("您不是本群的管理员或群主,请通过私聊完成您的个人手动签到!") - - stmt = select(SklandSubscribe).where( - SklandSubscribe.sendto.group_id == event_session.id2 - and (SklandSubscribe.uid == identifier) | (SklandSubscribe.note == identifier) - ) - result = (await db_session.scalars(stmt)).all() - if not result: - await skland.finish("未能查询到任何账号,请检查") - state["prompt"] = ( - "本群可手动签到的森空岛签到账号如下:\n" - + report_maker(list(result), is_group) - + "请输入对应序号完成签到操作!" - ) - - # 普通用户的list:返回该用户绑定的所有账号 - if flag is False: - stmt = select(SklandSubscribe).where((SklandSubscribe.uid == identifier) | (SklandSubscribe.note == identifier)) - result: list[SklandSubscribe] = (await db_session.scalars(stmt)).all() - - result = [i for i in result if compare_user_info(i.user, event_session.dict())] - if not result: - await skland.finish("未能查询到任何账号,请检查") - if len(result) == 1: - matcher.set_path_arg("position", 0) + all_subscribes: list[SklandSubscribe] = state.get("all_subscribes") + all_subscribes = [i for i in all_subscribes if (i.uid == identifier) | (i.note == identifier)] state["prompt"] = ( - "您可手动签到的森空岛签到账号如下:\n" + report_maker(list(result), is_group) + "请输入对应序号完成签到操作!" + "您可执行操作的森空岛签到账号如下:\n" + report_maker(all_subscribes, is_group) + "\n请输入对应序号完成操作!" ) - state["all_accounts"] = result + if len(all_subscribes) == 1: + matcher.set_path_arg("position", 0) -@skland.got_path("~signin.position", prompt=UniMessage.template("{prompt}")) +@skland_signin.got_path("position", prompt=UniMessage.template("{prompt}")) async def signin_2( bot: Bot, event: Event, state: T_State, matcher: AlconnaMatcher, - position: int, - event_session: EventSession = Depends(skland_session_extract), + position: int = AlconnaArg("position"), + event_session: EventSession = Depends(skland_list_subscribes), db_session: AsyncSession = Depends(get_session), ): - result = state["all_accounts"][position] + result = state["all_subscribes"][position] sign_res = await run_signin(uid=result.uid, token=result.token) await skland.finish(cleantext(f""" [森空岛明日方舟签到器]已为账号{result.uid}手动签到! diff --git a/nonebot_plugin_skland_arksign/depends.py b/nonebot_plugin_skland_arksign/depends.py index 3f31fd7..97390cf 100644 --- a/nonebot_plugin_skland_arksign/depends.py +++ b/nonebot_plugin_skland_arksign/depends.py @@ -1,7 +1,17 @@ from nonebot.typing import T_State +from typing import TYPE_CHECKING +from nonebot.permission import SUPERUSER + +from nonebot.params import Depends from nonebot.matcher import Matcher from nonebot.adapters import Bot, Event from nonebot_plugin_session import Session, SessionLevel, extract_session +from sqlalchemy import select +from sqlalchemy.ext.asyncio import AsyncSession +from nonebot_plugin_datastore import get_session + +from .utils import compare_user_info +from .model import SklandSubscribe from .config import plugin_config @@ -19,3 +29,57 @@ async def skland_session_extract(bot: Bot, event: Event, matcher: Matcher, state await matcher.finish("请在私聊中使用该指令!") return session + + +async def skland_list_subscribes( + bot: Bot, + event: Event, + matcher: Matcher, + state: T_State, + db_session: AsyncSession = Depends(get_session), +) -> Session: + """ + 根据用户组生成其能获取的订阅列表,文本生成逻辑应写在业务处 + """ + event_session = skland_session_extract(bot, event, matcher, state) + is_group = state.get("is_group") + flag: bool = False + # SUPERUSER 的 list:返回全部 + if await SUPERUSER(bot, event): + flag = True + stmt = select(SklandSubscribe) + result = (await db_session.scalars(stmt)).all() + if not result: + await matcher.finish("未能查询到任何账号,请检查") + state["all_subscribes"] = result + + # QQ群管理的list:返回当前群聊的所有绑定 + elif is_group and flag is False: + flag = True + if not bot.adapter.get_name() == "OneBot V11": + await matcher.finish("当前的森空岛签到插件无法提供Onebot V11外的群聊绑定记录...") + if TYPE_CHECKING: + from nonebot.adapters.onebot.v11.bot import Bot as OneBotV11Bot + + assert isinstance(bot, OneBotV11Bot) + from nonebot.adapters.onebot.v11 import GROUP_ADMIN, GROUP_OWNER + + if not (await GROUP_ADMIN(bot, event) or await GROUP_OWNER(bot, event)): + await matcher.finish("您不是本群的管理员或群主,请通过私聊获取您的个人绑定记录!") + + stmt = select(SklandSubscribe).where(SklandSubscribe.sendto.group_id == event_session.id2) + result = (await db_session.scalars(stmt)).all() + if not result: + await matcher.finish("未能查询到任何账号,请检查") + state["all_subscribes"] = result + + # 普通用户的list:返回该用户绑定的所有账号 + else: + stmt = select(SklandSubscribe) + result: list[SklandSubscribe] = (await db_session.scalars(stmt)).all() + result = [i for i in result if compare_user_info(i.user, event_session.dict())] + if not result: + await matcher.finish("未能查询到任何账号,请检查") + state["all_subscribes"] = result + + return event_session diff --git a/nonebot_plugin_skland_arksign/utils.py b/nonebot_plugin_skland_arksign/utils.py index 35ae523..eb32a66 100644 --- a/nonebot_plugin_skland_arksign/utils.py +++ b/nonebot_plugin_skland_arksign/utils.py @@ -12,8 +12,11 @@ def compare_user_info(dict1, dict2: dict[any, any]): # excludes = ["bot_id", "level", "id2", "id3"] # includes = [i for i in dict2.keys() if i not in excludes] includes = ["bot_type", "platform", "id1"] - filter1 = {k: dict1[k] for k in includes} - filter2 = {k: dict2[k] for k in includes} + print(type(dict1)) + print(dict1) + print(dict2) + filter1 = {k: dict1[k] for k in includes if k.get(k,"False")} + filter2 = {k: dict2[k] for k in includes if k.get(k,"False")} return filter1 == filter2 diff --git a/pdm.lock b/pdm.lock index 290e480..e89a59b 100644 --- a/pdm.lock +++ b/pdm.lock @@ -4,83 +4,8 @@ [metadata] groups = ["default", "dev", "test"] strategy = ["cross_platform"] -lock_version = "4.4" -content_hash = "sha256:a5077193d762fd9211002e55dc142694d79eefdb277089c92b5520fda975bcd9" - -[[package]] -name = "aiohttp" -version = "3.9.1" -requires_python = ">=3.8" -summary = "Async http client/server framework (asyncio)" -dependencies = [ - "aiosignal>=1.1.2", - "async-timeout<5.0,>=4.0; python_version < \"3.11\"", - "attrs>=17.3.0", - "frozenlist>=1.1.1", - "multidict<7.0,>=4.5", - "yarl<2.0,>=1.0", -] -files = [ - {file = "aiohttp-3.9.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:e1f80197f8b0b846a8d5cf7b7ec6084493950d0882cc5537fb7b96a69e3c8590"}, - {file = "aiohttp-3.9.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c72444d17777865734aa1a4d167794c34b63e5883abb90356a0364a28904e6c0"}, - {file = "aiohttp-3.9.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9b05d5cbe9dafcdc733262c3a99ccf63d2f7ce02543620d2bd8db4d4f7a22f83"}, - {file = "aiohttp-3.9.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5c4fa235d534b3547184831c624c0b7c1e262cd1de847d95085ec94c16fddcd5"}, - {file = "aiohttp-3.9.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:289ba9ae8e88d0ba16062ecf02dd730b34186ea3b1e7489046fc338bdc3361c4"}, - {file = "aiohttp-3.9.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:bff7e2811814fa2271be95ab6e84c9436d027a0e59665de60edf44e529a42c1f"}, - {file = "aiohttp-3.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:81b77f868814346662c96ab36b875d7814ebf82340d3284a31681085c051320f"}, - {file = "aiohttp-3.9.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3b9c7426923bb7bd66d409da46c41e3fb40f5caf679da624439b9eba92043fa6"}, - {file = "aiohttp-3.9.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:8d44e7bf06b0c0a70a20f9100af9fcfd7f6d9d3913e37754c12d424179b4e48f"}, - {file = "aiohttp-3.9.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:22698f01ff5653fe66d16ffb7658f582a0ac084d7da1323e39fd9eab326a1f26"}, - {file = "aiohttp-3.9.1-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:ca7ca5abfbfe8d39e653870fbe8d7710be7a857f8a8386fc9de1aae2e02ce7e4"}, - {file = "aiohttp-3.9.1-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:8d7f98fde213f74561be1d6d3fa353656197f75d4edfbb3d94c9eb9b0fc47f5d"}, - {file = "aiohttp-3.9.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:5216b6082c624b55cfe79af5d538e499cd5f5b976820eac31951fb4325974501"}, - {file = "aiohttp-3.9.1-cp310-cp310-win32.whl", hash = "sha256:0e7ba7ff228c0d9a2cd66194e90f2bca6e0abca810b786901a569c0de082f489"}, - {file = "aiohttp-3.9.1-cp310-cp310-win_amd64.whl", hash = "sha256:c7e939f1ae428a86e4abbb9a7c4732bf4706048818dfd979e5e2839ce0159f23"}, - {file = "aiohttp-3.9.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:df9cf74b9bc03d586fc53ba470828d7b77ce51b0582d1d0b5b2fb673c0baa32d"}, - {file = "aiohttp-3.9.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ecca113f19d5e74048c001934045a2b9368d77b0b17691d905af18bd1c21275e"}, - {file = "aiohttp-3.9.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:8cef8710fb849d97c533f259103f09bac167a008d7131d7b2b0e3a33269185c0"}, - {file = "aiohttp-3.9.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bea94403a21eb94c93386d559bce297381609153e418a3ffc7d6bf772f59cc35"}, - {file = "aiohttp-3.9.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:91c742ca59045dce7ba76cab6e223e41d2c70d79e82c284a96411f8645e2afff"}, - {file = "aiohttp-3.9.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6c93b7c2e52061f0925c3382d5cb8980e40f91c989563d3d32ca280069fd6a87"}, - {file = "aiohttp-3.9.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ee2527134f95e106cc1653e9ac78846f3a2ec1004cf20ef4e02038035a74544d"}, - {file = "aiohttp-3.9.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:11ff168d752cb41e8492817e10fb4f85828f6a0142b9726a30c27c35a1835f01"}, - {file = "aiohttp-3.9.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:b8c3a67eb87394386847d188996920f33b01b32155f0a94f36ca0e0c635bf3e3"}, - {file = "aiohttp-3.9.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:c7b5d5d64e2a14e35a9240b33b89389e0035e6de8dbb7ffa50d10d8b65c57449"}, - {file = "aiohttp-3.9.1-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:69985d50a2b6f709412d944ffb2e97d0be154ea90600b7a921f95a87d6f108a2"}, - {file = "aiohttp-3.9.1-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:c9110c06eaaac7e1f5562caf481f18ccf8f6fdf4c3323feab28a93d34cc646bd"}, - {file = "aiohttp-3.9.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d737e69d193dac7296365a6dcb73bbbf53bb760ab25a3727716bbd42022e8d7a"}, - {file = "aiohttp-3.9.1-cp311-cp311-win32.whl", hash = "sha256:4ee8caa925aebc1e64e98432d78ea8de67b2272252b0a931d2ac3bd876ad5544"}, - {file = "aiohttp-3.9.1-cp311-cp311-win_amd64.whl", hash = "sha256:a34086c5cc285be878622e0a6ab897a986a6e8bf5b67ecb377015f06ed316587"}, - {file = "aiohttp-3.9.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f800164276eec54e0af5c99feb9494c295118fc10a11b997bbb1348ba1a52065"}, - {file = "aiohttp-3.9.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:500f1c59906cd142d452074f3811614be04819a38ae2b3239a48b82649c08821"}, - {file = "aiohttp-3.9.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0b0a6a36ed7e164c6df1e18ee47afbd1990ce47cb428739d6c99aaabfaf1b3af"}, - {file = "aiohttp-3.9.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69da0f3ed3496808e8cbc5123a866c41c12c15baaaead96d256477edf168eb57"}, - {file = "aiohttp-3.9.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:176df045597e674fa950bf5ae536be85699e04cea68fa3a616cf75e413737eb5"}, - {file = "aiohttp-3.9.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b796b44111f0cab6bbf66214186e44734b5baab949cb5fb56154142a92989aeb"}, - {file = "aiohttp-3.9.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f27fdaadce22f2ef950fc10dcdf8048407c3b42b73779e48a4e76b3c35bca26c"}, - {file = "aiohttp-3.9.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bcb6532b9814ea7c5a6a3299747c49de30e84472fa72821b07f5a9818bce0f66"}, - {file = "aiohttp-3.9.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:54631fb69a6e44b2ba522f7c22a6fb2667a02fd97d636048478db2fd8c4e98fe"}, - {file = "aiohttp-3.9.1-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:4b4c452d0190c5a820d3f5c0f3cd8a28ace48c54053e24da9d6041bf81113183"}, - {file = "aiohttp-3.9.1-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:cae4c0c2ca800c793cae07ef3d40794625471040a87e1ba392039639ad61ab5b"}, - {file = "aiohttp-3.9.1-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:565760d6812b8d78d416c3c7cfdf5362fbe0d0d25b82fed75d0d29e18d7fc30f"}, - {file = "aiohttp-3.9.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:54311eb54f3a0c45efb9ed0d0a8f43d1bc6060d773f6973efd90037a51cd0a3f"}, - {file = "aiohttp-3.9.1-cp312-cp312-win32.whl", hash = "sha256:85c3e3c9cb1d480e0b9a64c658cd66b3cfb8e721636ab8b0e746e2d79a7a9eed"}, - {file = "aiohttp-3.9.1-cp312-cp312-win_amd64.whl", hash = "sha256:11cb254e397a82efb1805d12561e80124928e04e9c4483587ce7390b3866d213"}, - {file = "aiohttp-3.9.1.tar.gz", hash = "sha256:8fc49a87ac269d4529da45871e2ffb6874e87779c3d0e2ccd813c0899221239d"}, -] - -[[package]] -name = "aiosignal" -version = "1.3.1" -requires_python = ">=3.7" -summary = "aiosignal: a list of registered asynchronous callbacks" -dependencies = [ - "frozenlist>=1.1.0", -] -files = [ - {file = "aiosignal-1.3.1-py3-none-any.whl", hash = "sha256:f8376fb07dd1e86a584e4fcdec80b36b7f81aac666ebc724e2c090300dd83b17"}, - {file = "aiosignal-1.3.1.tar.gz", hash = "sha256:54cd96e15e1649b75d6c87526a6ff0b6c1b0dd3459f43d9ca11d48c339b68cfc"}, -] +lock_version = "4.4.1" +content_hash = "sha256:c07920bfad220af219f0a1beb8ac887c518ce7d3a079b3acbb14e6e8c45762b7" [[package]] name = "aiosqlite" @@ -205,26 +130,6 @@ files = [ {file = "async-asgi-testclient-1.4.11.tar.gz", hash = "sha256:4449ac85d512d661998ec61f91c9ae01851639611d748d81ae7f816736551792"}, ] -[[package]] -name = "async-timeout" -version = "4.0.3" -requires_python = ">=3.7" -summary = "Timeout context manager for asyncio programs" -files = [ - {file = "async-timeout-4.0.3.tar.gz", hash = "sha256:4640d96be84d82d02ed59ea2b7105a0f7b33abe8703703cd0ab0bf87c427522f"}, - {file = "async_timeout-4.0.3-py3-none-any.whl", hash = "sha256:7405140ff1230c310e51dc27b3145b9092d659ce68ff733fb0cefe3ee42be028"}, -] - -[[package]] -name = "attrs" -version = "23.1.0" -requires_python = ">=3.7" -summary = "Classes Without Boilerplate" -files = [ - {file = "attrs-23.1.0-py3-none-any.whl", hash = "sha256:1f28b4522cdc2fb4256ac1a020c78acf9cba2c6b461ccd2c126f3aa8e8335d04"}, - {file = "attrs-23.1.0.tar.gz", hash = "sha256:6279836d581513a26f1bf235f9acd333bc9115683f14f7e8fae46c98fc50e015"}, -] - [[package]] name = "binaryornot" version = "0.4.4" @@ -239,11 +144,10 @@ files = [ [[package]] name = "black" -version = "23.12.0" +version = "23.12.1" requires_python = ">=3.8" summary = "The uncompromising code formatter." dependencies = [ - "aiohttp>=3.7.4; sys_platform != \"win32\" or implementation_name != \"pypy\" and extra == \"d\"", "click>=8.0.0", "mypy-extensions>=0.4.3", "packaging>=22.0", @@ -253,20 +157,20 @@ dependencies = [ "typing-extensions>=4.0.1; python_version < \"3.11\"", ] files = [ - {file = "black-23.12.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:67f19562d367468ab59bd6c36a72b2c84bc2f16b59788690e02bbcb140a77175"}, - {file = "black-23.12.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:bbd75d9f28a7283b7426160ca21c5bd640ca7cd8ef6630b4754b6df9e2da8462"}, - {file = "black-23.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:593596f699ca2dcbbbdfa59fcda7d8ad6604370c10228223cd6cf6ce1ce7ed7e"}, - {file = "black-23.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:12d5f10cce8dc27202e9a252acd1c9a426c83f95496c959406c96b785a92bb7d"}, - {file = "black-23.12.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:e73c5e3d37e5a3513d16b33305713237a234396ae56769b839d7c40759b8a41c"}, - {file = "black-23.12.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ba09cae1657c4f8a8c9ff6cfd4a6baaf915bb4ef7d03acffe6a2f6585fa1bd01"}, - {file = "black-23.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ace64c1a349c162d6da3cef91e3b0e78c4fc596ffde9413efa0525456148873d"}, - {file = "black-23.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:72db37a2266b16d256b3ea88b9affcdd5c41a74db551ec3dd4609a59c17d25bf"}, - {file = "black-23.12.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:fdf6f23c83078a6c8da2442f4d4eeb19c28ac2a6416da7671b72f0295c4a697b"}, - {file = "black-23.12.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:39dda060b9b395a6b7bf9c5db28ac87b3c3f48d4fdff470fa8a94ab8271da47e"}, - {file = "black-23.12.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7231670266ca5191a76cb838185d9be59cfa4f5dd401b7c1c70b993c58f6b1b5"}, - {file = "black-23.12.0-cp312-cp312-win_amd64.whl", hash = "sha256:193946e634e80bfb3aec41830f5d7431f8dd5b20d11d89be14b84a97c6b8bc75"}, - {file = "black-23.12.0-py3-none-any.whl", hash = "sha256:a7c07db8200b5315dc07e331dda4d889a56f6bf4db6a9c2a526fa3166a81614f"}, - {file = "black-23.12.0.tar.gz", hash = "sha256:330a327b422aca0634ecd115985c1c7fd7bdb5b5a2ef8aa9888a82e2ebe9437a"}, + {file = "black-23.12.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e0aaf6041986767a5e0ce663c7a2f0e9eaf21e6ff87a5f95cbf3675bfd4c41d2"}, + {file = "black-23.12.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c88b3711d12905b74206227109272673edce0cb29f27e1385f33b0163c414bba"}, + {file = "black-23.12.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a920b569dc6b3472513ba6ddea21f440d4b4c699494d2e972a1753cdc25df7b0"}, + {file = "black-23.12.1-cp310-cp310-win_amd64.whl", hash = "sha256:3fa4be75ef2a6b96ea8d92b1587dd8cb3a35c7e3d51f0738ced0781c3aa3a5a3"}, + {file = "black-23.12.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:8d4df77958a622f9b5a4c96edb4b8c0034f8434032ab11077ec6c56ae9f384ba"}, + {file = "black-23.12.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:602cfb1196dc692424c70b6507593a2b29aac0547c1be9a1d1365f0d964c353b"}, + {file = "black-23.12.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9c4352800f14be5b4864016882cdba10755bd50805c95f728011bcb47a4afd59"}, + {file = "black-23.12.1-cp311-cp311-win_amd64.whl", hash = "sha256:0808494f2b2df923ffc5723ed3c7b096bd76341f6213989759287611e9837d50"}, + {file = "black-23.12.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:25e57fd232a6d6ff3f4478a6fd0580838e47c93c83eaf1ccc92d4faf27112c4e"}, + {file = "black-23.12.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2d9e13db441c509a3763a7a3d9a49ccc1b4e974a47be4e08ade2a228876500ec"}, + {file = "black-23.12.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d1bd9c210f8b109b1762ec9fd36592fdd528485aadb3f5849b2740ef17e674e"}, + {file = "black-23.12.1-cp312-cp312-win_amd64.whl", hash = "sha256:ae76c22bde5cbb6bfd211ec343ded2163bba7883c7bc77f6b756a1049436fbb9"}, + {file = "black-23.12.1-py3-none-any.whl", hash = "sha256:78baad24af0f033958cad29731e27363183e140962595def56423e626f4bee3e"}, + {file = "black-23.12.1.tar.gz", hash = "sha256:4ce3ef14ebe8d9509188014d96af1c456a910d5b5cbf434a09fef7e024b3d0d5"}, ] [[package]] @@ -471,61 +375,6 @@ files = [ {file = "fleep-1.0.1.tar.gz", hash = "sha256:c8f62b258ee5364d7f6c1ed1f3f278e99020fc3f0a60a24ad1e10846e31d104c"}, ] -[[package]] -name = "frozenlist" -version = "1.4.1" -requires_python = ">=3.8" -summary = "A list-like structure which implements collections.abc.MutableSequence" -files = [ - {file = "frozenlist-1.4.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:f9aa1878d1083b276b0196f2dfbe00c9b7e752475ed3b682025ff20c1c1f51ac"}, - {file = "frozenlist-1.4.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:29acab3f66f0f24674b7dc4736477bcd4bc3ad4b896f5f45379a67bce8b96868"}, - {file = "frozenlist-1.4.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:74fb4bee6880b529a0c6560885fce4dc95936920f9f20f53d99a213f7bf66776"}, - {file = "frozenlist-1.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:590344787a90ae57d62511dd7c736ed56b428f04cd8c161fcc5e7232c130c69a"}, - {file = "frozenlist-1.4.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:068b63f23b17df8569b7fdca5517edef76171cf3897eb68beb01341131fbd2ad"}, - {file = "frozenlist-1.4.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5c849d495bf5154cd8da18a9eb15db127d4dba2968d88831aff6f0331ea9bd4c"}, - {file = "frozenlist-1.4.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9750cc7fe1ae3b1611bb8cfc3f9ec11d532244235d75901fb6b8e42ce9229dfe"}, - {file = "frozenlist-1.4.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a9b2de4cf0cdd5bd2dee4c4f63a653c61d2408055ab77b151c1957f221cabf2a"}, - {file = "frozenlist-1.4.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:0633c8d5337cb5c77acbccc6357ac49a1770b8c487e5b3505c57b949b4b82e98"}, - {file = "frozenlist-1.4.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:27657df69e8801be6c3638054e202a135c7f299267f1a55ed3a598934f6c0d75"}, - {file = "frozenlist-1.4.1-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:f9a3ea26252bd92f570600098783d1371354d89d5f6b7dfd87359d669f2109b5"}, - {file = "frozenlist-1.4.1-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:4f57dab5fe3407b6c0c1cc907ac98e8a189f9e418f3b6e54d65a718aaafe3950"}, - {file = "frozenlist-1.4.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:e02a0e11cf6597299b9f3bbd3f93d79217cb90cfd1411aec33848b13f5c656cc"}, - {file = "frozenlist-1.4.1-cp310-cp310-win32.whl", hash = "sha256:a828c57f00f729620a442881cc60e57cfcec6842ba38e1b19fd3e47ac0ff8dc1"}, - {file = "frozenlist-1.4.1-cp310-cp310-win_amd64.whl", hash = "sha256:f56e2333dda1fe0f909e7cc59f021eba0d2307bc6f012a1ccf2beca6ba362439"}, - {file = "frozenlist-1.4.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:a0cb6f11204443f27a1628b0e460f37fb30f624be6051d490fa7d7e26d4af3d0"}, - {file = "frozenlist-1.4.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b46c8ae3a8f1f41a0d2ef350c0b6e65822d80772fe46b653ab6b6274f61d4a49"}, - {file = "frozenlist-1.4.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:fde5bd59ab5357e3853313127f4d3565fc7dad314a74d7b5d43c22c6a5ed2ced"}, - {file = "frozenlist-1.4.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:722e1124aec435320ae01ee3ac7bec11a5d47f25d0ed6328f2273d287bc3abb0"}, - {file = "frozenlist-1.4.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2471c201b70d58a0f0c1f91261542a03d9a5e088ed3dc6c160d614c01649c106"}, - {file = "frozenlist-1.4.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c757a9dd70d72b076d6f68efdbb9bc943665ae954dad2801b874c8c69e185068"}, - {file = "frozenlist-1.4.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f146e0911cb2f1da549fc58fc7bcd2b836a44b79ef871980d605ec392ff6b0d2"}, - {file = "frozenlist-1.4.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4f9c515e7914626b2a2e1e311794b4c35720a0be87af52b79ff8e1429fc25f19"}, - {file = "frozenlist-1.4.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:c302220494f5c1ebeb0912ea782bcd5e2f8308037b3c7553fad0e48ebad6ad82"}, - {file = "frozenlist-1.4.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:442acde1e068288a4ba7acfe05f5f343e19fac87bfc96d89eb886b0363e977ec"}, - {file = "frozenlist-1.4.1-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:1b280e6507ea8a4fa0c0a7150b4e526a8d113989e28eaaef946cc77ffd7efc0a"}, - {file = "frozenlist-1.4.1-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:fe1a06da377e3a1062ae5fe0926e12b84eceb8a50b350ddca72dc85015873f74"}, - {file = "frozenlist-1.4.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:db9e724bebd621d9beca794f2a4ff1d26eed5965b004a97f1f1685a173b869c2"}, - {file = "frozenlist-1.4.1-cp311-cp311-win32.whl", hash = "sha256:e774d53b1a477a67838a904131c4b0eef6b3d8a651f8b138b04f748fccfefe17"}, - {file = "frozenlist-1.4.1-cp311-cp311-win_amd64.whl", hash = "sha256:fb3c2db03683b5767dedb5769b8a40ebb47d6f7f45b1b3e3b4b51ec8ad9d9825"}, - {file = "frozenlist-1.4.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:1979bc0aeb89b33b588c51c54ab0161791149f2461ea7c7c946d95d5f93b56ae"}, - {file = "frozenlist-1.4.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:cc7b01b3754ea68a62bd77ce6020afaffb44a590c2289089289363472d13aedb"}, - {file = "frozenlist-1.4.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:c9c92be9fd329ac801cc420e08452b70e7aeab94ea4233a4804f0915c14eba9b"}, - {file = "frozenlist-1.4.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5c3894db91f5a489fc8fa6a9991820f368f0b3cbdb9cd8849547ccfab3392d86"}, - {file = "frozenlist-1.4.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ba60bb19387e13597fb059f32cd4d59445d7b18b69a745b8f8e5db0346f33480"}, - {file = "frozenlist-1.4.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8aefbba5f69d42246543407ed2461db31006b0f76c4e32dfd6f42215a2c41d09"}, - {file = "frozenlist-1.4.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:780d3a35680ced9ce682fbcf4cb9c2bad3136eeff760ab33707b71db84664e3a"}, - {file = "frozenlist-1.4.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9acbb16f06fe7f52f441bb6f413ebae6c37baa6ef9edd49cdd567216da8600cd"}, - {file = "frozenlist-1.4.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:23b701e65c7b36e4bf15546a89279bd4d8675faabc287d06bbcfac7d3c33e1e6"}, - {file = "frozenlist-1.4.1-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:3e0153a805a98f5ada7e09826255ba99fb4f7524bb81bf6b47fb702666484ae1"}, - {file = "frozenlist-1.4.1-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:dd9b1baec094d91bf36ec729445f7769d0d0cf6b64d04d86e45baf89e2b9059b"}, - {file = "frozenlist-1.4.1-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:1a4471094e146b6790f61b98616ab8e44f72661879cc63fa1049d13ef711e71e"}, - {file = "frozenlist-1.4.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:5667ed53d68d91920defdf4035d1cdaa3c3121dc0b113255124bcfada1cfa1b8"}, - {file = "frozenlist-1.4.1-cp312-cp312-win32.whl", hash = "sha256:beee944ae828747fd7cb216a70f120767fc9f4f00bacae8543c14a6831673f89"}, - {file = "frozenlist-1.4.1-cp312-cp312-win_amd64.whl", hash = "sha256:64536573d0a2cb6e625cf309984e2d873979709f2cf22839bf2d61790b448ad5"}, - {file = "frozenlist-1.4.1-py3-none-any.whl", hash = "sha256:04ced3e6a46b4cfffe20f9ae482818e34eba9b5fb0ce4056e4cc9b6e212d09b7"}, - {file = "frozenlist-1.4.1.tar.gz", hash = "sha256:c037a86e8513059a2613aaba4d817bb90b9d9b6b69aace3ce9c877e8c8ed402b"}, -] - [[package]] name = "greenlet" version = "3.0.1" @@ -642,7 +491,7 @@ files = [ [[package]] name = "httpx" -version = "0.25.2" +version = "0.26.0" requires_python = ">=3.8" summary = "The next generation HTTP client." dependencies = [ @@ -653,23 +502,23 @@ dependencies = [ "sniffio", ] files = [ - {file = "httpx-0.25.2-py3-none-any.whl", hash = "sha256:a05d3d052d9b2dfce0e3896636467f8a5342fb2b902c819428e1ac65413ca118"}, - {file = "httpx-0.25.2.tar.gz", hash = "sha256:8b8fcaa0c8ea7b05edd69a094e63a2094c4efcb48129fb757361bc423c0ad9e8"}, + {file = "httpx-0.26.0-py3-none-any.whl", hash = "sha256:8915f5a3627c4d47b73e8202457cb28f1266982d1159bd5779d86a80c0eab1cd"}, + {file = "httpx-0.26.0.tar.gz", hash = "sha256:451b55c30d5185ea6b23c2c793abf9bb237d2a7dfb901ced6ff69ad37ec1dfaf"}, ] [[package]] name = "httpx" -version = "0.25.2" +version = "0.26.0" extras = ["http2"] requires_python = ">=3.8" summary = "The next generation HTTP client." dependencies = [ "h2<5,>=3", - "httpx==0.25.2", + "httpx==0.26.0", ] files = [ - {file = "httpx-0.25.2-py3-none-any.whl", hash = "sha256:a05d3d052d9b2dfce0e3896636467f8a5342fb2b902c819428e1ac65413ca118"}, - {file = "httpx-0.25.2.tar.gz", hash = "sha256:8b8fcaa0c8ea7b05edd69a094e63a2094c4efcb48129fb757361bc423c0ad9e8"}, + {file = "httpx-0.26.0-py3-none-any.whl", hash = "sha256:8915f5a3627c4d47b73e8202457cb28f1266982d1159bd5779d86a80c0eab1cd"}, + {file = "httpx-0.26.0.tar.gz", hash = "sha256:451b55c30d5185ea6b23c2c793abf9bb237d2a7dfb901ced6ff69ad37ec1dfaf"}, ] [[package]] @@ -1475,27 +1324,27 @@ files = [ [[package]] name = "ruff" -version = "0.1.8" +version = "0.1.9" requires_python = ">=3.7" summary = "An extremely fast Python linter and code formatter, written in Rust." files = [ - {file = "ruff-0.1.8-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:7de792582f6e490ae6aef36a58d85df9f7a0cfd1b0d4fe6b4fb51803a3ac96fa"}, - {file = "ruff-0.1.8-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:c8e3255afd186c142eef4ec400d7826134f028a85da2146102a1172ecc7c3696"}, - {file = "ruff-0.1.8-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ff78a7583020da124dd0deb835ece1d87bb91762d40c514ee9b67a087940528b"}, - {file = "ruff-0.1.8-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bd8ee69b02e7bdefe1e5da2d5b6eaaddcf4f90859f00281b2333c0e3a0cc9cd6"}, - {file = "ruff-0.1.8-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a05b0ddd7ea25495e4115a43125e8a7ebed0aa043c3d432de7e7d6e8e8cd6448"}, - {file = "ruff-0.1.8-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:e6f08ca730f4dc1b76b473bdf30b1b37d42da379202a059eae54ec7fc1fbcfed"}, - {file = "ruff-0.1.8-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f35960b02df6b827c1b903091bb14f4b003f6cf102705efc4ce78132a0aa5af3"}, - {file = "ruff-0.1.8-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7d076717c67b34c162da7c1a5bda16ffc205e0e0072c03745275e7eab888719f"}, - {file = "ruff-0.1.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b6a21ab023124eafb7cef6d038f835cb1155cd5ea798edd8d9eb2f8b84be07d9"}, - {file = "ruff-0.1.8-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:ce697c463458555027dfb194cb96d26608abab920fa85213deb5edf26e026664"}, - {file = "ruff-0.1.8-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:db6cedd9ffed55548ab313ad718bc34582d394e27a7875b4b952c2d29c001b26"}, - {file = "ruff-0.1.8-py3-none-musllinux_1_2_i686.whl", hash = "sha256:05ffe9dbd278965271252704eddb97b4384bf58b971054d517decfbf8c523f05"}, - {file = "ruff-0.1.8-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:5daaeaf00ae3c1efec9742ff294b06c3a2a9db8d3db51ee4851c12ad385cda30"}, - {file = "ruff-0.1.8-py3-none-win32.whl", hash = "sha256:e49fbdfe257fa41e5c9e13c79b9e79a23a79bd0e40b9314bc53840f520c2c0b3"}, - {file = "ruff-0.1.8-py3-none-win_amd64.whl", hash = "sha256:f41f692f1691ad87f51708b823af4bb2c5c87c9248ddd3191c8f088e66ce590a"}, - {file = "ruff-0.1.8-py3-none-win_arm64.whl", hash = "sha256:aa8ee4f8440023b0a6c3707f76cadce8657553655dcbb5fc9b2f9bb9bee389f6"}, - {file = "ruff-0.1.8.tar.gz", hash = "sha256:f7ee467677467526cfe135eab86a40a0e8db43117936ac4f9b469ce9cdb3fb62"}, + {file = "ruff-0.1.9-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:e6a212f436122ac73df851f0cf006e0c6612fe6f9c864ed17ebefce0eff6a5fd"}, + {file = "ruff-0.1.9-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:28d920e319783d5303333630dae46ecc80b7ba294aeffedf946a02ac0b7cc3db"}, + {file = "ruff-0.1.9-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:104aa9b5e12cb755d9dce698ab1b97726b83012487af415a4512fedd38b1459e"}, + {file = "ruff-0.1.9-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:1e63bf5a4a91971082a4768a0aba9383c12392d0d6f1e2be2248c1f9054a20da"}, + {file = "ruff-0.1.9-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4d0738917c203246f3e275b37006faa3aa96c828b284ebfe3e99a8cb413c8c4b"}, + {file = "ruff-0.1.9-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:69dac82d63a50df2ab0906d97a01549f814b16bc806deeac4f064ff95c47ddf5"}, + {file = "ruff-0.1.9-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2aec598fb65084e41a9c5d4b95726173768a62055aafb07b4eff976bac72a592"}, + {file = "ruff-0.1.9-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:744dfe4b35470fa3820d5fe45758aace6269c578f7ddc43d447868cfe5078bcb"}, + {file = "ruff-0.1.9-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:479ca4250cab30f9218b2e563adc362bd6ae6343df7c7b5a7865300a5156d5a6"}, + {file = "ruff-0.1.9-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:aa8344310f1ae79af9ccd6e4b32749e93cddc078f9b5ccd0e45bd76a6d2e8bb6"}, + {file = "ruff-0.1.9-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:837c739729394df98f342319f5136f33c65286b28b6b70a87c28f59354ec939b"}, + {file = "ruff-0.1.9-py3-none-musllinux_1_2_i686.whl", hash = "sha256:e6837202c2859b9f22e43cb01992373c2dbfeae5c0c91ad691a4a2e725392464"}, + {file = "ruff-0.1.9-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:331aae2cd4a0554667ac683243b151c74bd60e78fb08c3c2a4ac05ee1e606a39"}, + {file = "ruff-0.1.9-py3-none-win32.whl", hash = "sha256:8151425a60878e66f23ad47da39265fc2fad42aed06fb0a01130e967a7a064f4"}, + {file = "ruff-0.1.9-py3-none-win_amd64.whl", hash = "sha256:c497d769164df522fdaf54c6eba93f397342fe4ca2123a2e014a5b8fc7df81c7"}, + {file = "ruff-0.1.9-py3-none-win_arm64.whl", hash = "sha256:0e17f53bcbb4fff8292dfd84cf72d767b5e146f009cccd40c2fad27641f8a7a9"}, + {file = "ruff-0.1.9.tar.gz", hash = "sha256:b041dee2734719ddbb4518f762c982f2e912e7f28b8ee4fe1dee0b15d1b6e800"}, ] [[package]] @@ -1534,7 +1383,7 @@ version = "2.0.23" requires_python = ">=3.7" summary = "Database Abstraction Library" dependencies = [ - "greenlet!=0.4.17; platform_machine == \"aarch64\" or (platform_machine == \"ppc64le\" or (platform_machine == \"x86_64\" or (platform_machine == \"amd64\" or (platform_machine == \"AMD64\" or (platform_machine == \"win32\" or platform_machine == \"WIN32\")))))", + "greenlet!=0.4.17; platform_machine == \"win32\" or platform_machine == \"WIN32\" or platform_machine == \"AMD64\" or platform_machine == \"amd64\" or platform_machine == \"x86_64\" or platform_machine == \"ppc64le\" or platform_machine == \"aarch64\"", "typing-extensions>=4.2.0", ] files = [ @@ -1768,7 +1617,7 @@ dependencies = [ "python-dotenv>=0.13", "pyyaml>=5.1", "uvicorn==0.24.0.post1", - "uvloop!=0.15.0,!=0.15.1,>=0.14.0; sys_platform != \"win32\" and (sys_platform != \"cygwin\" and platform_python_implementation != \"PyPy\")", + "uvloop!=0.15.0,!=0.15.1,>=0.14.0; (sys_platform != \"cygwin\" and sys_platform != \"win32\") and platform_python_implementation != \"PyPy\"", "watchfiles>=0.13", "websockets>=10.4", ] diff --git a/pyproject.toml b/pyproject.toml index 9975be1..0439644 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ authors = [ ] dependencies = [ "nonebot2>=2.1.2", - "httpx>=0.25.2", + "httpx>=0.26.0", "pydantic>=1.10.13", "nonebot-plugin-apscheduler>=0.3.0", "nonebot-plugin-alconna>=0.34.1", @@ -33,8 +33,8 @@ build-backend = "pdm.backend" [tool.pdm.dev-dependencies] dev = [ "pre-commit>=3.6.0", - "black>=23.12.0", - "ruff>=0.1.8", + "black>=23.12.1", + "ruff>=0.1.9", "isort>=5.13.2", "nb-cli>=1.2.8", "nonebot-adapter-onebot>=2.3.1", From 77d6451d620d2eee8b0ead843c71eb765ed7fcd9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 24 Dec 2023 03:16:13 +0000 Subject: [PATCH 04/18] :lipstick: auto fix by pre-commit hooks --- nonebot_plugin_skland_arksign/__init__.py | 1 + nonebot_plugin_skland_arksign/command.py | 8 ++++---- nonebot_plugin_skland_arksign/depends.py | 13 ++++++------- nonebot_plugin_skland_arksign/utils.py | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/nonebot_plugin_skland_arksign/__init__.py b/nonebot_plugin_skland_arksign/__init__.py index a0c1adb..d49a91f 100644 --- a/nonebot_plugin_skland_arksign/__init__.py +++ b/nonebot_plugin_skland_arksign/__init__.py @@ -11,6 +11,7 @@ from nonebot_plugin_saa import enable_auto_select_bot from .command import skland as skland + # from .command import skland_del as skland_del # from .command import skland_list as skland_list # from .command import skland_update as skland_update diff --git a/nonebot_plugin_skland_arksign/command.py b/nonebot_plugin_skland_arksign/command.py index 7487e33..41e574a 100644 --- a/nonebot_plugin_skland_arksign/command.py +++ b/nonebot_plugin_skland_arksign/command.py @@ -4,19 +4,19 @@ from nonebot.typing import T_State from nonebot.adapters import Bot, Event from nonebot.permission import SUPERUSER -from nonebot_plugin_alconna import on_alconna, AlconnaMatcher, UniMessage, AlconnaArg +from nonebot_plugin_session import EventSession from sqlalchemy.ext.asyncio import AsyncSession from nonebot_plugin_datastore import get_session from nonebot_plugin_saa import Text, PlatformTarget from nonebot_plugin_session_saa import get_saa_target -from nonebot_plugin_session import EventSession +from nonebot_plugin_alconna import AlconnaArg, UniMessage, AlconnaMatcher, on_alconna -from .utils import cleantext, report_maker, compare_user_info from .sched import sched_sign from .signin import run_signin from .alc_parser import skland_cmd from .model import SklandSubscribe -from .depends import skland_session_extract, skland_list_subscribes +from .utils import cleantext, report_maker, compare_user_info +from .depends import skland_list_subscribes, skland_session_extract SessionId1 = str BindUid = str diff --git a/nonebot_plugin_skland_arksign/depends.py b/nonebot_plugin_skland_arksign/depends.py index 97390cf..4cc57ea 100644 --- a/nonebot_plugin_skland_arksign/depends.py +++ b/nonebot_plugin_skland_arksign/depends.py @@ -1,19 +1,18 @@ -from nonebot.typing import T_State from typing import TYPE_CHECKING -from nonebot.permission import SUPERUSER +from sqlalchemy import select from nonebot.params import Depends +from nonebot.typing import T_State from nonebot.matcher import Matcher from nonebot.adapters import Bot, Event -from nonebot_plugin_session import Session, SessionLevel, extract_session -from sqlalchemy import select +from nonebot.permission import SUPERUSER from sqlalchemy.ext.asyncio import AsyncSession from nonebot_plugin_datastore import get_session - -from .utils import compare_user_info -from .model import SklandSubscribe +from nonebot_plugin_session import Session, SessionLevel, extract_session from .config import plugin_config +from .model import SklandSubscribe +from .utils import compare_user_info async def skland_session_extract(bot: Bot, event: Event, matcher: Matcher, state: T_State) -> Session: diff --git a/nonebot_plugin_skland_arksign/utils.py b/nonebot_plugin_skland_arksign/utils.py index eb32a66..b1102e5 100644 --- a/nonebot_plugin_skland_arksign/utils.py +++ b/nonebot_plugin_skland_arksign/utils.py @@ -15,8 +15,8 @@ def compare_user_info(dict1, dict2: dict[any, any]): print(type(dict1)) print(dict1) print(dict2) - filter1 = {k: dict1[k] for k in includes if k.get(k,"False")} - filter2 = {k: dict2[k] for k in includes if k.get(k,"False")} + filter1 = {k: dict1[k] for k in includes if k.get(k, "False")} + filter2 = {k: dict2[k] for k in includes if k.get(k, "False")} return filter1 == filter2 From 74e65fbb645db32b79f4cce6b3813f2a7f1e74ec Mon Sep 17 00:00:00 2001 From: Cateon Huo <2221533105@qq.com> Date: Sun, 24 Dec 2023 11:31:30 +0800 Subject: [PATCH 05/18] :bug: fix: compare_user_info --- nonebot_plugin_skland_arksign/depends.py | 2 +- nonebot_plugin_skland_arksign/utils.py | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/nonebot_plugin_skland_arksign/depends.py b/nonebot_plugin_skland_arksign/depends.py index 4cc57ea..67acfdc 100644 --- a/nonebot_plugin_skland_arksign/depends.py +++ b/nonebot_plugin_skland_arksign/depends.py @@ -40,7 +40,7 @@ async def skland_list_subscribes( """ 根据用户组生成其能获取的订阅列表,文本生成逻辑应写在业务处 """ - event_session = skland_session_extract(bot, event, matcher, state) + event_session = await skland_session_extract(bot, event, matcher, state) is_group = state.get("is_group") flag: bool = False # SUPERUSER 的 list:返回全部 diff --git a/nonebot_plugin_skland_arksign/utils.py b/nonebot_plugin_skland_arksign/utils.py index b1102e5..160614d 100644 --- a/nonebot_plugin_skland_arksign/utils.py +++ b/nonebot_plugin_skland_arksign/utils.py @@ -12,11 +12,8 @@ def compare_user_info(dict1, dict2: dict[any, any]): # excludes = ["bot_id", "level", "id2", "id3"] # includes = [i for i in dict2.keys() if i not in excludes] includes = ["bot_type", "platform", "id1"] - print(type(dict1)) - print(dict1) - print(dict2) - filter1 = {k: dict1[k] for k in includes if k.get(k, "False")} - filter2 = {k: dict2[k] for k in includes if k.get(k, "False")} + filter1 = {k: dict1.get(k) for k in includes} + filter2 = {k: dict2.get(k) for k in includes} return filter1 == filter2 From 981044168978ad569e62058bdf035064b02d3ec4 Mon Sep 17 00:00:00 2001 From: Cateon Huo <2221533105@qq.com> Date: Sun, 24 Dec 2023 12:11:45 +0800 Subject: [PATCH 06/18] tweak --- nonebot_plugin_skland_arksign/__init__.py | 5 ----- nonebot_plugin_skland_arksign/command.py | 15 +++++++-------- nonebot_plugin_skland_arksign/depends.py | 13 ++++--------- 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/nonebot_plugin_skland_arksign/__init__.py b/nonebot_plugin_skland_arksign/__init__.py index d49a91f..6d6e4d7 100644 --- a/nonebot_plugin_skland_arksign/__init__.py +++ b/nonebot_plugin_skland_arksign/__init__.py @@ -11,11 +11,6 @@ from nonebot_plugin_saa import enable_auto_select_bot from .command import skland as skland - -# from .command import skland_del as skland_del -# from .command import skland_list as skland_list -# from .command import skland_update as skland_update -# from .command import skland_signin as skland_signin from .sched import scheduler as scheduler enable_auto_select_bot() diff --git a/nonebot_plugin_skland_arksign/command.py b/nonebot_plugin_skland_arksign/command.py index 41e574a..b2cc28e 100644 --- a/nonebot_plugin_skland_arksign/command.py +++ b/nonebot_plugin_skland_arksign/command.py @@ -158,7 +158,7 @@ async def bind( await msg.send_to(PlatformTarget.deserialize(user)) -@skland_list.handle() +@skland_list.handle(parameterless=[Depends(skland_session_extract)]) async def list_( bot: Bot, event: Event, @@ -172,7 +172,7 @@ async def list_( await skland.finish("您可查询的森空岛签到账号如下:\n" + report_maker(all_subscribes, is_group)) -@skland_del.handle() +@skland_del.handle(parameterless=[Depends(skland_session_extract)]) async def del_1( bot: Bot, event: Event, @@ -200,7 +200,7 @@ async def del_2( event: Event, state: T_State, matcher: AlconnaMatcher, - position: int = AlconnaArg("position"), + position: int, event_session: EventSession = Depends(skland_list_subscribes), db_session: AsyncSession = Depends(get_session), ): @@ -217,7 +217,7 @@ async def del_2( """)) -@skland_update.handle() +@skland_update.handle(parameterless=[Depends(skland_session_extract)]) async def update_1( bot: Bot, event: Event, @@ -254,7 +254,7 @@ async def update_2( identifier: str, matcher: AlconnaMatcher, state: T_State, - position: int = AlconnaArg("position"), + position: int, uid: str | None = None, token: str | None = None, note: str | None = None, @@ -284,8 +284,7 @@ async def signin_all(): await skland.finish("所有账号已经手动重新触发签到!") -# 手动签到功能可以在各处使用 -@skland_signin.handle() +@skland_signin.handle(parameterless=[Depends(skland_session_extract)]) async def signin_1( bot: Bot, event: Event, @@ -312,7 +311,7 @@ async def signin_2( event: Event, state: T_State, matcher: AlconnaMatcher, - position: int = AlconnaArg("position"), + position: int, event_session: EventSession = Depends(skland_list_subscribes), db_session: AsyncSession = Depends(get_session), ): diff --git a/nonebot_plugin_skland_arksign/depends.py b/nonebot_plugin_skland_arksign/depends.py index 67acfdc..2b3dff1 100644 --- a/nonebot_plugin_skland_arksign/depends.py +++ b/nonebot_plugin_skland_arksign/depends.py @@ -48,9 +48,6 @@ async def skland_list_subscribes( flag = True stmt = select(SklandSubscribe) result = (await db_session.scalars(stmt)).all() - if not result: - await matcher.finish("未能查询到任何账号,请检查") - state["all_subscribes"] = result # QQ群管理的list:返回当前群聊的所有绑定 elif is_group and flag is False: @@ -68,17 +65,15 @@ async def skland_list_subscribes( stmt = select(SklandSubscribe).where(SklandSubscribe.sendto.group_id == event_session.id2) result = (await db_session.scalars(stmt)).all() - if not result: - await matcher.finish("未能查询到任何账号,请检查") - state["all_subscribes"] = result # 普通用户的list:返回该用户绑定的所有账号 else: stmt = select(SklandSubscribe) result: list[SklandSubscribe] = (await db_session.scalars(stmt)).all() result = [i for i in result if compare_user_info(i.user, event_session.dict())] - if not result: - await matcher.finish("未能查询到任何账号,请检查") - state["all_subscribes"] = result + + if not result: + await matcher.finish("未能查询到任何账号,请检查") + state["all_subscribes"] = result return event_session From a860a2594a26876a62eac18fc81d6b38a1a6b8fc Mon Sep 17 00:00:00 2001 From: Cateon Huo <2221533105@qq.com> Date: Sun, 24 Dec 2023 15:25:27 +0800 Subject: [PATCH 07/18] =?UTF-8?q?fix:=20=E7=A6=81=E7=94=A8`set=5Fpath=5Far?= =?UTF-8?q?g`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_skland_arksign/command.py | 57 +++++++++++++++--------- nonebot_plugin_skland_arksign/depends.py | 6 +-- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/nonebot_plugin_skland_arksign/command.py b/nonebot_plugin_skland_arksign/command.py index b2cc28e..fab25ec 100644 --- a/nonebot_plugin_skland_arksign/command.py +++ b/nonebot_plugin_skland_arksign/command.py @@ -9,8 +9,7 @@ from nonebot_plugin_datastore import get_session from nonebot_plugin_saa import Text, PlatformTarget from nonebot_plugin_session_saa import get_saa_target -from nonebot_plugin_alconna import AlconnaArg, UniMessage, AlconnaMatcher, on_alconna - +from nonebot_plugin_alconna import UniMessage, AlconnaMatcher, on_alconna from .sched import sched_sign from .signin import run_signin from .alc_parser import skland_cmd @@ -30,19 +29,22 @@ # use_cmd_sep=True, auto_send_output=True, ) +skland_add = skland.dispatch("add") +skland_bind = skland.dispatch("bind") skland_list = skland.dispatch("list") skland_del = skland.dispatch("del") skland_update = skland.dispatch("update") skland_signin = skland.dispatch("signin") +skland_signin_all = skland.dispatch("signin.identifier", "!all") -@skland.assign("add") +@skland_add.handle() async def add( state: T_State, uid: str, token: str | None = None, note: str | None = None, - event_session: EventSession = Depends(skland_list_subscribes), + event_session: EventSession = Depends(skland_session_extract), db_session: AsyncSession = Depends(get_session), ): logger.debug(f"匹配到的参数:{state}") @@ -106,11 +108,11 @@ async def add( await skland.finish(f"立即执行签到操作完成!\n{runres.text}") -@skland.assign("bind") +@skland_bind.handle() async def bind( state: T_State, token: str, - event_session: EventSession = Depends(skland_list_subscribes), + event_session: EventSession = Depends(skland_session_extract), db_session: AsyncSession = Depends(get_session), ): logger.debug(f"匹配到的参数:{state}") @@ -158,7 +160,7 @@ async def bind( await msg.send_to(PlatformTarget.deserialize(user)) -@skland_list.handle(parameterless=[Depends(skland_session_extract)]) +@skland_list.handle() async def list_( bot: Bot, event: Event, @@ -172,14 +174,14 @@ async def list_( await skland.finish("您可查询的森空岛签到账号如下:\n" + report_maker(all_subscribes, is_group)) -@skland_del.handle(parameterless=[Depends(skland_session_extract)]) +@skland_del.handle() async def del_1( bot: Bot, event: Event, state: T_State, identifier: str, matcher: AlconnaMatcher, - position: AlconnaArg("position"), + position: int, event_session: EventSession = Depends(skland_list_subscribes), db_session: AsyncSession = Depends(get_session), ): @@ -187,14 +189,16 @@ async def del_1( all_subscribes: list[SklandSubscribe] = state.get("all_subscribes") all_subscribes = [i for i in all_subscribes if (i.uid == identifier) | (i.note == identifier)] + state["all_subscribes"] = all_subscribes + await skland.send(len(all_subscribes)) state["prompt"] = ( "您可执行操作的森空岛签到账号如下:\n" + report_maker(all_subscribes, is_group) + "\n请输入对应序号完成操作!" ) - if len(all_subscribes) == 1: - matcher.set_path_arg("position", 0) + # if len(all_subscribes) == 1: + # matcher.set_path_arg("del.position", 0) -@skland_del.got_path("position", prompt=UniMessage.template("{prompt}")) +@skland_del.got_path("del.position", prompt=UniMessage.template("{prompt}")) async def del_2( bot: Bot, event: Event, @@ -204,6 +208,8 @@ async def del_2( event_session: EventSession = Depends(skland_list_subscribes), db_session: AsyncSession = Depends(get_session), ): + if position >= len(state["all_subscribes"]): + await skland.reject("输入的序号超出了您所能控制的账号数,请重新输入!") result = state["all_subscribes"][position] uid = result.uid note = result.note or "无" @@ -217,7 +223,7 @@ async def del_2( """)) -@skland_update.handle(parameterless=[Depends(skland_session_extract)]) +@skland_update.handle() async def update_1( bot: Bot, event: Event, @@ -239,15 +245,16 @@ async def update_1( if not result: await skland.finish("未能使用uid或备注匹配到任何账号,请检查") - if len(result) == 1: - matcher.set_path_arg("position", 0) + # if len(result) == 1: + # matcher.set_path_arg("update.position", 9) + # await skland.send(repr(state)) state["prompt"] = ( - "以下是您能管理的所有账号:\n" + report_maker(result, is_group) + "请回复对应序号来完成您的 update 指令!" + "以下是您能管理的所有账号:\n" + report_maker(result, is_group) + "\n请回复对应序号来完成您的 update 指令!" ) state["all_subscribes"] = result -@skland_update.got_path("position", prompt=UniMessage.template("{prompt}")) +@skland_update.got_path("update.position", prompt=UniMessage.template("{prompt}")) async def update_2( bot: Bot, event: Event, @@ -261,6 +268,10 @@ async def update_2( event_session: EventSession = Depends(skland_list_subscribes), db_session: AsyncSession = Depends(get_session), ): + # await skland.send(str(position)) + if position >= len(state["all_subscribes"]): + await skland.send(repr(state)) + await skland.reject("输入的序号超出了您所能控制的账号数,请重新输入!") result = state["all_subscribes"][position] if uid: result.uid = uid @@ -278,13 +289,13 @@ async def update_2( """)) -@skland_signin.assign("identifier", "!all") +@skland_signin_all.handle() async def signin_all(): await sched_sign() await skland.finish("所有账号已经手动重新触发签到!") -@skland_signin.handle(parameterless=[Depends(skland_session_extract)]) +@skland_signin.handle() async def signin_1( bot: Bot, event: Event, @@ -301,11 +312,11 @@ async def signin_1( state["prompt"] = ( "您可执行操作的森空岛签到账号如下:\n" + report_maker(all_subscribes, is_group) + "\n请输入对应序号完成操作!" ) - if len(all_subscribes) == 1: - matcher.set_path_arg("position", 0) + # if len(all_subscribes) == 1: + # matcher.set_path_arg("signin.position", 0) -@skland_signin.got_path("position", prompt=UniMessage.template("{prompt}")) +@skland_signin.got_path("signin.position", prompt=UniMessage.template("{prompt}")) async def signin_2( bot: Bot, event: Event, @@ -315,6 +326,8 @@ async def signin_2( event_session: EventSession = Depends(skland_list_subscribes), db_session: AsyncSession = Depends(get_session), ): + if position >= len(state["all_subscribes"]): + await skland.reject("输入的序号超出了您所能控制的账号数,请重新输入!") result = state["all_subscribes"][position] sign_res = await run_signin(uid=result.uid, token=result.token) await skland.finish(cleantext(f""" diff --git a/nonebot_plugin_skland_arksign/depends.py b/nonebot_plugin_skland_arksign/depends.py index 2b3dff1..18307d0 100644 --- a/nonebot_plugin_skland_arksign/depends.py +++ b/nonebot_plugin_skland_arksign/depends.py @@ -3,11 +3,11 @@ from sqlalchemy import select from nonebot.params import Depends from nonebot.typing import T_State -from nonebot.matcher import Matcher from nonebot.adapters import Bot, Event from nonebot.permission import SUPERUSER from sqlalchemy.ext.asyncio import AsyncSession from nonebot_plugin_datastore import get_session +from nonebot_plugin_alconna import AlconnaMatcher from nonebot_plugin_session import Session, SessionLevel, extract_session from .config import plugin_config @@ -15,7 +15,7 @@ from .utils import compare_user_info -async def skland_session_extract(bot: Bot, event: Event, matcher: Matcher, state: T_State) -> Session: +async def skland_session_extract(bot: Bot, event: Event, matcher: AlconnaMatcher, state: T_State) -> Session: """ 从当前会话中提取Session, 按照 plugin_config.skland_arksign_allow_group 的值判断是否允许群聊使用 """ @@ -33,7 +33,7 @@ async def skland_session_extract(bot: Bot, event: Event, matcher: Matcher, state async def skland_list_subscribes( bot: Bot, event: Event, - matcher: Matcher, + matcher: AlconnaMatcher, state: T_State, db_session: AsyncSession = Depends(get_session), ) -> Session: From 9c7186cdc3876520d8e19539c9d5dcb642a8123e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 24 Dec 2023 07:25:43 +0000 Subject: [PATCH 08/18] :lipstick: auto fix by pre-commit hooks --- nonebot_plugin_skland_arksign/command.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nonebot_plugin_skland_arksign/command.py b/nonebot_plugin_skland_arksign/command.py index fab25ec..0b07190 100644 --- a/nonebot_plugin_skland_arksign/command.py +++ b/nonebot_plugin_skland_arksign/command.py @@ -10,6 +10,7 @@ from nonebot_plugin_saa import Text, PlatformTarget from nonebot_plugin_session_saa import get_saa_target from nonebot_plugin_alconna import UniMessage, AlconnaMatcher, on_alconna + from .sched import sched_sign from .signin import run_signin from .alc_parser import skland_cmd From e3dee8ad86fd6c658e3066806d33c620e37fe0d9 Mon Sep 17 00:00:00 2001 From: Cateon Huo <2221533105@qq.com> Date: Sun, 24 Dec 2023 16:48:17 +0800 Subject: [PATCH 09/18] =?UTF-8?q?run:=20=E5=85=88=E8=BF=99=E6=A0=B7?= =?UTF-8?q?=E7=AE=97=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_skland_arksign/command.py | 37 ++++++++++++------------ nonebot_plugin_skland_arksign/depends.py | 20 +++++-------- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/nonebot_plugin_skland_arksign/command.py b/nonebot_plugin_skland_arksign/command.py index 0b07190..6046a99 100644 --- a/nonebot_plugin_skland_arksign/command.py +++ b/nonebot_plugin_skland_arksign/command.py @@ -166,7 +166,7 @@ async def list_( bot: Bot, event: Event, state: T_State, - event_session: EventSession = Depends(skland_list_subscribes), + event_session: EventSession, db_session: AsyncSession = Depends(get_session), ): is_group = state.get("is_group") @@ -182,19 +182,19 @@ async def del_1( state: T_State, identifier: str, matcher: AlconnaMatcher, - position: int, - event_session: EventSession = Depends(skland_list_subscribes), + position: int | None, + event_session: EventSession, db_session: AsyncSession = Depends(get_session), ): + all_subscribes = await skland_list_subscribes(bot, event, matcher, db_session) is_group = state.get("is_group") - all_subscribes: list[SklandSubscribe] = state.get("all_subscribes") all_subscribes = [i for i in all_subscribes if (i.uid == identifier) | (i.note == identifier)] - state["all_subscribes"] = all_subscribes - await skland.send(len(all_subscribes)) state["prompt"] = ( "您可执行操作的森空岛签到账号如下:\n" + report_maker(all_subscribes, is_group) + "\n请输入对应序号完成操作!" ) + + state["all_subscribes"] = all_subscribes # if len(all_subscribes) == 1: # matcher.set_path_arg("del.position", 0) @@ -205,8 +205,8 @@ async def del_2( event: Event, state: T_State, matcher: AlconnaMatcher, - position: int, - event_session: EventSession = Depends(skland_list_subscribes), + position: int | None, + event_session: EventSession, db_session: AsyncSession = Depends(get_session), ): if position >= len(state["all_subscribes"]): @@ -231,10 +231,10 @@ async def update_1( state: T_State, identifier: str, matcher: AlconnaMatcher, + event_session: EventSession, uid: str | None = None, token: str | None = None, note: str | None = None, - event_session: EventSession = Depends(skland_session_extract), db_session: AsyncSession = Depends(get_session), ): # 动token的操作 还是自己来吧 @@ -250,8 +250,9 @@ async def update_1( # matcher.set_path_arg("update.position", 9) # await skland.send(repr(state)) state["prompt"] = ( - "以下是您能管理的所有账号:\n" + report_maker(result, is_group) + "\n请回复对应序号来完成您的 update 指令!" + "您可执行操作的森空岛签到账号如下:\n" + report_maker(result, is_group) + "\n请输入对应序号完成操作!" ) + state["all_subscribes"] = result @@ -262,16 +263,16 @@ async def update_2( identifier: str, matcher: AlconnaMatcher, state: T_State, - position: int, + position: int | None, + event_session: EventSession, uid: str | None = None, token: str | None = None, note: str | None = None, - event_session: EventSession = Depends(skland_list_subscribes), db_session: AsyncSession = Depends(get_session), ): # await skland.send(str(position)) if position >= len(state["all_subscribes"]): - await skland.send(repr(state)) + # await skland.send(repr(state)) await skland.reject("输入的序号超出了您所能控制的账号数,请重新输入!") result = state["all_subscribes"][position] if uid: @@ -303,16 +304,16 @@ async def signin_1( state: T_State, identifier: str, matcher: AlconnaMatcher, - event_session: EventSession = Depends(skland_list_subscribes), + event_session: EventSession, db_session: AsyncSession = Depends(get_session), ): is_group = state.get("is_group") - all_subscribes: list[SklandSubscribe] = state.get("all_subscribes") - + all_subscribes = await skland_list_subscribes(bot, event, matcher, state, db_session) all_subscribes = [i for i in all_subscribes if (i.uid == identifier) | (i.note == identifier)] state["prompt"] = ( "您可执行操作的森空岛签到账号如下:\n" + report_maker(all_subscribes, is_group) + "\n请输入对应序号完成操作!" ) + state["all_subscribes"] = all_subscribes # if len(all_subscribes) == 1: # matcher.set_path_arg("signin.position", 0) @@ -323,8 +324,8 @@ async def signin_2( event: Event, state: T_State, matcher: AlconnaMatcher, - position: int, - event_session: EventSession = Depends(skland_list_subscribes), + position: int | None, + event_session: EventSession, db_session: AsyncSession = Depends(get_session), ): if position >= len(state["all_subscribes"]): diff --git a/nonebot_plugin_skland_arksign/depends.py b/nonebot_plugin_skland_arksign/depends.py index 18307d0..c918d60 100644 --- a/nonebot_plugin_skland_arksign/depends.py +++ b/nonebot_plugin_skland_arksign/depends.py @@ -1,18 +1,16 @@ from typing import TYPE_CHECKING from sqlalchemy import select -from nonebot.params import Depends from nonebot.typing import T_State from nonebot.adapters import Bot, Event from nonebot.permission import SUPERUSER from sqlalchemy.ext.asyncio import AsyncSession -from nonebot_plugin_datastore import get_session from nonebot_plugin_alconna import AlconnaMatcher from nonebot_plugin_session import Session, SessionLevel, extract_session from .config import plugin_config -from .model import SklandSubscribe from .utils import compare_user_info +from .model import SklandSubscribe async def skland_session_extract(bot: Bot, event: Event, matcher: AlconnaMatcher, state: T_State) -> Session: @@ -34,14 +32,13 @@ async def skland_list_subscribes( bot: Bot, event: Event, matcher: AlconnaMatcher, - state: T_State, - db_session: AsyncSession = Depends(get_session), -) -> Session: + db_session: AsyncSession, +) -> list[SklandSubscribe]: """ 根据用户组生成其能获取的订阅列表,文本生成逻辑应写在业务处 """ - event_session = await skland_session_extract(bot, event, matcher, state) - is_group = state.get("is_group") + event_session = extract_session(bot, event) + is_group = plugin_config.skland_arksign_allow_group flag: bool = False # SUPERUSER 的 list:返回全部 if await SUPERUSER(bot, event): @@ -63,8 +60,9 @@ async def skland_list_subscribes( if not (await GROUP_ADMIN(bot, event) or await GROUP_OWNER(bot, event)): await matcher.finish("您不是本群的管理员或群主,请通过私聊获取您的个人绑定记录!") - stmt = select(SklandSubscribe).where(SklandSubscribe.sendto.group_id == event_session.id2) + stmt = select(SklandSubscribe) result = (await db_session.scalars(stmt)).all() + result = [i for i in result if i.sendto.get("group_to") == event_session.id2] # 普通用户的list:返回该用户绑定的所有账号 else: @@ -74,6 +72,4 @@ async def skland_list_subscribes( if not result: await matcher.finish("未能查询到任何账号,请检查") - state["all_subscribes"] = result - - return event_session + return result From 4695feb1ce0f1d8ec156c9472c0acd8390060246 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 24 Dec 2023 08:48:36 +0000 Subject: [PATCH 10/18] :lipstick: auto fix by pre-commit hooks --- nonebot_plugin_skland_arksign/depends.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonebot_plugin_skland_arksign/depends.py b/nonebot_plugin_skland_arksign/depends.py index c918d60..1e30607 100644 --- a/nonebot_plugin_skland_arksign/depends.py +++ b/nonebot_plugin_skland_arksign/depends.py @@ -9,8 +9,8 @@ from nonebot_plugin_session import Session, SessionLevel, extract_session from .config import plugin_config -from .utils import compare_user_info from .model import SklandSubscribe +from .utils import compare_user_info async def skland_session_extract(bot: Bot, event: Event, matcher: AlconnaMatcher, state: T_State) -> Session: From 699f5d51910fec407da19e3d1d8dbc056ceb5d25 Mon Sep 17 00:00:00 2001 From: Cateon Huo <2221533105@qq.com> Date: Sun, 31 Dec 2023 09:10:56 +0800 Subject: [PATCH 11/18] :bug: fix: can work --- nonebot_plugin_skland_arksign/command.py | 56 ++++++++++++------------ nonebot_plugin_skland_arksign/depends.py | 11 ++++- nonebot_plugin_skland_arksign/utils.py | 4 +- 3 files changed, 40 insertions(+), 31 deletions(-) diff --git a/nonebot_plugin_skland_arksign/command.py b/nonebot_plugin_skland_arksign/command.py index 6046a99..5298757 100644 --- a/nonebot_plugin_skland_arksign/command.py +++ b/nonebot_plugin_skland_arksign/command.py @@ -9,14 +9,14 @@ from nonebot_plugin_datastore import get_session from nonebot_plugin_saa import Text, PlatformTarget from nonebot_plugin_session_saa import get_saa_target -from nonebot_plugin_alconna import UniMessage, AlconnaMatcher, on_alconna +from nonebot_plugin_alconna import UniMessage, AlconnaMatcher, on_alconna, AlconnaArg from .sched import sched_sign from .signin import run_signin from .alc_parser import skland_cmd from .model import SklandSubscribe from .utils import cleantext, report_maker, compare_user_info -from .depends import skland_list_subscribes, skland_session_extract +from .depends import skland_list_subscribes, skland_session_extract, skland_is_group SessionId1 = str BindUid = str @@ -166,12 +166,14 @@ async def list_( bot: Bot, event: Event, state: T_State, + matcher: AlconnaMatcher, event_session: EventSession, db_session: AsyncSession = Depends(get_session), ): - is_group = state.get("is_group") - all_subscribes: list[SklandSubscribe] = state.get("all_subscribes") - + is_group = skland_is_group(bot, event) + all_subscribes: list[SklandSubscribe] = await skland_list_subscribes(bot, event, matcher, db_session) + if not all_subscribes: + await skland.finish("当前没有绑定任何森空岛签到账号!") await skland.finish("您可查询的森空岛签到账号如下:\n" + report_maker(all_subscribes, is_group)) @@ -182,21 +184,22 @@ async def del_1( state: T_State, identifier: str, matcher: AlconnaMatcher, - position: int | None, event_session: EventSession, db_session: AsyncSession = Depends(get_session), ): all_subscribes = await skland_list_subscribes(bot, event, matcher, db_session) - is_group = state.get("is_group") + is_group = skland_is_group(bot, event) all_subscribes = [i for i in all_subscribes if (i.uid == identifier) | (i.note == identifier)] + if not all_subscribes: + await skland.finish("未能使用uid或备注匹配到任何账号,请检查") state["prompt"] = ( "您可执行操作的森空岛签到账号如下:\n" + report_maker(all_subscribes, is_group) + "\n请输入对应序号完成操作!" ) state["all_subscribes"] = all_subscribes - # if len(all_subscribes) == 1: - # matcher.set_path_arg("del.position", 0) + if len(all_subscribes) == 1: + matcher.set_path_arg("del.position", 0) @skland_del.got_path("del.position", prompt=UniMessage.template("{prompt}")) @@ -205,8 +208,8 @@ async def del_2( event: Event, state: T_State, matcher: AlconnaMatcher, - position: int | None, event_session: EventSession, + position: int | None = AlconnaArg("del.position"), db_session: AsyncSession = Depends(get_session), ): if position >= len(state["all_subscribes"]): @@ -238,22 +241,21 @@ async def update_1( db_session: AsyncSession = Depends(get_session), ): # 动token的操作 还是自己来吧 - is_group = state.get("is_group") + is_group = skland_is_group(bot, event) stmt = select(SklandSubscribe).where((SklandSubscribe.uid == identifier) | (SklandSubscribe.note == identifier)) - result = (await db_session.scalars(stmt)).all() + all_subscribes = (await db_session.scalars(stmt)).all() if not await SUPERUSER(bot, event): - result = [i for i in result if compare_user_info(i.user, event_session.dict())] - if not result: + all_subscribes = [i for i in all_subscribes if compare_user_info(i.user, event_session.dict())] + if not all_subscribes: await skland.finish("未能使用uid或备注匹配到任何账号,请检查") - # if len(result) == 1: - # matcher.set_path_arg("update.position", 9) - # await skland.send(repr(state)) + if len(all_subscribes) == 1: + matcher.set_path_arg("update.position", 0) state["prompt"] = ( - "您可执行操作的森空岛签到账号如下:\n" + report_maker(result, is_group) + "\n请输入对应序号完成操作!" + "您可执行操作的森空岛签到账号如下:\n" + report_maker(all_subscribes, is_group) + "\n请输入对应序号完成操作!" ) - state["all_subscribes"] = result + state["all_subscribes"] = all_subscribes @skland_update.got_path("update.position", prompt=UniMessage.template("{prompt}")) @@ -263,16 +265,14 @@ async def update_2( identifier: str, matcher: AlconnaMatcher, state: T_State, - position: int | None, event_session: EventSession, uid: str | None = None, token: str | None = None, note: str | None = None, + position: int | None = AlconnaArg("update.position"), db_session: AsyncSession = Depends(get_session), ): - # await skland.send(str(position)) if position >= len(state["all_subscribes"]): - # await skland.send(repr(state)) await skland.reject("输入的序号超出了您所能控制的账号数,请重新输入!") result = state["all_subscribes"][position] if uid: @@ -307,15 +307,17 @@ async def signin_1( event_session: EventSession, db_session: AsyncSession = Depends(get_session), ): - is_group = state.get("is_group") - all_subscribes = await skland_list_subscribes(bot, event, matcher, state, db_session) + is_group = skland_is_group(bot, event) + all_subscribes = await skland_list_subscribes(bot, event, matcher, db_session) all_subscribes = [i for i in all_subscribes if (i.uid == identifier) | (i.note == identifier)] + if not all_subscribes: + await skland.finish("未能使用uid或备注匹配到任何账号,请检查") state["prompt"] = ( "您可执行操作的森空岛签到账号如下:\n" + report_maker(all_subscribes, is_group) + "\n请输入对应序号完成操作!" ) state["all_subscribes"] = all_subscribes - # if len(all_subscribes) == 1: - # matcher.set_path_arg("signin.position", 0) + if len(all_subscribes) == 1: + matcher.set_path_arg("signin.position", 0) @skland_signin.got_path("signin.position", prompt=UniMessage.template("{prompt}")) @@ -324,8 +326,8 @@ async def signin_2( event: Event, state: T_State, matcher: AlconnaMatcher, - position: int | None, event_session: EventSession, + position: int | None = AlconnaArg("signin.position"), db_session: AsyncSession = Depends(get_session), ): if position >= len(state["all_subscribes"]): diff --git a/nonebot_plugin_skland_arksign/depends.py b/nonebot_plugin_skland_arksign/depends.py index 1e30607..cdbe799 100644 --- a/nonebot_plugin_skland_arksign/depends.py +++ b/nonebot_plugin_skland_arksign/depends.py @@ -13,6 +13,15 @@ from .utils import compare_user_info +def skland_is_group(bot: Bot, event: Event) -> bool: + """不用于会话处理的群消息判断""" + session = extract_session(bot, event) + if session.level != SessionLevel.LEVEL1: + if plugin_config.skland_arksign_allow_group: + return True + return False + + async def skland_session_extract(bot: Bot, event: Event, matcher: AlconnaMatcher, state: T_State) -> Session: """ 从当前会话中提取Session, 按照 plugin_config.skland_arksign_allow_group 的值判断是否允许群聊使用 @@ -38,7 +47,7 @@ async def skland_list_subscribes( 根据用户组生成其能获取的订阅列表,文本生成逻辑应写在业务处 """ event_session = extract_session(bot, event) - is_group = plugin_config.skland_arksign_allow_group + is_group = skland_is_group(bot, event) flag: bool = False # SUPERUSER 的 list:返回全部 if await SUPERUSER(bot, event): diff --git a/nonebot_plugin_skland_arksign/utils.py b/nonebot_plugin_skland_arksign/utils.py index 160614d..15c7dd6 100644 --- a/nonebot_plugin_skland_arksign/utils.py +++ b/nonebot_plugin_skland_arksign/utils.py @@ -9,8 +9,6 @@ def cleantext(text: str) -> str: def compare_user_info(dict1, dict2: dict[any, any]): - # excludes = ["bot_id", "level", "id2", "id3"] - # includes = [i for i in dict2.keys() if i not in excludes] includes = ["bot_type", "platform", "id1"] filter1 = {k: dict1.get(k) for k in includes} filter2 = {k: dict2.get(k) for k in includes} @@ -32,7 +30,7 @@ def report_maker(subscribes: list[SklandSubscribe], is_group: bool) -> str: report.append(cleantext(f""" {n}: UID:{i.uid} - TOKEN:{show_token(i.token,is_group)} + TOKEN:{show_token(i.token, is_group)} 备注:{i.note} """)) return "\n\n".join(report) From 33419271074ac0ba8aacd778b28ac4498a1f2a3c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 31 Dec 2023 01:11:01 +0000 Subject: [PATCH 12/18] :lipstick: auto fix by pre-commit hooks --- nonebot_plugin_skland_arksign/command.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonebot_plugin_skland_arksign/command.py b/nonebot_plugin_skland_arksign/command.py index 5298757..11a7e06 100644 --- a/nonebot_plugin_skland_arksign/command.py +++ b/nonebot_plugin_skland_arksign/command.py @@ -9,14 +9,14 @@ from nonebot_plugin_datastore import get_session from nonebot_plugin_saa import Text, PlatformTarget from nonebot_plugin_session_saa import get_saa_target -from nonebot_plugin_alconna import UniMessage, AlconnaMatcher, on_alconna, AlconnaArg +from nonebot_plugin_alconna import AlconnaArg, UniMessage, AlconnaMatcher, on_alconna from .sched import sched_sign from .signin import run_signin from .alc_parser import skland_cmd from .model import SklandSubscribe from .utils import cleantext, report_maker, compare_user_info -from .depends import skland_list_subscribes, skland_session_extract, skland_is_group +from .depends import skland_is_group, skland_list_subscribes, skland_session_extract SessionId1 = str BindUid = str From 9b517b234b45a56bd9b931a85322a635be31d070 Mon Sep 17 00:00:00 2001 From: Cateon Huo <2221533105@qq.com> Date: Sun, 31 Dec 2023 09:44:47 +0800 Subject: [PATCH 13/18] :green_heart: ci: test --- .github/workflows/testing.yml | 22 +++++++++++----------- .pre-commit-config.yaml | 8 -------- README.md | 9 +++++++-- pdm.lock | 24 ++++++++++++------------ pyproject.toml | 2 +- 5 files changed, 31 insertions(+), 34 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 97d8d26..94f04b9 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -8,14 +8,14 @@ on: - nonebot_plugin_skland_arksign/** - tests/** - pyproject.toml - - poetry.lock + - pdm.lock - .github/** pull_request: paths: - nonebot_plugin_skland_arksign/** - tests/** - pyproject.toml - - poetry.lock + - pdm.lock - .github/** concurrency: @@ -36,15 +36,15 @@ jobs: PYTHON_VERSION: ${{ matrix.python-version }} steps: - - uses: actions/checkout@v3 - - - name: Setup Python environment - uses: ./.github/actions/setup-python + - uses: actions/checkout@v4 + - name: Set up PDM + uses: pdm-project/setup-pdm@v3 with: python-version: ${{ matrix.python-version }} - - name: Install prerequisites - run: pdm install - - - name: Run Pytest - run: pdm run pytest -n auto + - name: Install dependencies + run: | + pdm sync -d -G test + - name: Run Tests + run: | + pdm run -v pytest tests \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 120a071..e3c5d3a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,12 +25,4 @@ repos: - id: black stages: [commit] - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v4.0.0-alpha.3 - hooks: - - id: prettier - types_or: [javascript, jsx, ts, tsx, markdown, yaml, json] - exclude: "admin-frontend/" - stages: [commit] - exclude: "CHANGELOG.md" diff --git a/README.md b/README.md index b6a5b4d..540cf23 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,11 @@ skland del 游戏账号ID/备注 ``` > [!WARNING] -> 注意:非[超级用户](https://nonebot.dev/docs/appendices/config#superusers)只可删除自己绑定的账号,超级用户可以删除bot数据库内所有账号 +> 超级用户可以删除bot数据库内的任意账号 +> +> [OneBot V11](https://onebot.adapters.nonebot.dev/) 适配器中的 QQ 群管理员以上权限的用户可以在群内删除本群内的任意账号 +> +> 非[超级用户](https://nonebot.dev/docs/appendices/config#superusers)只可在私聊中删除自己绑定的账号 ### 列出账号 @@ -173,7 +177,8 @@ skland list ```shell skland update 游戏账号ID/备注 [-u 可选UID] [-t 可选token] [-n 可选备注] ``` - +> [!WARNING] +> 因可能涉及token变更,本指令只允许[超级用户](https://nonebot.dev/docs/appendices/config#superusers)或单独的用户删除自己能处理的账户 ### 立即手动签到 diff --git a/pdm.lock b/pdm.lock index e89a59b..7db9aca 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "dev", "test"] strategy = ["cross_platform"] lock_version = "4.4.1" -content_hash = "sha256:c07920bfad220af219f0a1beb8ac887c518ce7d3a079b3acbb14e6e8c45762b7" +content_hash = "sha256:87ea61df0b046b24e605a0a07185d47e39b3304359d6b5178a80446e9b0dfa21" [[package]] name = "aiosqlite" @@ -940,7 +940,7 @@ files = [ [[package]] name = "nonebot2" -version = "2.1.2" +version = "2.1.3" requires_python = ">=3.8,<4.0" summary = "An asynchronous python bot framework." dependencies = [ @@ -952,39 +952,39 @@ dependencies = [ "yarl<2.0.0,>=1.7.2", ] files = [ - {file = "nonebot2-2.1.2-py3-none-any.whl", hash = "sha256:a4df78e4c8b81773ea70b4b68d4ac3a5027d69517661d756772f11edf3cd3b1f"}, - {file = "nonebot2-2.1.2.tar.gz", hash = "sha256:afb3c141c67645cd038125287d0583aec2220eca998a8392e42ba87722f6659f"}, + {file = "nonebot2-2.1.3-py3-none-any.whl", hash = "sha256:c36c1a60ce4355d9777fee431c08619f22ffd60f7060993fbbbd1fe67b6368f7"}, + {file = "nonebot2-2.1.3.tar.gz", hash = "sha256:e750e615f1ad2503721ce055fbe55ec3b061277135d995be112fecd27f7232e5"}, ] [[package]] name = "nonebot2" -version = "2.1.2" +version = "2.1.3" extras = ["fastapi"] requires_python = ">=3.8,<4.0" summary = "An asynchronous python bot framework." dependencies = [ "fastapi<1.0.0,>=0.93.0", - "nonebot2==2.1.2", + "nonebot2==2.1.3", "uvicorn[standard]<1.0.0,>=0.20.0", ] files = [ - {file = "nonebot2-2.1.2-py3-none-any.whl", hash = "sha256:a4df78e4c8b81773ea70b4b68d4ac3a5027d69517661d756772f11edf3cd3b1f"}, - {file = "nonebot2-2.1.2.tar.gz", hash = "sha256:afb3c141c67645cd038125287d0583aec2220eca998a8392e42ba87722f6659f"}, + {file = "nonebot2-2.1.3-py3-none-any.whl", hash = "sha256:c36c1a60ce4355d9777fee431c08619f22ffd60f7060993fbbbd1fe67b6368f7"}, + {file = "nonebot2-2.1.3.tar.gz", hash = "sha256:e750e615f1ad2503721ce055fbe55ec3b061277135d995be112fecd27f7232e5"}, ] [[package]] name = "nonebot2" -version = "2.1.2" +version = "2.1.3" extras = ["httpx"] requires_python = ">=3.8,<4.0" summary = "An asynchronous python bot framework." dependencies = [ "httpx[http2]<1.0.0,>=0.20.0", - "nonebot2==2.1.2", + "nonebot2==2.1.3", ] files = [ - {file = "nonebot2-2.1.2-py3-none-any.whl", hash = "sha256:a4df78e4c8b81773ea70b4b68d4ac3a5027d69517661d756772f11edf3cd3b1f"}, - {file = "nonebot2-2.1.2.tar.gz", hash = "sha256:afb3c141c67645cd038125287d0583aec2220eca998a8392e42ba87722f6659f"}, + {file = "nonebot2-2.1.3-py3-none-any.whl", hash = "sha256:c36c1a60ce4355d9777fee431c08619f22ffd60f7060993fbbbd1fe67b6368f7"}, + {file = "nonebot2-2.1.3.tar.gz", hash = "sha256:e750e615f1ad2503721ce055fbe55ec3b061277135d995be112fecd27f7232e5"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index 0439644..421d98f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ authors = [ {name = "Azide", email = "rukuy@qq.com"}, ] dependencies = [ - "nonebot2>=2.1.2", + "nonebot2>=2.1.3", "httpx>=0.26.0", "pydantic>=1.10.13", "nonebot-plugin-apscheduler>=0.3.0", From bab33dedfb08f591514ff198030efe295809b5e4 Mon Sep 17 00:00:00 2001 From: Cateon Huo <2221533105@qq.com> Date: Mon, 1 Jan 2024 15:40:52 +0800 Subject: [PATCH 14/18] :sparkles: feat: rebind func --- README.md | 15 +++++++++++++- nonebot_plugin_skland_arksign/alc_parser.py | 5 +++++ nonebot_plugin_skland_arksign/command.py | 23 +++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 540cf23..1f3238a 100644 --- a/README.md +++ b/README.md @@ -172,7 +172,7 @@ skland list ``` -### 更新账号 +### 更新账号数据 ```shell skland update 游戏账号ID/备注 [-u 可选UID] [-t 可选token] [-n 可选备注] @@ -180,6 +180,19 @@ skland update 游戏账号ID/备注 [-u 可选UID] [-t 可选token] [-n 可选 > [!WARNING] > 因可能涉及token变更,本指令只允许[超级用户](https://nonebot.dev/docs/appendices/config#superusers)或单独的用户删除自己能处理的账户 + +### 重新绑定账号对应的用户数据模型 + +在更新至[`>=v0.7.0`](https://pypi.org/project/nonebot-plugin-skland-arksign/0.7.0/)(PR `#39`) 后,使用这一指令重新绑定账号对应的用户数据模型 + +```shell +skland rebind 游戏账号ID +``` + +> [!WARNING] +> 因涉及用户数据模型变更,本指令只允许用户处理自己的账号,**超级用户亦只可以处理自己的账号** + + ### 立即手动签到 #### 特定用户 diff --git a/nonebot_plugin_skland_arksign/alc_parser.py b/nonebot_plugin_skland_arksign/alc_parser.py index cfcfc9f..b91101a 100644 --- a/nonebot_plugin_skland_arksign/alc_parser.py +++ b/nonebot_plugin_skland_arksign/alc_parser.py @@ -15,6 +15,11 @@ Args["token", str], help_text="在私聊绑定一个在群聊中添加的签到账号", ), + Subcommand( + "rebind", + Args["uid", str], + help_text="更新数据库结构后重新绑定账户的信息", + ), Subcommand( "list", help_text="列出所有签到账号", diff --git a/nonebot_plugin_skland_arksign/command.py b/nonebot_plugin_skland_arksign/command.py index 11a7e06..d3e5dd0 100644 --- a/nonebot_plugin_skland_arksign/command.py +++ b/nonebot_plugin_skland_arksign/command.py @@ -37,6 +37,7 @@ skland_update = skland.dispatch("update") skland_signin = skland.dispatch("signin") skland_signin_all = skland.dispatch("signin.identifier", "!all") +skland_rebind = skland.dispatch("rebind") @skland_add.handle() @@ -338,3 +339,25 @@ async def signin_2( [森空岛明日方舟签到器]已为账号{result.uid}手动签到! 信息如下:{sign_res.text} """)) + + +@skland_rebind.handle() +async def rebind( + state: T_State, + uid: str, + event_session: EventSession, + db_session: AsyncSession = Depends(get_session), +): + stmt = select(SklandSubscribe).where(SklandSubscribe.uid == uid) + result: SklandSubscribe | None = await db_session.scalar(stmt) + if not result: + await skland.finish("没有找到需要重新绑定的账户,请检查") + old_user = result.sendto + now_sendto_dict = get_saa_target(event_session).dict() + if old_user == now_sendto_dict: + result.user = event_session.dict() + await db_session.flush() + await db_session.commit() + await skland.finish(f"已完成UID:{uid}的森空岛账号的用户信息重绑定!") + else: + await skland.finish("该账户此前并非您所有,请检查") From 1eb30ffaf3cef19edb07a1c3ab7dc98f704d3316 Mon Sep 17 00:00:00 2001 From: Cateon Huo <2221533105@qq.com> Date: Sun, 7 Jan 2024 12:29:11 +0800 Subject: [PATCH 15/18] :art: tweak --- .pre-commit-config.yaml | 16 +++++-- README.md | 2 +- nonebot_plugin_skland_arksign/command.py | 5 +-- nonebot_plugin_skland_arksign/depends.py | 2 +- nonebot_plugin_skland_arksign/utils.py | 15 ++++--- pdm.lock | 56 ++++++++++++------------ pyproject.toml | 8 ++-- 7 files changed, 56 insertions(+), 48 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e3c5d3a..1aa9505 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,22 +7,30 @@ ci: autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks" repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.6 + rev: v0.1.9 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] stages: [commit] - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort stages: [commit] - repo: https://github.com/psf/black - rev: 23.11.0 + rev: 23.12.1 hooks: - id: black stages: [commit] -exclude: "CHANGELOG.md" + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v4.0.0-alpha.8 + hooks: + - id: prettier + args: [--write] + types_or: [javascript, jsx, ts, tsx, markdown, yaml, json] + stages: [commit] + +exclude: "CHANGELOG.md" \ No newline at end of file diff --git a/README.md b/README.md index 1f3238a..219de8f 100644 --- a/README.md +++ b/README.md @@ -183,7 +183,7 @@ skland update 游戏账号ID/备注 [-u 可选UID] [-t 可选token] [-n 可选 ### 重新绑定账号对应的用户数据模型 -在更新至[`>=v0.7.0`](https://pypi.org/project/nonebot-plugin-skland-arksign/0.7.0/)(PR `#39`) 后,使用这一指令重新绑定账号对应的用户数据模型 +在更新至[`>=v0.7.0`](https://pypi.org/project/nonebot-plugin-skland-arksign/0.7.0/)([#39](https://github.com/GuGuMur/nonebot-plugin-skland-arksign/issues/39)) 后,使用这一指令重新绑定账号对应的用户数据模型 ```shell skland rebind 游戏账号ID diff --git a/nonebot_plugin_skland_arksign/command.py b/nonebot_plugin_skland_arksign/command.py index d3e5dd0..94a9386 100644 --- a/nonebot_plugin_skland_arksign/command.py +++ b/nonebot_plugin_skland_arksign/command.py @@ -69,8 +69,7 @@ async def add( async with db_session.begin(): stmt = select(SklandSubscribe).where(SklandSubscribe.note == note) result: list[SklandSubscribe] = (await db_session.scalars(stmt)).all() - result = [i for i in result if compare_user_info(i.user, event_session_dict)] - if result: + if any(i for i in result if compare_user_info(i, event_session)): await skland.finish("该note已经被您注册,请检查") # 3. 绑定到数据库里 @@ -246,7 +245,7 @@ async def update_1( stmt = select(SklandSubscribe).where((SklandSubscribe.uid == identifier) | (SklandSubscribe.note == identifier)) all_subscribes = (await db_session.scalars(stmt)).all() if not await SUPERUSER(bot, event): - all_subscribes = [i for i in all_subscribes if compare_user_info(i.user, event_session.dict())] + all_subscribes = [i for i in all_subscribes if compare_user_info(i, event_session)] if not all_subscribes: await skland.finish("未能使用uid或备注匹配到任何账号,请检查") diff --git a/nonebot_plugin_skland_arksign/depends.py b/nonebot_plugin_skland_arksign/depends.py index cdbe799..d047f49 100644 --- a/nonebot_plugin_skland_arksign/depends.py +++ b/nonebot_plugin_skland_arksign/depends.py @@ -77,7 +77,7 @@ async def skland_list_subscribes( else: stmt = select(SklandSubscribe) result: list[SklandSubscribe] = (await db_session.scalars(stmt)).all() - result = [i for i in result if compare_user_info(i.user, event_session.dict())] + result = [i for i in result if compare_user_info(i, event_session)] if not result: await matcher.finish("未能查询到任何账号,请检查") diff --git a/nonebot_plugin_skland_arksign/utils.py b/nonebot_plugin_skland_arksign/utils.py index 15c7dd6..54aaf01 100644 --- a/nonebot_plugin_skland_arksign/utils.py +++ b/nonebot_plugin_skland_arksign/utils.py @@ -1,3 +1,5 @@ +from nonebot_plugin_session import EventSession + from .model import SklandSubscribe @@ -8,20 +10,19 @@ def cleantext(text: str) -> str: return result -def compare_user_info(dict1, dict2: dict[any, any]): +def compare_user_info(dict1: SklandSubscribe, dict2: EventSession): includes = ["bot_type", "platform", "id1"] - filter1 = {k: dict1.get(k) for k in includes} - filter2 = {k: dict2.get(k) for k in includes} + filter1 = {k: dict1.user.get(k) for k in includes} + filter2 = {k: dict2.__dict__.get(k) for k in includes} return filter1 == filter2 def show_token(token: str, is_group: bool) -> str: if not token: return "未绑定" - else: - if is_group: - return "已绑定" - return token + elif is_group: + return "已绑定" + return token def report_maker(subscribes: list[SklandSubscribe], is_group: bool) -> str: diff --git a/pdm.lock b/pdm.lock index 7db9aca..e703cfe 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "dev", "test"] strategy = ["cross_platform"] lock_version = "4.4.1" -content_hash = "sha256:87ea61df0b046b24e605a0a07185d47e39b3304359d6b5178a80446e9b0dfa21" +content_hash = "sha256:e70fae0abaa748dd388d8cb361335cd3b9e47e965b1c333c2c207e3fd4bfabb3" [[package]] name = "aiosqlite" @@ -834,7 +834,7 @@ files = [ [[package]] name = "nonebot-plugin-alconna" -version = "0.34.1" +version = "0.35.1" requires_python = ">=3.8" summary = "Alconna Adapter for Nonebot" dependencies = [ @@ -845,8 +845,8 @@ dependencies = [ "nonebot2>=2.1.0", ] files = [ - {file = "nonebot_plugin_alconna-0.34.1-py3-none-any.whl", hash = "sha256:c8e71ffad194e30f14ae7a53e29483b2a59328df2fc8d4ba9e1c407f2f76bf0d"}, - {file = "nonebot_plugin_alconna-0.34.1.tar.gz", hash = "sha256:12a8809bd3ee96ecaa25b20ad3950f7078eb1d109ad2f6656c581ddcdb3244d6"}, + {file = "nonebot_plugin_alconna-0.35.1-py3-none-any.whl", hash = "sha256:70dd86b477642dc1d154aef1ceb142e5350475852f87f4b3413dfc0c7d929d87"}, + {file = "nonebot_plugin_alconna-0.35.1.tar.gz", hash = "sha256:0940af2ddfd8cedde59123b2e3dc77aacb4efab1751d9744091d6baa69920e94"}, ] [[package]] @@ -1173,7 +1173,7 @@ files = [ [[package]] name = "pytest" -version = "7.4.3" +version = "7.4.4" requires_python = ">=3.7" summary = "pytest: simple powerful testing with Python" dependencies = [ @@ -1185,21 +1185,21 @@ dependencies = [ "tomli>=1.0.0; python_version < \"3.11\"", ] files = [ - {file = "pytest-7.4.3-py3-none-any.whl", hash = "sha256:0d009c083ea859a71b76adf7c1d502e4bc170b80a8ef002da5806527b9591fac"}, - {file = "pytest-7.4.3.tar.gz", hash = "sha256:d989d136982de4e3b29dabcc838ad581c64e8ed52c11fbe86ddebd9da0818cd5"}, + {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, + {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, ] [[package]] name = "pytest-asyncio" -version = "0.23.2" +version = "0.23.3" requires_python = ">=3.8" summary = "Pytest support for asyncio" dependencies = [ "pytest>=7.0.0", ] files = [ - {file = "pytest-asyncio-0.23.2.tar.gz", hash = "sha256:c16052382554c7b22d48782ab3438d5b10f8cf7a4bdcae7f0f67f097d95beecc"}, - {file = "pytest_asyncio-0.23.2-py3-none-any.whl", hash = "sha256:ea9021364e32d58f0be43b91c6233fb8d2224ccef2398d6837559e587682808f"}, + {file = "pytest-asyncio-0.23.3.tar.gz", hash = "sha256:af313ce900a62fbe2b1aed18e37ad757f1ef9940c6b6a88e2954de38d6b1fb9f"}, + {file = "pytest_asyncio-0.23.3-py3-none-any.whl", hash = "sha256:37a9d912e8338ee7b4a3e917381d1c95bfc8682048cb0fbc35baba316ec1faba"}, ] [[package]] @@ -1324,27 +1324,27 @@ files = [ [[package]] name = "ruff" -version = "0.1.9" +version = "0.1.11" requires_python = ">=3.7" summary = "An extremely fast Python linter and code formatter, written in Rust." files = [ - {file = "ruff-0.1.9-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:e6a212f436122ac73df851f0cf006e0c6612fe6f9c864ed17ebefce0eff6a5fd"}, - {file = "ruff-0.1.9-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:28d920e319783d5303333630dae46ecc80b7ba294aeffedf946a02ac0b7cc3db"}, - {file = "ruff-0.1.9-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:104aa9b5e12cb755d9dce698ab1b97726b83012487af415a4512fedd38b1459e"}, - {file = "ruff-0.1.9-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:1e63bf5a4a91971082a4768a0aba9383c12392d0d6f1e2be2248c1f9054a20da"}, - {file = "ruff-0.1.9-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4d0738917c203246f3e275b37006faa3aa96c828b284ebfe3e99a8cb413c8c4b"}, - {file = "ruff-0.1.9-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:69dac82d63a50df2ab0906d97a01549f814b16bc806deeac4f064ff95c47ddf5"}, - {file = "ruff-0.1.9-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2aec598fb65084e41a9c5d4b95726173768a62055aafb07b4eff976bac72a592"}, - {file = "ruff-0.1.9-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:744dfe4b35470fa3820d5fe45758aace6269c578f7ddc43d447868cfe5078bcb"}, - {file = "ruff-0.1.9-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:479ca4250cab30f9218b2e563adc362bd6ae6343df7c7b5a7865300a5156d5a6"}, - {file = "ruff-0.1.9-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:aa8344310f1ae79af9ccd6e4b32749e93cddc078f9b5ccd0e45bd76a6d2e8bb6"}, - {file = "ruff-0.1.9-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:837c739729394df98f342319f5136f33c65286b28b6b70a87c28f59354ec939b"}, - {file = "ruff-0.1.9-py3-none-musllinux_1_2_i686.whl", hash = "sha256:e6837202c2859b9f22e43cb01992373c2dbfeae5c0c91ad691a4a2e725392464"}, - {file = "ruff-0.1.9-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:331aae2cd4a0554667ac683243b151c74bd60e78fb08c3c2a4ac05ee1e606a39"}, - {file = "ruff-0.1.9-py3-none-win32.whl", hash = "sha256:8151425a60878e66f23ad47da39265fc2fad42aed06fb0a01130e967a7a064f4"}, - {file = "ruff-0.1.9-py3-none-win_amd64.whl", hash = "sha256:c497d769164df522fdaf54c6eba93f397342fe4ca2123a2e014a5b8fc7df81c7"}, - {file = "ruff-0.1.9-py3-none-win_arm64.whl", hash = "sha256:0e17f53bcbb4fff8292dfd84cf72d767b5e146f009cccd40c2fad27641f8a7a9"}, - {file = "ruff-0.1.9.tar.gz", hash = "sha256:b041dee2734719ddbb4518f762c982f2e912e7f28b8ee4fe1dee0b15d1b6e800"}, + {file = "ruff-0.1.11-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:a7f772696b4cdc0a3b2e527fc3c7ccc41cdcb98f5c80fdd4f2b8c50eb1458196"}, + {file = "ruff-0.1.11-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:934832f6ed9b34a7d5feea58972635c2039c7a3b434fe5ba2ce015064cb6e955"}, + {file = "ruff-0.1.11-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ea0d3e950e394c4b332bcdd112aa566010a9f9c95814844a7468325290aabfd9"}, + {file = "ruff-0.1.11-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9bd4025b9c5b429a48280785a2b71d479798a69f5c2919e7d274c5f4b32c3607"}, + {file = "ruff-0.1.11-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e1ad00662305dcb1e987f5ec214d31f7d6a062cae3e74c1cbccef15afd96611d"}, + {file = "ruff-0.1.11-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:4b077ce83f47dd6bea1991af08b140e8b8339f0ba8cb9b7a484c30ebab18a23f"}, + {file = "ruff-0.1.11-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c4a88efecec23c37b11076fe676e15c6cdb1271a38f2b415e381e87fe4517f18"}, + {file = "ruff-0.1.11-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5b25093dad3b055667730a9b491129c42d45e11cdb7043b702e97125bcec48a1"}, + {file = "ruff-0.1.11-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:231d8fb11b2cc7c0366a326a66dafc6ad449d7fcdbc268497ee47e1334f66f77"}, + {file = "ruff-0.1.11-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:09c415716884950080921dd6237767e52e227e397e2008e2bed410117679975b"}, + {file = "ruff-0.1.11-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:0f58948c6d212a6b8d41cd59e349751018797ce1727f961c2fa755ad6208ba45"}, + {file = "ruff-0.1.11-py3-none-musllinux_1_2_i686.whl", hash = "sha256:190a566c8f766c37074d99640cd9ca3da11d8deae2deae7c9505e68a4a30f740"}, + {file = "ruff-0.1.11-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:6464289bd67b2344d2a5d9158d5eb81025258f169e69a46b741b396ffb0cda95"}, + {file = "ruff-0.1.11-py3-none-win32.whl", hash = "sha256:9b8f397902f92bc2e70fb6bebfa2139008dc72ae5177e66c383fa5426cb0bf2c"}, + {file = "ruff-0.1.11-py3-none-win_amd64.whl", hash = "sha256:eb85ee287b11f901037a6683b2374bb0ec82928c5cbc984f575d0437979c521a"}, + {file = "ruff-0.1.11-py3-none-win_arm64.whl", hash = "sha256:97ce4d752f964ba559c7023a86e5f8e97f026d511e48013987623915431c7ea9"}, + {file = "ruff-0.1.11.tar.gz", hash = "sha256:f9d4d88cb6eeb4dfe20f9f0519bd2eaba8119bde87c3d5065c541dbae2b5a2cb"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index 421d98f..23a7bb4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ dependencies = [ "httpx>=0.26.0", "pydantic>=1.10.13", "nonebot-plugin-apscheduler>=0.3.0", - "nonebot-plugin-alconna>=0.34.1", + "nonebot-plugin-alconna>=0.35.1", "nonebot-plugin-datastore>=1.1.2", "nonebot-plugin-session>=0.2.3", "nonebot-plugin-session-saa>=0.1.1", @@ -34,15 +34,15 @@ build-backend = "pdm.backend" dev = [ "pre-commit>=3.6.0", "black>=23.12.1", - "ruff>=0.1.9", + "ruff>=0.1.11", "isort>=5.13.2", "nb-cli>=1.2.8", "nonebot-adapter-onebot>=2.3.1", ] test = [ "nonebug>=0.3.5", - "pytest>=7.4.3", - "pytest-asyncio>=0.23.2", + "pytest>=7.4.4", + "pytest-asyncio>=0.23.3", "pytest-xdist>=3.5.0", ] From 8478b25f322ea15b3268bef9ca486366f1b937d1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 7 Jan 2024 04:29:19 +0000 Subject: [PATCH 16/18] :lipstick: auto fix by pre-commit hooks --- .github/workflows/testing.yml | 2 +- .pre-commit-config.yaml | 2 +- README.md | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 94f04b9..2b90ea2 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -47,4 +47,4 @@ jobs: pdm sync -d -G test - name: Run Tests run: | - pdm run -v pytest tests \ No newline at end of file + pdm run -v pytest tests diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1aa9505..da08a02 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,4 +33,4 @@ repos: types_or: [javascript, jsx, ts, tsx, markdown, yaml, json] stages: [commit] -exclude: "CHANGELOG.md" \ No newline at end of file +exclude: "CHANGELOG.md" diff --git a/README.md b/README.md index 219de8f..28e32e4 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,7 @@ skland del 游戏账号ID/备注 > 超级用户可以删除bot数据库内的任意账号 > > [OneBot V11](https://onebot.adapters.nonebot.dev/) 适配器中的 QQ 群管理员以上权限的用户可以在群内删除本群内的任意账号 -> +> > 非[超级用户](https://nonebot.dev/docs/appendices/config#superusers)只可在私聊中删除自己绑定的账号 ### 列出账号 @@ -171,16 +171,15 @@ skland del 游戏账号ID/备注 skland list ``` - ### 更新账号数据 ```shell skland update 游戏账号ID/备注 [-u 可选UID] [-t 可选token] [-n 可选备注] ``` + > [!WARNING] > 因可能涉及token变更,本指令只允许[超级用户](https://nonebot.dev/docs/appendices/config#superusers)或单独的用户删除自己能处理的账户 - ### 重新绑定账号对应的用户数据模型 在更新至[`>=v0.7.0`](https://pypi.org/project/nonebot-plugin-skland-arksign/0.7.0/)([#39](https://github.com/GuGuMur/nonebot-plugin-skland-arksign/issues/39)) 后,使用这一指令重新绑定账号对应的用户数据模型 @@ -192,7 +191,6 @@ skland rebind 游戏账号ID > [!WARNING] > 因涉及用户数据模型变更,本指令只允许用户处理自己的账号,**超级用户亦只可以处理自己的账号** - ### 立即手动签到 #### 特定用户 From bd31d4ee978712b973fa1a5ea5794d4c00d0e173 Mon Sep 17 00:00:00 2001 From: Cateon Huo <2221533105@qq.com> Date: Sun, 7 Jan 2024 14:09:52 +0800 Subject: [PATCH 17/18] :arrow_down: downgrade version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 23a7bb4..12aa8f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "nonebot-plugin-skland-arksign" -version = "0.7.0" +version = "0.6.4" description = "用于每日定时签到森空岛明日方舟的Nonebot插件" authors = [ {name = "GuGuMur", email = "222153315@qq.com"}, From 23f44e94773949491ae72d497a0ab84ffa6b0370 Mon Sep 17 00:00:00 2001 From: Azide Date: Fri, 12 Jan 2024 23:00:51 +0800 Subject: [PATCH 18/18] =?UTF-8?q?:green=5Fheart:=20=E8=BF=98=E5=8E=9FCI?= =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/testing.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 2b90ea2..835ee1a 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -37,14 +37,14 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up PDM - uses: pdm-project/setup-pdm@v3 + + - name: Setup Python environment + uses: ./.github/actions/setup-python with: python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pdm sync -d -G test - - name: Run Tests - run: | - pdm run -v pytest tests + - name: Install prerequisites + run: pdm install + + - name: Run Pytest + run: pdm run pytest -n auto