diff --git a/apps/query.js b/apps/query.js index 131c5b8..e8459b5 100644 --- a/apps/query.js +++ b/apps/query.js @@ -2,7 +2,7 @@ import axios from "axios"; import _ from "lodash"; import fetch from "node-fetch"; // 常量 -import { CAT_LIMIT, COMMON_USER_AGENT, MESSAGE_RECALL_TIME } from "../constants/constant.js"; +import { CAT_LIMIT, COMMON_USER_AGENT } from "../constants/constant.js"; import { LINUX_AI_PROMPT, LINUX_QUERY, @@ -63,10 +63,6 @@ export class query extends plugin { { reg: "^#R文档(.*)", fnc: "intelligentDoc", - }, - { - reg: '^#验车(.*?)', - fnc: 'yc' } ], }); @@ -398,35 +394,6 @@ 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, { - headers: { - "User-Agent": COMMON_USER_AGENT, - } - }); - if (!resp.data) { - e.reply("没有找到相关磁力"); - return; - } - await e.reply(`🧲 [R插件 x Mix] 联合为您验车:\n${ resp.data.name }`, false, { recallMsg: MESSAGE_RECALL_TIME }); - if (resp.data?.screenshots === null) { - e.reply("没有找到相关媒体"); - return; - } - 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; diff --git a/apps/tools.js b/apps/tools.js index 7088b9a..ba8c70b 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -215,6 +215,10 @@ export class tools extends plugin { { reg: "tieba.baidu.com", fnc: "tieba" + }, + { + reg: '^#验车(.*?)', + fnc: 'yc' } ], }); @@ -1973,6 +1977,40 @@ export class tools extends plugin { return true; } + async yc(e) { + if (!(await this.isTrustUser(e.user_id))) { + e.reply("你没有权限使用此命令"); + return; + } + + const tag = e.msg.replace(/#验车/g, ""); + + const reqUrl = `https://whatslink.info/api/v1/link?url=${tag}`; + const resp = await axios.get(reqUrl, { + headers: { + "User-Agent": COMMON_USER_AGENT, + } + }); + if (!resp.data) { + e.reply("没有找到相关磁力"); + return; + } + await e.reply(`🧲 [R插件 x Mix] 联合为您验车:\n${ resp.data.name }`, false, { recallMsg: MESSAGE_RECALL_TIME }); + if (resp.data?.screenshots === null) { + e.reply("没有找到相关媒体"); + return; + } + 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 }); + } + /** * 哔哩哔哩下载 * @param title