koishi-plugin-oni-wiki-qq 0.0.5 → 0.0.7
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 +7 -4
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context, Schema } from "koishi";
|
|
2
2
|
export declare const name = "oni-wiki-qq";
|
|
3
3
|
export declare const inject: string[];
|
|
4
|
-
export declare const usage = "\n - 0.0.5 \u592A\u4E45\u6CA1\u5199\u5FD8\u8BB0build\u4E86...\n - 0.0.4 \u715E\u7B14\u817E\u8BAF\u4E0D\u7ED9\u53D1md\u4E86\u8279\n - 0.0.3 \u5C06\u94FE\u63A5\u6539\u4E3Amd\u53D1\u9001\u4EE5\u7ED5\u8FC7\u6C9F\u817E\u8BAF\u7684\u94FE\u63A5\u62E6\u622A\n - 0.0.2 \u57FA\u672C\u529F\u80FD\u5B8C\u6210\n - 0.0.1 \u521D\u59CB\u5316\uFF0C\u660E\u5929\u518D\u6162\u6162\u5199\u4E86\uFF08\n";
|
|
4
|
+
export declare const usage = "\n - 0.0.7 \u5BF9\u7F51\u5740\u8FDB\u884C\u7F16\u7801\u4EE5\u786E\u4FDD\u4E0D\u4F1A\u51FA\u73B0\u5947\u5947\u602A\u602A\u7684\u95EE\u9898\n - 0.0.6 \u7A7A\u7F51\u5740\u9519\u8BEF\u5904\u7406\n - 0.0.5 \u592A\u4E45\u6CA1\u5199\u5FD8\u8BB0build\u4E86...\n - 0.0.4 \u715E\u7B14\u817E\u8BAF\u4E0D\u7ED9\u53D1md\u4E86\u8279\n - 0.0.3 \u5C06\u94FE\u63A5\u6539\u4E3Amd\u53D1\u9001\u4EE5\u7ED5\u8FC7\u6C9F\u817E\u8BAF\u7684\u94FE\u63A5\u62E6\u622A\n - 0.0.2 \u57FA\u672C\u529F\u80FD\u5B8C\u6210\n - 0.0.1 \u521D\u59CB\u5316\uFF0C\u660E\u5929\u518D\u6162\u6162\u5199\u4E86\uFF08\n";
|
|
5
5
|
export interface Config {
|
|
6
6
|
api: string;
|
|
7
7
|
imgPath: string;
|
package/lib/index.js
CHANGED
|
@@ -43,6 +43,8 @@ var import_node_os = __toESM(require("node:os"));
|
|
|
43
43
|
var name = "oni-wiki-qq";
|
|
44
44
|
var inject = ["puppeteer"];
|
|
45
45
|
var usage = `
|
|
46
|
+
- 0.0.7 对网址进行编码以确保不会出现奇奇怪怪的问题
|
|
47
|
+
- 0.0.6 空网址错误处理
|
|
46
48
|
- 0.0.5 太久没写忘记build了...
|
|
47
49
|
- 0.0.4 煞笔腾讯不给发md了艹
|
|
48
50
|
- 0.0.3 将链接改为md发送以绕过沟腾讯的链接拦截
|
|
@@ -56,7 +58,7 @@ var Config = import_koishi.Schema.object({
|
|
|
56
58
|
});
|
|
57
59
|
function apply(ctx, config) {
|
|
58
60
|
const logger = ctx.logger;
|
|
59
|
-
ctx.command("
|
|
61
|
+
ctx.command("x <itemName>", "查询缺氧中文wiki").alias("/查wiki").option("delete", "-d 删除本地缓存", { authority: 2 }).action(async ({ session, options }, itemName = "电解器") => {
|
|
60
62
|
logger.info(session.guildId);
|
|
61
63
|
const filePath = config.imgPath + itemName.replace(/\//g, "-").replace(/:/g, "-").replace(/'/g, "-") + ".jpeg";
|
|
62
64
|
const urlPath = config.urlPath + itemName.replace(/\//g, "-").replace(/:/g, "-").replace(/'/g, "-") + ".jpeg";
|
|
@@ -69,7 +71,8 @@ function apply(ctx, config) {
|
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
if (checkFileExists(filePath)) {
|
|
72
|
-
|
|
74
|
+
console.log(urlPath);
|
|
75
|
+
return (0, import_koishi.h)("img", { src: `${encodeURI(urlPath)}` });
|
|
73
76
|
}
|
|
74
77
|
session.send(`您查询的「${itemName}」进行中,请稍等...`);
|
|
75
78
|
await (0, import_koishi.sleep)(2e3);
|
|
@@ -83,7 +86,7 @@ function apply(ctx, config) {
|
|
|
83
86
|
if (title[0] === itemName) {
|
|
84
87
|
let res2 = await screenShot(itemUrl[0]);
|
|
85
88
|
if (res2) {
|
|
86
|
-
return (0, import_koishi.h)("img", { src: `${urlPath}` });
|
|
89
|
+
return (0, import_koishi.h)("img", { src: `${encodeURI(urlPath)}` });
|
|
87
90
|
} else {
|
|
88
91
|
return `截图发生错误.请稍后重试..`;
|
|
89
92
|
}
|
|
@@ -100,7 +103,7 @@ function apply(ctx, config) {
|
|
|
100
103
|
if (awlist.includes(awser)) {
|
|
101
104
|
let res2 = await screenShot(itemUrl[awser - 1]);
|
|
102
105
|
if (res2) {
|
|
103
|
-
return (0, import_koishi.h)("img", { src: `${urlPath}` });
|
|
106
|
+
return (0, import_koishi.h)("img", { src: `${encodeURI(urlPath)}` });
|
|
104
107
|
} else {
|
|
105
108
|
return `截图发生错误.请稍后重试..`;
|
|
106
109
|
}
|