消息统计新增指定用户选项

This commit is contained in:
2024-05-24 23:41:33 +08:00
parent 8e06244311
commit 5bc2725d1b
2 changed files with 15 additions and 2 deletions

View File

@ -22,7 +22,7 @@ async def count_msg_by_bot_id(bot_id: str) -> int:
return len(msg_rows)
async def get_stat_msg_image(duration: int, period: int, group_id: str = None, bot_id: str = None,
async def get_stat_msg_image(duration: int, period: int, group_id: str = None, bot_id: str = None, user_id: str = None,
ulang: Language = Language()) -> bytes:
"""
获取统计消息
@ -50,6 +50,10 @@ async def get_stat_msg_image(duration: int, period: int, group_id: str = None, b
condition += " AND bot_id = ?"
condition_args.append(bot_id)
if user_id:
condition += " AND user_id = ?"
condition_args.append(user_id)
msg_rows = msg_db.where_all(
MessageEventModel(),
condition,