koishi-plugin-node-async-bot-all 2.3.0 → 2.4.0
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 +2 -1
- package/lib/index.js +14 -9
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -12,7 +12,8 @@ interface botDataTables {
|
|
|
12
12
|
export declare const name = "node-async-bot-all";
|
|
13
13
|
export declare const usage = "\u8FD9\u662F\u4E00\u4E2A\u79C1\u6709\u63D2\u4EF6\u3002";
|
|
14
14
|
export interface Config {
|
|
15
|
-
|
|
15
|
+
cxV2Group: Array<string>;
|
|
16
|
+
cxV2API: Array<string>;
|
|
16
17
|
rwAPI: string;
|
|
17
18
|
timeout: number;
|
|
18
19
|
}
|
package/lib/index.js
CHANGED
|
@@ -179,17 +179,22 @@ async function getServer(ctx, session) {
|
|
|
179
179
|
const log = ctx.logger("cx");
|
|
180
180
|
log.info(`Got: {"form":"${session.event.guild.id}","user":"${session.event.user.id}","timestamp":${session.event.timestamp},"messageId":"${session.event.message.id}"}`);
|
|
181
181
|
let msg;
|
|
182
|
-
let api;
|
|
183
182
|
let dataError;
|
|
184
183
|
let data;
|
|
185
184
|
let error;
|
|
186
185
|
const time = getHongKongTime();
|
|
187
|
-
if (
|
|
186
|
+
if (ctx.config.cxV2Group.includes(session.event.guild.id)) {
|
|
188
187
|
try {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
188
|
+
const api = ctx.config.cxV2API[ctx.config.cxV2Group.indexOf(session.event.guild.id)];
|
|
189
|
+
if (api == void 0) {
|
|
190
|
+
msg = {
|
|
191
|
+
"time": time,
|
|
192
|
+
"data": "未指定查询 API",
|
|
193
|
+
"success": 1
|
|
194
|
+
};
|
|
195
|
+
log.info("Sent:");
|
|
196
|
+
log.info(msg);
|
|
197
|
+
return msg;
|
|
193
198
|
}
|
|
194
199
|
const response = await fetchWithTimeout(api, {}, ctx.config.timeout, log);
|
|
195
200
|
if (response.ok) {
|
|
@@ -396,7 +401,7 @@ async function getRW(ctx, session) {
|
|
|
396
401
|
__name(getRW, "getRW");
|
|
397
402
|
|
|
398
403
|
// package.json
|
|
399
|
-
var version = "2.
|
|
404
|
+
var version = "2.4.0";
|
|
400
405
|
|
|
401
406
|
// src/index.ts
|
|
402
407
|
var inject = ["database"];
|
|
@@ -407,8 +412,8 @@ var Config = import_koishi2.Schema.intersect([
|
|
|
407
412
|
timeout: import_koishi2.Schema.number().default(8e3).description("超时时间(毫秒)")
|
|
408
413
|
}).description("基础"),
|
|
409
414
|
import_koishi2.Schema.object({
|
|
410
|
-
|
|
411
|
-
|
|
415
|
+
cxV2Group: import_koishi2.Schema.array(String).description("查询 群,对应 API"),
|
|
416
|
+
cxV2API: import_koishi2.Schema.array(String).description("查询 API,对应 群")
|
|
412
417
|
}).description("查询"),
|
|
413
418
|
import_koishi2.Schema.object({
|
|
414
419
|
rwAPI: import_koishi2.Schema.string().default("https://api.tasaed.top/rw/").description("随机文本 API")
|