改进对日期的判断

This commit is contained in:
zhbaor 2023-08-14 10:40:47 +08:00
parent f1b989ef74
commit 54c3ec255d

View file

@ -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,10 +55,10 @@ 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 = ""
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"
@ -64,5 +66,12 @@ class RIICReportAnalysis:
output += f"📼 {exp_list[i][1]}经验\n\n"
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)