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 13:27:25 +08:00

19 lines
792 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
from core.logger import Logger
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('请发送要生成摘要的合并转发消息。')
f = re.search(r'\[Ke:forward,id=(.*?)\]', f_msg.asDisplay()).group(1)
Logger.info(f)
data = await f_msg.call_api('get_forward_msg', message_id=f)
msgs = data['messages']
text = ''
for m in msgs:
text += f'\n{m["sender"]["nickname"]}ID{m["sender"]["user_id"]}Unix时间{m["time"]}{m["content"]}'
await msg.finish(text, disable_secret_check=True)