mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 08:09:19 +00:00
✨ feat: 新增 #竹白 百科功能
This commit is contained in:
parent
526c1f0a5f
commit
611b297556
@ -50,6 +50,10 @@ export class query extends plugin {
|
||||
{
|
||||
reg: "^#bookid(.*)$$",
|
||||
fnc: "searchBookById",
|
||||
},
|
||||
{
|
||||
reg: "^#竹白(.*)",
|
||||
fnc: "zhubaiSearch",
|
||||
}
|
||||
],
|
||||
});
|
||||
@ -358,6 +362,37 @@ export class query extends plugin {
|
||||
this.finish("searchBookContext");
|
||||
}
|
||||
|
||||
// 竹白百科
|
||||
async zhubaiSearch(e) {
|
||||
const keyword = e.msg.replace("#竹白", "").trim();
|
||||
if (keyword === "") {
|
||||
e.reply("请输入想了解的内容,例如:#竹白 javascript");
|
||||
return true;
|
||||
}
|
||||
await axios.post("https://open.zhubai.wiki/a/zb/s/ep/", {
|
||||
"content": 1,
|
||||
"keyword": keyword
|
||||
}, {
|
||||
headers: {
|
||||
"User-Agent":
|
||||
"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Mobile Safari/537.36",
|
||||
}
|
||||
}).then(async resp => {
|
||||
const res = resp.data.data;
|
||||
const content = await res.map(item => {
|
||||
const {pn, pa, zn, lu, pu, pq, aa, hl } = item;
|
||||
const template = `标题:${pn}\n${pa}\n期刊:${zn}\n发布日期距今:${lu}\n链接1:${pu}\n链接2:${pq}\n\n 大致描述:${hl.join("\n").replace(/<\/?font[^>]*>/g, '')}`
|
||||
return {
|
||||
message: [segment.image(aa), template],
|
||||
nickname: this.e.sender.card || this.e.user_id,
|
||||
user_id: this.e.user_id,
|
||||
}
|
||||
})
|
||||
e.reply(await Bot.makeForwardMsg(content));
|
||||
})
|
||||
return true;
|
||||
}
|
||||
|
||||
// 删除标签
|
||||
removeTag(title) {
|
||||
const titleRex = /<[^>]+>/g;
|
||||
|
@ -21,6 +21,9 @@
|
||||
- icon: searchBook
|
||||
title: "#搜书/#bookid"
|
||||
desc: 基于zli的搜书功能
|
||||
- icon: zhubai
|
||||
title: "#竹白"
|
||||
desc: 基于竹白百科的搜索
|
||||
- group: 工具类合集
|
||||
list:
|
||||
- icon: translate
|
||||
|
@ -2,9 +2,9 @@
|
||||
version: 1.1.0-rc1,
|
||||
data:
|
||||
[
|
||||
新增<span class="cmd">竹白百科</span>功能,
|
||||
新增<span class="cmd">Instagram解析</span>功能,
|
||||
重构<span class="cmd">翻译</span>功能,
|
||||
新增<span class="cmd">#波点音乐</span>MV点歌,
|
||||
适配<span class="cmd">锅巴</span>插件,方便查看和修改配置,
|
||||
添加<span class="cmd">#R帮助</span>获取插件帮助,
|
||||
添加<span class="cmd">#R版本</span>获取插件版本,
|
||||
|
BIN
resources/img/icon/zhubai.png
Normal file
BIN
resources/img/icon/zhubai.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
Loading…
x
Reference in New Issue
Block a user