koishi-plugin-node-async-bot-all 2.26.3 → 2.26.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 +4 -0
- package/lib/index.js +7 -6
- package/package.json +1 -2
package/lib/index.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ declare module 'koishi' {
|
|
|
7
7
|
interface Events {
|
|
8
8
|
"node-async/news"(): void;
|
|
9
9
|
}
|
|
10
|
+
interface Context {
|
|
11
|
+
cron: (expression: string, callback: () => void) => void;
|
|
12
|
+
}
|
|
10
13
|
}
|
|
11
14
|
interface botDataTables {
|
|
12
15
|
id: string;
|
|
@@ -30,6 +33,7 @@ interface CenterServerConfig {
|
|
|
30
33
|
export interface Config {
|
|
31
34
|
cxV3: Array<ConfigCxV3>;
|
|
32
35
|
rwAPI: string;
|
|
36
|
+
htmlTimeout: number;
|
|
33
37
|
timeout: number;
|
|
34
38
|
baAPI: string[];
|
|
35
39
|
slTest: CenterServerConfig[];
|
package/lib/index.js
CHANGED
|
@@ -783,7 +783,7 @@ async function getQQInfo(ctx, session, qq) {
|
|
|
783
783
|
height: 650,
|
|
784
784
|
deviceScaleFactor: 2
|
|
785
785
|
});
|
|
786
|
-
await page.setContent(fullHtml, { waitUntil: "networkidle0" });
|
|
786
|
+
await page.setContent(fullHtml, { timeout: ctx.config.htmlTimeout, waitUntil: "networkidle0" });
|
|
787
787
|
const { width, height } = await page.evaluate(() => ({
|
|
788
788
|
width: document.body.scrollWidth,
|
|
789
789
|
height: document.body.scrollHeight
|
|
@@ -847,7 +847,7 @@ async function getMsg(ctx, session, inversion) {
|
|
|
847
847
|
height: 1,
|
|
848
848
|
deviceScaleFactor: 2
|
|
849
849
|
});
|
|
850
|
-
await page.setContent(html, { waitUntil: "networkidle0" });
|
|
850
|
+
await page.setContent(html, { timeout: ctx.config.htmlTimeout, waitUntil: "networkidle0" });
|
|
851
851
|
const { width, height } = await page.evaluate(() => ({
|
|
852
852
|
width: document.body.scrollWidth + 50,
|
|
853
853
|
height: document.body.scrollHeight
|
|
@@ -904,7 +904,7 @@ async function getNewsMsg(ctx, type) {
|
|
|
904
904
|
height: 800,
|
|
905
905
|
deviceScaleFactor: 2
|
|
906
906
|
});
|
|
907
|
-
await page.setContent(html[0], { waitUntil: "networkidle0" });
|
|
907
|
+
await page.setContent(html[0], { timeout: ctx.config.htmlTimeout, waitUntil: "networkidle0" });
|
|
908
908
|
const { width, height } = await page.evaluate(() => ({
|
|
909
909
|
width: document.body.scrollWidth,
|
|
910
910
|
height: document.body.scrollHeight
|
|
@@ -934,13 +934,13 @@ __name(getNewsMsg, "getNewsMsg");
|
|
|
934
934
|
async function getUse(ctx, session, qq, desc) {
|
|
935
935
|
const log = ctx.logger("getUse");
|
|
936
936
|
log.debug(`Got: {"form":"${session.platform}:${session.event.guild?.id}","user":"${session.event.user?.id}","timestamp":${session.event.timestamp},"messageId":"${session.event.message?.id}"}`);
|
|
937
|
-
await session.send(session.text(".msg", { "at": import_koishi2.h.at(session.event.user?.id), "at2": import_koishi2.h.at(qq), "desc":
|
|
937
|
+
await session.send(session.text(".msg", { "at": import_koishi2.h.at(session.event.user?.id), "at2": import_koishi2.h.at(qq), "desc": desc ?? "使用" }));
|
|
938
938
|
return 0;
|
|
939
939
|
}
|
|
940
940
|
__name(getUse, "getUse");
|
|
941
941
|
|
|
942
942
|
// package.json
|
|
943
|
-
var version = "2.26.
|
|
943
|
+
var version = "2.26.5";
|
|
944
944
|
|
|
945
945
|
// src/index.ts
|
|
946
946
|
var inject = ["database", "installer", "puppeteer", "cron"];
|
|
@@ -948,7 +948,8 @@ var name = "node-async-bot-all";
|
|
|
948
948
|
var usage = "这是一个私有插件。";
|
|
949
949
|
var Config = import_koishi3.Schema.intersect([
|
|
950
950
|
import_koishi3.Schema.object({
|
|
951
|
-
timeout: import_koishi3.Schema.number().default(8e3).description("超时时间(毫秒)")
|
|
951
|
+
timeout: import_koishi3.Schema.number().default(8e3).description("超时时间(毫秒)"),
|
|
952
|
+
htmlTimeout: import_koishi3.Schema.number().default(3e4).description("HTML 超时时间(毫秒)")
|
|
952
953
|
}).description("基础"),
|
|
953
954
|
import_koishi3.Schema.object({
|
|
954
955
|
cxV3: import_koishi3.Schema.array(
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-node-async-bot-all",
|
|
3
3
|
"description": "NodeAsync Bot插件(自用)",
|
|
4
|
-
"version": "2.26.
|
|
4
|
+
"version": "2.26.5",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"contributors": [
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
"@koishijs/plugin-help": "^2.4.5",
|
|
35
35
|
"@koishijs/plugin-market": "^2.11.8",
|
|
36
36
|
"koishi": "^4.18.7",
|
|
37
|
-
"koishi-plugin-cron": "^3.1.0",
|
|
38
37
|
"koishi-plugin-puppeteer": "^3.9.0"
|
|
39
38
|
},
|
|
40
39
|
"dependencies": {
|