合并转发基报分析
This commit is contained in:
parent
479278ba62
commit
854c97976a
1 changed files with 27 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
from pepperbot.core.message.chain import MessageChain, Image, Text, At
|
from pepperbot.core.message.chain import MessageChain, Image, Text, At
|
||||||
from pepperbot.extensions.command import as_command, CLIArgument
|
from pepperbot.extensions.command import as_command, CLIArgument
|
||||||
from pepperbot.extensions.command.sender import CommandSender
|
from pepperbot.extensions.command.sender import CommandSender
|
||||||
|
from pepperbot.adapters.universal.api import UniversalGroupBot
|
||||||
from rapidocr_onnxruntime import RapidOCR
|
from rapidocr_onnxruntime import RapidOCR
|
||||||
import os
|
import os
|
||||||
import asyncio
|
import asyncio
|
||||||
|
@ -16,7 +17,12 @@ if not rapid_ocr:
|
||||||
|
|
||||||
|
|
||||||
class RIICReportAnalysis:
|
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:
|
if len(chain) != 1 or len(chain.images) != 1:
|
||||||
return
|
return
|
||||||
img_seg: Image = chain[0]
|
img_seg: Image = chain[0]
|
||||||
|
@ -102,6 +108,7 @@ class RIICReportAnalysis:
|
||||||
gold_list.sort(key=lambda x: x[0])
|
gold_list.sort(key=lambda x: x[0])
|
||||||
exp_list.sort(key=lambda x: x[0])
|
exp_list.sort(key=lambda x: x[0])
|
||||||
|
|
||||||
|
output_list = []
|
||||||
output = ""
|
output = ""
|
||||||
lmb_avg = 0
|
lmb_avg = 0
|
||||||
order_avg = 0
|
order_avg = 0
|
||||||
|
@ -124,6 +131,9 @@ class RIICReportAnalysis:
|
||||||
output += f"🧈 {gold_list[i][1]}赤金\n"
|
output += f"🧈 {gold_list[i][1]}赤金\n"
|
||||||
output += f"📼 {exp_list[i][1]}经验\n\n"
|
output += f"📼 {exp_list[i][1]}经验\n\n"
|
||||||
|
|
||||||
|
output_list.append(output.strip())
|
||||||
|
output = ""
|
||||||
|
|
||||||
lmb_avg /= len(date_list)
|
lmb_avg /= len(date_list)
|
||||||
order_avg /= len(date_list)
|
order_avg /= len(date_list)
|
||||||
gold_avg /= len(date_list)
|
gold_avg /= len(date_list)
|
||||||
|
@ -199,7 +209,22 @@ class RIICReportAnalysis:
|
||||||
output += f"{kaltsit:.0f}凯 = 贸 + 金 + 书向上取整到万\n"
|
output += f"{kaltsit:.0f}凯 = 贸 + 金 + 书向上取整到万\n"
|
||||||
output += f"{stupid:.1f}友 = 贸 + 书"
|
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:
|
except Exception as e:
|
||||||
err_msg = "出错啦!\n"
|
err_msg = "出错啦!\n"
|
||||||
err_msg += f"date_list = {date_list}\n"
|
err_msg += f"date_list = {date_list}\n"
|
||||||
|
|
Loading…
Reference in a new issue