koishi-plugin-oni-wiki-qq 0.4.3 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -1
- package/lib/index.js +19 -9
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context, Schema } from "koishi";
|
|
2
2
|
export declare const name = "oni-wiki-qq";
|
|
3
|
-
export declare const usage = "\n - 0.4.3 \u6536\u96C6\u641C\u7D22\u7684\u8BCD\u6C47\u9891\u7387\n - 0.4.2 \u4FEE\u6539/ \u7684\u4F7F\u7528\u65B9\u5F0F,\u6539\u4E3A >\n - 0.4.1 \u589E\u52A0/\u7684\u5904\u7406\n - 0.4.0 \u79FB\u9664MWN.\u5C06\u67E5\u8BE2\u5904\u7406\u6539\u81F3\u67E5\u8BE2\u6570\u636E\u5E93\n - 0.3.0 \u79FB\u9664\u8017\u5185\u5B58\u7684\u622A\u56FE\u90E8\u5206,\u4F7F\u7528\u955C\u50CF\u7AD9\u70B9\u7F51\u9875\n - 0.2.0 \u5C1D\u8BD5\u6DFB\u52A0 MWN \u5E93\n";
|
|
3
|
+
export declare const usage = "\n - 0.4.5 \u68C0\u6D4B\u6559\u7A0B\u9875\u9762\n - 0.4.4 \u52A0\u5165\u7528\u6237\u9875\u9762\n - 0.4.3 \u6536\u96C6\u641C\u7D22\u7684\u8BCD\u6C47\u9891\u7387\n - 0.4.2 \u4FEE\u6539/ \u7684\u4F7F\u7528\u65B9\u5F0F,\u6539\u4E3A >\n - 0.4.1 \u589E\u52A0/\u7684\u5904\u7406\n - 0.4.0 \u79FB\u9664MWN.\u5C06\u67E5\u8BE2\u5904\u7406\u6539\u81F3\u67E5\u8BE2\u6570\u636E\u5E93\n - 0.3.0 \u79FB\u9664\u8017\u5185\u5B58\u7684\u622A\u56FE\u90E8\u5206,\u4F7F\u7528\u955C\u50CF\u7AD9\u70B9\u7F51\u9875\n - 0.2.0 \u5C1D\u8BD5\u6DFB\u52A0 MWN \u5E93\n";
|
|
4
4
|
export declare const inject: string[];
|
|
5
5
|
declare module "koishi" {
|
|
6
6
|
interface Tables {
|
package/lib/index.js
CHANGED
|
@@ -30,6 +30,8 @@ module.exports = __toCommonJS(src_exports);
|
|
|
30
30
|
var import_koishi = require("koishi");
|
|
31
31
|
var name = "oni-wiki-qq";
|
|
32
32
|
var usage = `
|
|
33
|
+
- 0.4.5 检测教程页面
|
|
34
|
+
- 0.4.4 加入用户页面
|
|
33
35
|
- 0.4.3 收集搜索的词汇频率
|
|
34
36
|
- 0.4.2 修改/ 的使用方式,改为 >
|
|
35
37
|
- 0.4.1 增加/的处理
|
|
@@ -60,16 +62,23 @@ function apply(ctx, config) {
|
|
|
60
62
|
}
|
|
61
63
|
);
|
|
62
64
|
ctx.command("x <itemName>", "查询缺氧中文wiki").alias("/查wiki").action(async ({ session }, itemName = "电解器") => {
|
|
65
|
+
if (/教程/.test(itemName)) {
|
|
66
|
+
return `请点击链接前往站点查看:
|
|
67
|
+
原站点: http://oni.wiki/${encodeURI(
|
|
68
|
+
`教程`
|
|
69
|
+
)}
|
|
70
|
+
镜像站: https://klei.vip/oni/usiz6d/${encodeURI(`教程`)}`;
|
|
71
|
+
}
|
|
63
72
|
await ctx.database.create("searchpages", {
|
|
64
73
|
title: itemName,
|
|
65
74
|
time: import_koishi.Time.template("yyyy-MM-dd hh:mm:ss", /* @__PURE__ */ new Date())
|
|
66
75
|
});
|
|
67
76
|
const res = await ctx.database.get("wikipages", {
|
|
68
|
-
title: [`${itemName
|
|
77
|
+
title: [`${itemName}`]
|
|
69
78
|
});
|
|
70
79
|
logger.info(res);
|
|
71
80
|
if (res.length == 0) {
|
|
72
|
-
return `在Wiki
|
|
81
|
+
return `在Wiki里没找到,如有需要,请按照游戏内名称重新发起查询....`;
|
|
73
82
|
}
|
|
74
83
|
return `请点击链接前往站点查看:
|
|
75
84
|
原站点: http://oni.wiki/${encodeURI(
|
|
@@ -78,19 +87,20 @@ function apply(ctx, config) {
|
|
|
78
87
|
镜像站: https://klei.vip/oni/usiz6d/${encodeURI(itemName)}`;
|
|
79
88
|
});
|
|
80
89
|
ctx.command("update", "更新本地页面缓存", { authority: 2 }).action(async () => {
|
|
81
|
-
const
|
|
90
|
+
const headers = {
|
|
91
|
+
"Content-Type": "application/json",
|
|
92
|
+
"user-agent": "Charles'queryBot",
|
|
93
|
+
Cookie: `SESSDATA=${config.SESSDATA}`
|
|
94
|
+
};
|
|
95
|
+
const url = `https://wiki.biligame.com/oni/api.php?action=query&list=allpages&apnamespace=0&aplimit=5000&format=json`;
|
|
82
96
|
return await ctx.http.get(url, {
|
|
83
|
-
headers
|
|
84
|
-
"Content-Type": "application/json",
|
|
85
|
-
"user-agent": "Charles'queryBot",
|
|
86
|
-
Cookie: `SESSDATA=${config.SESSDATA}`
|
|
87
|
-
}
|
|
97
|
+
headers
|
|
88
98
|
}).then((res) => {
|
|
89
99
|
console.log(res["query"]["allpages"]);
|
|
90
100
|
res["query"]["allpages"].forEach(async (element) => {
|
|
91
101
|
console.log(element.title);
|
|
92
102
|
await ctx.database.upsert("wikipages", () => [
|
|
93
|
-
{ id: element.pageid, title: element.title
|
|
103
|
+
{ id: element.pageid, title: element.title }
|
|
94
104
|
]);
|
|
95
105
|
});
|
|
96
106
|
return `更新已完成,已尝试写入数据库}`;
|