fix: padding text

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
This commit is contained in:
yihong0618
2025-07-15 19:32:31 +08:00
parent aa06fb2c7b
commit 1c7aba4333

View File

@ -81,17 +81,21 @@ def summary_command(message: Message, bot: TeleBot):
def stats_command(message: Message, bot: TeleBot): def stats_command(message: Message, bot: TeleBot):
"""获取群组消息统计信息""" """获取群组消息统计信息"""
stats = store.get_stats(message.chat.id) stats = store.get_stats(message.chat.id)
print(11111111111111111)
if not stats: if not stats:
bot.reply_to(message, "没有找到任何统计信息。") bot.reply_to(message, "没有找到任何统计信息。")
return return
# 格式化消息数量和日期对齐
stats_text = "\n".join( stats_text = "\n".join(
f"{entry.date}: {entry.message_count} messages" for entry in stats f"{entry.message_count:>4} messages - {entry.date}" for entry in stats
) )
user_stats = store.get_user_stats(message.chat.id) user_stats = store.get_user_stats(message.chat.id)
# 格式化消息数量和用户名对齐
user_text = "\n".join( user_text = "\n".join(
f"{entry.user_name}: {entry.message_count}" for entry in user_stats f"{entry.message_count:>4} messages - {entry.user_name}" for entry in user_stats
) )
bot.reply_to( bot.reply_to(
message, message,
( (