From 7a4e391ae637884d03798228157014653c19010b Mon Sep 17 00:00:00 2001 From: Keming Date: Thu, 17 Jul 2025 09:09:33 +0800 Subject: [PATCH] feat: allow `--limit` for the user stats Signed-off-by: Keming --- handlers/summary/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/handlers/summary/__init__.py b/handlers/summary/__init__.py index ad73991..154fc73 100644 --- a/handlers/summary/__init__.py +++ b/handlers/summary/__init__.py @@ -106,7 +106,12 @@ def stats_command(message: Message, bot: TeleBot): for entry in stats ) - user_stats = store.get_user_stats(message.chat.id) + text_args = shlex.split(message.text) + if len(text_args) > 1 and text_args[1].isdigit(): + limit = int(text_args[1]) + else: + limit = 10 + user_stats = store.get_user_stats(message.chat.id, limit=limit) if user_stats: # 计算用户消息数量的最大宽度 max_user_count_width = max(