feat: 集成 Mix 的#验车

This commit is contained in:
zhiyu1998 2024-09-18 18:56:11 +08:00
parent 7aa487b13a
commit 3e8b1bcc72

View File

@ -2,7 +2,7 @@ import axios from "axios";
import _ from "lodash";
import fetch from "node-fetch";
// 常量
import { CAT_LIMIT, COMMON_USER_AGENT } from "../constants/constant.js";
import { CAT_LIMIT, COMMON_USER_AGENT, MESSAGE_RECALL_TIME } from "../constants/constant.js";
import {
LINUX_AI_PROMPT,
LINUX_QUERY,
@ -63,6 +63,10 @@ export class query extends plugin {
{
reg: "^#R文档(.*)",
fnc: "intelligentDoc",
},
{
reg: '^#验车(.*?)',
fnc: 'yc'
}
],
});
@ -394,6 +398,27 @@ export class query extends plugin {
return;
}
async yc(e) {
const tag = e.msg.replace(/#验车/g, "");
const reqUrl = `https://whatslink.info/api/v1/link?url=${tag}`;
const resp = await axios.get(reqUrl);
if (!resp.data) {
e.reply("没有找到相关磁力");
return;
}
e.reply(`🧲 [R插件 x Mix] 联合为您验车:\n${ resp.data.name }`);
const screenshots = resp.data.screenshots.map(item => {
const screenshot = item.screenshot;
return {
message: segment.image(screenshot),
nickname: this.e.sender.card || this.e.user_id,
user_id: this.e.user_id,
}
});
e.reply(Bot.makeForwardMsg(screenshots), false, { recallMsg: MESSAGE_RECALL_TIME });
}
// 删除标签
removeTag(title) {
const titleRex = /<[^>]+>/g;