diff --git a/apps/query.js b/apps/query.js
index 9b34a59..8680839 100644
--- a/apps/query.js
+++ b/apps/query.js
@@ -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;
diff --git a/config/help.yaml b/config/help.yaml
index bac0c98..9be2df4 100644
--- a/config/help.yaml
+++ b/config/help.yaml
@@ -21,6 +21,9 @@
- icon: searchBook
title: "#搜书/#bookid"
desc: 基于zli的搜书功能
+ - icon: zhubai
+ title: "#竹白"
+ desc: 基于竹白百科的搜索
- group: 工具类合集
list:
- icon: translate
diff --git a/config/version.yaml b/config/version.yaml
index 17cb9ab..cdad36d 100644
--- a/config/version.yaml
+++ b/config/version.yaml
@@ -2,9 +2,9 @@
version: 1.1.0-rc1,
data:
[
+ 新增竹白百科功能,
新增Instagram解析功能,
重构翻译功能,
- 新增#波点音乐MV点歌,
适配锅巴插件,方便查看和修改配置,
添加#R帮助获取插件帮助,
添加#R版本获取插件版本,
diff --git a/resources/img/icon/zhubai.png b/resources/img/icon/zhubai.png
new file mode 100644
index 0000000..ebd3b14
Binary files /dev/null and b/resources/img/icon/zhubai.png differ