koishi-plugin-oni-wiki-qq 0.4.3 → 0.4.4

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 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.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,7 @@ 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.4 加入用户页面
33
34
  - 0.4.3 收集搜索的词汇频率
34
35
  - 0.4.2 修改/ 的使用方式,改为 >
35
36
  - 0.4.1 增加/的处理
@@ -65,11 +66,11 @@ function apply(ctx, config) {
65
66
  time: import_koishi.Time.template("yyyy-MM-dd hh:mm:ss", /* @__PURE__ */ new Date())
66
67
  });
67
68
  const res = await ctx.database.get("wikipages", {
68
- title: [`${itemName.replace("/", ">")}`]
69
+ title: [`${itemName}`]
69
70
  });
70
71
  logger.info(res);
71
72
  if (res.length == 0) {
72
- return `在Wiki里没找到或API查询超时,如有需要,请按照游戏内名称重新发起查询....`;
73
+ return `在Wiki里没找到,如有需要,请按照游戏内名称重新发起查询....`;
73
74
  }
74
75
  return `请点击链接前往站点查看:
75
76
  原站点: http://oni.wiki/${encodeURI(
@@ -78,19 +79,29 @@ function apply(ctx, config) {
78
79
  镜像站: https://klei.vip/oni/usiz6d/${encodeURI(itemName)}`;
79
80
  });
80
81
  ctx.command("update", "更新本地页面缓存", { authority: 2 }).action(async () => {
81
- const url = `https://wiki.biligame.com/oni/api.php?action=query&list=allpages&aplimit=5000&format=json`;
82
+ const headers = {
83
+ "Content-Type": "application/json",
84
+ "user-agent": "Charles'queryBot",
85
+ Cookie: `SESSDATA=${config.SESSDATA}`
86
+ };
87
+ const url = `https://wiki.biligame.com/oni/api.php?action=query&list=allpages&apnamespace=0&aplimit=5000&format=json`;
88
+ const user = `https://wiki.biligame.com/oni/api.php?action=query&list=allpages&apnamespace=2&aplimit=5000&format=json`;
89
+ await ctx.http.get(user, { headers }).then((res) => {
90
+ res["query"]["allpages"].forEach(async (element) => {
91
+ console.log(element.title);
92
+ await ctx.database.upsert("wikipages", () => [
93
+ { id: element.pageid, title: element.title }
94
+ ]);
95
+ });
96
+ });
82
97
  return await ctx.http.get(url, {
83
- headers: {
84
- "Content-Type": "application/json",
85
- "user-agent": "Charles'queryBot",
86
- Cookie: `SESSDATA=${config.SESSDATA}`
87
- }
98
+ headers
88
99
  }).then((res) => {
89
100
  console.log(res["query"]["allpages"]);
90
101
  res["query"]["allpages"].forEach(async (element) => {
91
102
  console.log(element.title);
92
103
  await ctx.database.upsert("wikipages", () => [
93
- { id: element.pageid, title: element.title.replace("/", ">") }
104
+ { id: element.pageid, title: element.title }
94
105
  ]);
95
106
  });
96
107
  return `更新已完成,已尝试写入数据库}`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-oni-wiki-qq",
3
3
  "description": "缺氧wiki查询,自用",
4
- "version": "0.4.3",
4
+ "version": "0.4.4",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [