11
This commit is contained in:
@@ -168,7 +168,7 @@ class Jx3ApiPlugin(Star):
|
|||||||
@filter.permission_type(filter.PermissionType.ADMIN)
|
@filter.permission_type(filter.PermissionType.ADMIN)
|
||||||
@jx3.command("外观数据同步")
|
@jx3.command("外观数据同步")
|
||||||
async def jx3_SearchData(self, event: AstrMessageEvent):
|
async def jx3_SearchData(self, event: AstrMessageEvent):
|
||||||
"""剑三外观数据同步"""
|
"""剑三 外观数据同步"""
|
||||||
try:
|
try:
|
||||||
data=await self.jx3fun.SearchData()
|
data=await self.jx3fun.SearchData()
|
||||||
if data["code"] == 200:
|
if data["code"] == 200:
|
||||||
@@ -239,45 +239,6 @@ class Jx3ApiPlugin(Star):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@filter.command("剑三物价")
|
|
||||||
async def jx3_wujia11(self, event: AstrMessageEvent):
|
|
||||||
"""剑三物价 外观名称"""
|
|
||||||
|
|
||||||
inname = "秃盒"
|
|
||||||
|
|
||||||
# 获取消息内容
|
|
||||||
message_str = event.message_str.strip()
|
|
||||||
parts = message_str.split()
|
|
||||||
# 解析消息内容
|
|
||||||
if len(parts) > 1:
|
|
||||||
inname = parts[1] # 外观名称
|
|
||||||
|
|
||||||
try:
|
|
||||||
# 加载模板
|
|
||||||
try:
|
|
||||||
template_content = load_template("wujia.html")
|
|
||||||
except FileNotFoundError as e:
|
|
||||||
logger.error(f"加载模板失败: {e}")
|
|
||||||
yield event.plain_result("系统错误:模板文件不存在")
|
|
||||||
return
|
|
||||||
|
|
||||||
render_data = jx3_data_wujia(inname)
|
|
||||||
|
|
||||||
if render_data.get("code") == 200:
|
|
||||||
url = await self.html_render(template_content, render_data, options={})
|
|
||||||
yield event.image_result(url)
|
|
||||||
else:
|
|
||||||
yield event.plain_result(f"{render_data.get('msg')}")
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"处理数据时出错: {e}")
|
|
||||||
yield event.plain_result("处理接口返回信息时出错")
|
|
||||||
|
|
||||||
|
|
||||||
async def terminate(self):
|
async def terminate(self):
|
||||||
"""可选择实现异步的插件销毁方法,当插件被卸载/停用时会调用。"""
|
"""可选择实现异步的插件销毁方法,当插件被卸载/停用时会调用。"""
|
||||||
await self.db.close_pool()
|
await self.db.close_pool()
|
||||||
|
|||||||
Reference in New Issue
Block a user