mirror of
https://github.com/cdryzun/tg_bot_collections.git
synced 2025-08-05 13:16:42 +08:00
@ -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,
|
||||||
(
|
(
|
||||||
|
Reference in New Issue
Block a user