From 8bdde936f85b7afa53310d0f72a1f0457d26161c Mon Sep 17 00:00:00 2001 From: shoucandanghehe Date: Fri, 28 Jun 2024 15:52:07 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E5=AE=8C=E5=96=84=20trigger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_tetris_stats/games/tetrio/config.py | 2 +- nonebot_plugin_tetris_stats/games/tetrio/list.py | 8 +++++++- nonebot_plugin_tetris_stats/games/tetrio/query.py | 4 ++-- nonebot_plugin_tetris_stats/games/tetrio/record/blitz.py | 8 ++++---- nonebot_plugin_tetris_stats/games/tetrio/record/sprint.py | 8 ++++---- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/nonebot_plugin_tetris_stats/games/tetrio/config.py b/nonebot_plugin_tetris_stats/games/tetrio/config.py index 53efbe7..9ec44e1 100644 --- a/nonebot_plugin_tetris_stats/games/tetrio/config.py +++ b/nonebot_plugin_tetris_stats/games/tetrio/config.py @@ -18,7 +18,7 @@ async def _(user: User, session: async_scoped_session, event_session: EventSessi session_persist_id=await get_session_persist_id(event_session), game_platform=GAME_TYPE, command_type='config', - command_args=[], + command_args=[f'--default-template {template}'], ): config = (await session.scalars(select(TETRIOUserConfig).where(TETRIOUserConfig.id == user.id))).one_or_none() if config is None: diff --git a/nonebot_plugin_tetris_stats/games/tetrio/list.py b/nonebot_plugin_tetris_stats/games/tetrio/list.py index 1eae22e..124a2b9 100644 --- a/nonebot_plugin_tetris_stats/games/tetrio/list.py +++ b/nonebot_plugin_tetris_stats/games/tetrio/list.py @@ -26,7 +26,13 @@ async def _( session_persist_id=await get_session_persist_id(event_session), game_platform=GAME_TYPE, command_type='list', - command_args=[], + command_args=[ + f'{key} {value}' + for key, value in zip( + ('--max-tr', '--min-tr', '--limit', '--country'), (max_tr, min_tr, limit, country), strict=True + ) + if value is not None + ], ): parameter: Parameter = {} if max_tr is not None: diff --git a/nonebot_plugin_tetris_stats/games/tetrio/query.py b/nonebot_plugin_tetris_stats/games/tetrio/query.py index 659b281..47623b4 100644 --- a/nonebot_plugin_tetris_stats/games/tetrio/query.py +++ b/nonebot_plugin_tetris_stats/games/tetrio/query.py @@ -67,7 +67,7 @@ async def _( # noqa: PLR0913 session_persist_id=await get_session_persist_id(event_session), game_platform=GAME_TYPE, command_type='query', - command_args=[], + command_args=[f'--default-template {template}'] if template is not None else [], ): async with get_session() as session: bind = await query_bind_info( @@ -94,7 +94,7 @@ async def _(user: NBUser, account: Player, event_session: EventSession, template session_persist_id=await get_session_persist_id(event_session), game_platform=GAME_TYPE, command_type='query', - command_args=[], + command_args=[f'--default-template {template}'] if template is not None else [], ): async with get_session() as session: if template is None: diff --git a/nonebot_plugin_tetris_stats/games/tetrio/record/blitz.py b/nonebot_plugin_tetris_stats/games/tetrio/record/blitz.py index b005bd1..5a29df5 100644 --- a/nonebot_plugin_tetris_stats/games/tetrio/record/blitz.py +++ b/nonebot_plugin_tetris_stats/games/tetrio/record/blitz.py @@ -38,8 +38,8 @@ async def _( async with trigger( session_persist_id=await get_session_persist_id(event_session), game_platform=GAME_TYPE, - command_type='bind', - command_args=[], + command_type='record', + command_args=['--blitz'], ): async with get_session() as session: bind = await query_bind_info( @@ -61,8 +61,8 @@ async def _(account: Player, event_session: EventSession): async with trigger( session_persist_id=await get_session_persist_id(event_session), game_platform=GAME_TYPE, - command_type='bind', - command_args=[], + command_type='record', + command_args=['--blitz'], ): await UniMessage.image(raw=await make_blitz_image(account)).finish() diff --git a/nonebot_plugin_tetris_stats/games/tetrio/record/sprint.py b/nonebot_plugin_tetris_stats/games/tetrio/record/sprint.py index bb7c4f3..de42dd7 100644 --- a/nonebot_plugin_tetris_stats/games/tetrio/record/sprint.py +++ b/nonebot_plugin_tetris_stats/games/tetrio/record/sprint.py @@ -38,8 +38,8 @@ async def _( async with trigger( session_persist_id=await get_session_persist_id(event_session), game_platform=GAME_TYPE, - command_type='bind', - command_args=[], + command_type='record', + command_args=['--40l'], ): async with get_session() as session: bind = await query_bind_info( @@ -61,8 +61,8 @@ async def _(account: Player, event_session: EventSession): async with trigger( session_persist_id=await get_session_persist_id(event_session), game_platform=GAME_TYPE, - command_type='bind', - command_args=[], + command_type='record', + command_args=['--40l'], ): await UniMessage.image(raw=await make_sprint_image(account)).finish()