mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
✨ feat: #验车
加入权限验证
This commit is contained in:
parent
db648fe1a9
commit
720fc29ed2
@ -2,7 +2,7 @@ import axios from "axios";
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import fetch from "node-fetch";
|
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 {
|
import {
|
||||||
LINUX_AI_PROMPT,
|
LINUX_AI_PROMPT,
|
||||||
LINUX_QUERY,
|
LINUX_QUERY,
|
||||||
@ -63,10 +63,6 @@ export class query extends plugin {
|
|||||||
{
|
{
|
||||||
reg: "^#R文档(.*)",
|
reg: "^#R文档(.*)",
|
||||||
fnc: "intelligentDoc",
|
fnc: "intelligentDoc",
|
||||||
},
|
|
||||||
{
|
|
||||||
reg: '^#验车(.*?)',
|
|
||||||
fnc: 'yc'
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
@ -398,35 +394,6 @@ export class query extends plugin {
|
|||||||
return;
|
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) {
|
removeTag(title) {
|
||||||
const titleRex = /<[^>]+>/g;
|
const titleRex = /<[^>]+>/g;
|
||||||
|
@ -215,6 +215,10 @@ export class tools extends plugin {
|
|||||||
{
|
{
|
||||||
reg: "tieba.baidu.com",
|
reg: "tieba.baidu.com",
|
||||||
fnc: "tieba"
|
fnc: "tieba"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
reg: '^#验车(.*?)',
|
||||||
|
fnc: 'yc'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
@ -1973,6 +1977,40 @@ export class tools extends plugin {
|
|||||||
return true;
|
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
|
* @param title
|
||||||
|
Loading…
x
Reference in New Issue
Block a user