mirror of
https://github.com/A-Minos/nonebot-plugin-tetris-stats.git
synced 2026-03-05 05:36:54 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7ff59cfc01 | |||
| 498781f376 | |||
| a3c00dbd93 | |||
| 069d5953f9 | |||
| 3721d92f52 |
@@ -121,12 +121,10 @@ async def trigger(
|
|||||||
command_type: CommandType | Literal['rank'],
|
command_type: CommandType | Literal['rank'],
|
||||||
command_args: list[str],
|
command_args: list[str],
|
||||||
) -> AsyncGenerator:
|
) -> AsyncGenerator:
|
||||||
logger.debug('running')
|
|
||||||
trigger_time = datetime.now(UTC)
|
trigger_time = datetime.now(UTC)
|
||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
except FinishedException:
|
except FinishedException:
|
||||||
logger.debug('yield')
|
|
||||||
async with get_session() as session:
|
async with get_session() as session:
|
||||||
session.add(
|
session.add(
|
||||||
TriggerHistoricalData(
|
TriggerHistoricalData(
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class PydanticType(TypeDecorator):
|
|||||||
@override
|
@override
|
||||||
def process_bind_param(self, value: Any | None, dialect: Dialect) -> str:
|
def process_bind_param(self, value: Any | None, dialect: Dialect) -> str:
|
||||||
# 将 Pydantic 模型实例转换为 JSON
|
# 将 Pydantic 模型实例转换为 JSON
|
||||||
if isinstance(value, tuple(self.pydantic_models)):
|
if isinstance(value, tuple(self.models)):
|
||||||
return value.model_dump_json(by_alias=True) # type: ignore[union-attr]
|
return value.model_dump_json(by_alias=True) # type: ignore[union-attr]
|
||||||
raise TypeError
|
raise TypeError
|
||||||
else:
|
else:
|
||||||
@@ -41,7 +41,7 @@ class PydanticType(TypeDecorator):
|
|||||||
@override
|
@override
|
||||||
def process_bind_param(self, value: Any | None, dialect: Dialect) -> str:
|
def process_bind_param(self, value: Any | None, dialect: Dialect) -> str:
|
||||||
# 将 Pydantic 模型实例转换为 JSON
|
# 将 Pydantic 模型实例转换为 JSON
|
||||||
if isinstance(value, tuple(self.pydantic_models)):
|
if isinstance(value, tuple(self.models)):
|
||||||
return value.json(by_alias=True) # type: ignore[union-attr]
|
return value.json(by_alias=True) # type: ignore[union-attr]
|
||||||
raise TypeError
|
raise TypeError
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ class PydanticType(TypeDecorator):
|
|||||||
def process_result_value(self, value: Any | None, dialect: Dialect) -> BaseModel:
|
def process_result_value(self, value: Any | None, dialect: Dialect) -> BaseModel:
|
||||||
# 将 JSON 转换回 Pydantic 模型实例
|
# 将 JSON 转换回 Pydantic 模型实例
|
||||||
if isinstance(value, str | bytes):
|
if isinstance(value, str | bytes):
|
||||||
for i in self.pydantic_models:
|
for i in self.models:
|
||||||
try:
|
try:
|
||||||
return type_validate_json(i, value)
|
return type_validate_json(i, value)
|
||||||
except ValidationError: # noqa: PERF203
|
except ValidationError: # noqa: PERF203
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ from datetime import datetime
|
|||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
from .....utils.typing import Number
|
||||||
from .base import FailedModel
|
from .base import FailedModel
|
||||||
from .base import SuccessModel as BaseSuccessModel
|
from .base import SuccessModel as BaseSuccessModel
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@ class Finesse(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class EndContext(BaseModel):
|
class EndContext(BaseModel):
|
||||||
seed: int
|
seed: Number
|
||||||
lines: int
|
lines: int
|
||||||
level_lines: int
|
level_lines: int
|
||||||
level_lines_needed: int
|
level_lines_needed: int
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = 'nonebot-plugin-tetris-stats'
|
name = 'nonebot-plugin-tetris-stats'
|
||||||
version = '1.2.0'
|
version = '1.2.2'
|
||||||
description = '一款基于 NoneBot2 的用于查询 Tetris 相关游戏数据的插件'
|
description = '一款基于 NoneBot2 的用于查询 Tetris 相关游戏数据的插件'
|
||||||
authors = ['scdhh <wallfjjd@gmail.com>']
|
authors = ['scdhh <wallfjjd@gmail.com>']
|
||||||
readme = 'README.md'
|
readme = 'README.md'
|
||||||
|
|||||||
Reference in New Issue
Block a user