Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/modules/summary/__init__.py
2023-02-07 09:45:28 +08:00

15 lines
685 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import re
from core.builtins import Bot
from core.component import on_command
s = on_command('summary', developers=['Dianliang233'], desc='生成聊天记录摘要', available_for=['QQ|Group'], required_superuser=True)
@s.handle()
async def _(msg: Bot.MessageSession):
f_msg = await msg.waitNextMessage('请发送要生成摘要的合并转发消息。')
data = await f_msg.call_api('get_forward_msg', msg_id=re.search(r'\[Ke:forward,id=(.*?)\]', f_msg.asDisplay()).group(1))
msgs = data['messages']
for m in msgs:
text += f'{m["sender"]["nickname"]}ID{m["sender"]["user_id"]}Unix时间{m["time"]}{m["content"]}\n'
await msg.send(text)