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

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

@ -35,6 +35,11 @@ stat_msg = on_alconna(
Args["group_id", str, "current"],
help_text="指定群组"
),
Option(
"-u|--user",
Args["user_id", str, "current"],
help_text="指定用户"
),
alias={"msg", "m"},
help_text="查看统计次数内的消息"
)
@ -56,6 +61,7 @@ async def _(result: Arparma, event: T_MessageEvent, bot: Bot):
group_id = result.other_args.get("group_id")
bot_id = result.other_args.get("bot_id")
user_id = result.other_args.get("user_id")
if group_id in ["current", "c"]:
group_id = str(event_utils.get_group_id(event))
@ -66,5 +72,8 @@ async def _(result: Arparma, event: T_MessageEvent, bot: Bot):
if bot_id in ["current", "c"]:
bot_id = str(bot.self_id)
img = await get_stat_msg_image(duration, period, group_id, bot_id, ulang)
if user_id in ["current", "c"]:
user_id = str(event_utils.get_user_id(event))
img = await get_stat_msg_image(duration=duration, period=period, group_id=group_id, bot_id=bot_id, user_id=user_id, ulang=ulang)
await stat_msg.send(UniMessage.image(raw=img))