mirror of
https://github.com/A-Minos/nonebot-plugin-tetris-stats.git
synced 2026-03-05 05:36:54 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5e45db8cf5 | |||
|
|
2020deadac | ||
|
|
ce7bce6e20 | ||
|
|
d4b690f682 |
2
.github/workflows/Release.yml
vendored
2
.github/workflows/Release.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: astral-sh/setup-uv@v4
|
- uses: astral-sh/setup-uv@v5
|
||||||
name: Setup UV
|
name: Setup UV
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
|
|||||||
2
.github/workflows/Test.yml
vendored
2
.github/workflows/Test.yml
vendored
@@ -28,7 +28,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup uv
|
- name: Setup uv
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
cache-suffix: ${{ env.PYTHON_VERSION }}_${{ env.OS }}
|
cache-suffix: ${{ env.PYTHON_VERSION }}_${{ env.OS }}
|
||||||
|
|||||||
2
.github/workflows/TypeCheck.yml
vendored
2
.github/workflows/TypeCheck.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: astral-sh/setup-uv@v4
|
- uses: astral-sh/setup-uv@v5
|
||||||
name: Setup UV
|
name: Setup UV
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ ci:
|
|||||||
autoupdate_commit_msg: ':arrow_up: auto update by pre-commit hooks'
|
autoupdate_commit_msg: ':arrow_up: auto update by pre-commit hooks'
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.8.1
|
rev: v0.8.3
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [--fix, --exit-non-zero-on-fix]
|
args: [--fix, --exit-non-zero-on-fix]
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from ...typing import Rank, ValidRank
|
|||||||
from ..base import ArCounts, FailedModel, P, SuccessModel
|
from ..base import ArCounts, FailedModel, P, SuccessModel
|
||||||
|
|
||||||
|
|
||||||
class League(BaseModel):
|
class BaseLeague(BaseModel):
|
||||||
gamesplayed: int
|
gamesplayed: int
|
||||||
gameswon: int
|
gameswon: int
|
||||||
tr: float
|
tr: float
|
||||||
@@ -16,13 +16,21 @@ class League(BaseModel):
|
|||||||
bestrank: ValidRank
|
bestrank: ValidRank
|
||||||
glicko: float
|
glicko: float
|
||||||
rd: float
|
rd: float
|
||||||
apm: float
|
|
||||||
pps: float
|
pps: float
|
||||||
vs: float
|
|
||||||
decaying: bool
|
decaying: bool
|
||||||
|
|
||||||
|
|
||||||
class Entry(BaseModel):
|
class InvalidLeague(BaseLeague):
|
||||||
|
apm: None
|
||||||
|
vs: None
|
||||||
|
|
||||||
|
|
||||||
|
class League(BaseLeague):
|
||||||
|
apm: float
|
||||||
|
vs: float
|
||||||
|
|
||||||
|
|
||||||
|
class BaseEntry(BaseModel):
|
||||||
id: str = Field(..., alias='_id')
|
id: str = Field(..., alias='_id')
|
||||||
username: str
|
username: str
|
||||||
role: Literal['anon', 'user', 'bot', 'halfmod', 'mod', 'admin', 'sysop']
|
role: Literal['anon', 'user', 'bot', 'halfmod', 'mod', 'admin', 'sysop']
|
||||||
@@ -30,7 +38,6 @@ class Entry(BaseModel):
|
|||||||
xp: float
|
xp: float
|
||||||
country: str | None = None
|
country: str | None = None
|
||||||
supporter: bool | None = None
|
supporter: bool | None = None
|
||||||
league: League
|
|
||||||
gamesplayed: int
|
gamesplayed: int
|
||||||
gameswon: int
|
gameswon: int
|
||||||
gametime: float
|
gametime: float
|
||||||
@@ -39,8 +46,16 @@ class Entry(BaseModel):
|
|||||||
p: P
|
p: P
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidEntry(BaseEntry):
|
||||||
|
league: InvalidLeague
|
||||||
|
|
||||||
|
|
||||||
|
class Entry(BaseEntry):
|
||||||
|
league: League
|
||||||
|
|
||||||
|
|
||||||
class Data(BaseModel):
|
class Data(BaseModel):
|
||||||
entries: list[Entry]
|
entries: list[Entry | InvalidEntry]
|
||||||
|
|
||||||
|
|
||||||
class BySuccessModel(SuccessModel):
|
class BySuccessModel(SuccessModel):
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ from . import command
|
|||||||
from .api.leaderboards import by
|
from .api.leaderboards import by
|
||||||
from .api.schemas.base import P
|
from .api.schemas.base import P
|
||||||
from .api.schemas.leaderboards import Parameter
|
from .api.schemas.leaderboards import Parameter
|
||||||
|
from .api.schemas.leaderboards.by import Entry
|
||||||
from .constant import GAME_TYPE
|
from .constant import GAME_TYPE
|
||||||
|
|
||||||
command.add(
|
command.add(
|
||||||
@@ -84,6 +85,7 @@ async def _(
|
|||||||
join_at=None,
|
join_at=None,
|
||||||
)
|
)
|
||||||
for i in league.data.entries
|
for i in league.data.entries
|
||||||
|
if isinstance(i, Entry)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ async def get_tetra_league_data() -> None:
|
|||||||
|
|
||||||
players: list[Entry] = []
|
players: list[Entry] = []
|
||||||
for result in results:
|
for result in results:
|
||||||
players.extend(result.data.entries)
|
players.extend([i for i in result.data.entries if isinstance(i, Entry)])
|
||||||
players.sort(key=lambda x: x.league.tr, reverse=True)
|
players.sort(key=lambda x: x.league.tr, reverse=True)
|
||||||
|
|
||||||
rank_player_mapping: defaultdict[Rank, list[Entry]] = defaultdict(list)
|
rank_player_mapping: defaultdict[Rank, list[Entry]] = defaultdict(list)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "nonebot-plugin-tetris-stats"
|
name = "nonebot-plugin-tetris-stats"
|
||||||
version = "1.7.0"
|
version = "1.7.1"
|
||||||
description = "一款基于 NoneBot2 的用于查询 Tetris 相关游戏数据的插件"
|
description = "一款基于 NoneBot2 的用于查询 Tetris 相关游戏数据的插件"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = [{ name = "shoucandanghehe", email = "wallfjjd@gmail.com" }]
|
authors = [{ name = "shoucandanghehe", email = "wallfjjd@gmail.com" }]
|
||||||
@@ -158,7 +158,7 @@ defineConstant = { PYDANTIC_V2 = true }
|
|||||||
typeCheckingMode = "standard"
|
typeCheckingMode = "standard"
|
||||||
|
|
||||||
[tool.bumpversion]
|
[tool.bumpversion]
|
||||||
current_version = "1.7.0"
|
current_version = "1.7.1"
|
||||||
tag = true
|
tag = true
|
||||||
sign_tags = true
|
sign_tags = true
|
||||||
tag_name = "{new_version}"
|
tag_name = "{new_version}"
|
||||||
|
|||||||
Reference in New Issue
Block a user