diff --git a/apps/riic_report_analysis.py b/apps/riic_report_analysis.py index 587510b..e43becd 100644 --- a/apps/riic_report_analysis.py +++ b/apps/riic_report_analysis.py @@ -1,6 +1,7 @@ from pepperbot.core.message.chain import MessageChain, Image, Text, At from pepperbot.extensions.command import as_command, CLIArgument from pepperbot.extensions.command.sender import CommandSender +from pepperbot.adapters.universal.api import UniversalGroupBot from rapidocr_onnxruntime import RapidOCR import os import asyncio @@ -16,7 +17,12 @@ if not rapid_ocr: class RIICReportAnalysis: - async def group_message(self, chain: MessageChain, raw_event: Dict): + async def group_message( + self, + chain: MessageChain, + raw_event: Dict, + bot: UniversalGroupBot, + ): if len(chain) != 1 or len(chain.images) != 1: return img_seg: Image = chain[0] @@ -102,6 +108,7 @@ class RIICReportAnalysis: gold_list.sort(key=lambda x: x[0]) exp_list.sort(key=lambda x: x[0]) + output_list = [] output = "" lmb_avg = 0 order_avg = 0 @@ -124,6 +131,9 @@ class RIICReportAnalysis: output += f"🧈 {gold_list[i][1]}赤金\n" output += f"📼 {exp_list[i][1]}经验\n\n" + output_list.append(output.strip()) + output = "" + lmb_avg /= len(date_list) order_avg /= len(date_list) gold_avg /= len(date_list) @@ -199,7 +209,22 @@ class RIICReportAnalysis: output += f"{kaltsit:.0f}凯 = 贸 + 金 + 书向上取整到万\n" output += f"{stupid:.1f}友 = 贸 + 书" - await chain.onebot_reply(Text(output.strip())) + output_list.append(output.strip()) + + await bot.arbitrary.onebot.send_group_forward_msg( + raw_event["group_id"], + [ + { + "type": "node", + "data": { + "name": card, + "uin": raw_event["user_id"], + "content": [{"type": "text", "data": {"text": i}}], + }, + } + for i in output_list + ], + ) except Exception as e: err_msg = "出错啦!\n" err_msg += f"date_list = {date_list}\n"