Skip to content

Commit 1dd29fb

Browse files
✨ 更新 list 命令的 --limit 选项,添加范围限制 (#603)
1 parent 6f3f6bd commit 1dd29fb

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

  • nonebot_plugin_tetris_stats/games/tetrio

nonebot_plugin_tetris_stats/games/tetrio/list.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import Annotated
2+
13
from nonebot_plugin_alconna import Args, Option, Subcommand
24
from nonebot_plugin_alconna.uniseg import UniMessage
35
from nonebot_plugin_uninfo import Uninfo
@@ -21,7 +23,13 @@
2123
'list',
2224
Option('--max-tr', Args['max_tr', float], help_text='TR的上限'),
2325
Option('--min-tr', Args['min_tr', float], help_text='TR的下限'),
24-
Option('--limit', Args['limit', int], help_text='查询数量'),
26+
Option(
27+
'--limit',
28+
Args[
29+
'limit', Annotated[int, lambda x: 1 <= x <= 100] # noqa: PLR2004
30+
],
31+
help_text='查询数量',
32+
),
2533
Option('--country', Args['country', str], help_text='国家代码'),
2634
help_text='查询 TETR.IO 段位排行榜',
2735
)

0 commit comments

Comments
 (0)