From 54c3ec255d6de8adfcb33b073eb45da72db164ef Mon Sep 17 00:00:00 2001 From: Zhao Zuohong Date: Mon, 14 Aug 2023 10:40:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E5=AF=B9=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E7=9A=84=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/riic_report_analysis.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/apps/riic_report_analysis.py b/apps/riic_report_analysis.py index 9a66179..b949ba0 100644 --- a/apps/riic_report_analysis.py +++ b/apps/riic_report_analysis.py @@ -1,4 +1,4 @@ -from pepperbot.core.message.chain import MessageChain, Image, Text +from pepperbot.core.message.chain import MessageChain, Image, Text, At from rapidocr_onnxruntime import RapidOCR import os import asyncio @@ -38,6 +38,8 @@ class RIICReportAnalysis: break for i in result: if m := re.search(r"([0-9]+\.[0-9]+)", i[1]): + if float(i[2]) < 0.6: + continue date_list.append([int(i[0][0][0]), m.group(1)]) continue if m := re.search(r"EXP([0-9]+)的作战记录", i[1]): @@ -53,16 +55,23 @@ class RIICReportAnalysis: lmb_list.sort(key=lambda x: x[0]) gold_list.sort(key=lambda x: x[0]) exp_list.sort(key=lambda x: x[0]) - date_list.sort(key=lambda x: x[0]) output = "" - for i in range(len(date_list)): - output += f"【{date_list[i][1]}】\n" - output += f"💵 {lmb_list[2 * i][1]}订单({lmb_list[2 * i + 1][1]})\n" - output += f"🧈 {gold_list[i][1]}赤金\n" - output += f"📼 {exp_list[i][1]}经验\n\n" + try: + for i in range(len(date_list)): + output += f"【{date_list[i][1]}】\n" + output += f"💵 {lmb_list[2 * i][1]}订单({lmb_list[2 * i + 1][1]})\n" + output += f"🧈 {gold_list[i][1]}赤金\n" + output += f"📼 {exp_list[i][1]}经验\n\n" - await chain.onebot_reply(Text(output.strip())) + await chain.onebot_reply(Text(output.strip())) + except: + err_msg = "出错啦!\n" + err_msg += f"date_list = {date_list}\n" + err_msg += f"lmb_list = {lmb_list}\n" + err_msg += f"gold_list = {gold_list}\n" + err_msg += f"exp_list = {exp_list}" + await chain.onebot_reply(Text(err_msg), At("1040110848")) os.remove(img_path)