完善 trigger

This commit is contained in:
2024-06-28 15:52:07 +08:00
parent aacf518004
commit 8bdde936f8
5 changed files with 18 additions and 12 deletions

View File

@@ -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:

View File

@@ -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:

View File

@@ -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:

View File

@@ -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()

View File

@@ -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()