koishi-plugin-node-async-bot-all 2.2.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 +17 -5
- package/package.json +3 -3
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
|
@@ -33,7 +33,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
33
33
|
// src/locales/zh-CN.yml
|
|
34
34
|
var require_zh_CN = __commonJS({
|
|
35
35
|
"src/locales/zh-CN.yml"(exports2, module2) {
|
|
36
|
-
module2.exports = { commands: { cx: { description: "查询服务器当前人数。", messages: { msg: "{time}\n
|
|
36
|
+
module2.exports = { commands: { cx: { description: "查询服务器当前人数。", messages: { msg: "{time}\n【MC服务器当前人数】\n➣ {version}:{players}\n➣ 玩家列表:{list}\n➣ 协议版本:{protocol}\n进服指南请在群公告中查看。", msgNoPlayer: "{time}\n【MC服务器当前人数】\n➣ {version}:{players}\n➣ 协议版本:{protocol}\n进服指南请在群公告中查看。", forbidden: "{time}\n此指令不允许在本群使用。", failed: "{time}\n查询失败:{data}\n请稍后重试。", timeout: "请求超时。", timeout2: "响应超时。", fewData: "服务端返回的数据过少。", close: "服务器已关闭。", error: "执行错误。", unknown: "未知错误。", host: "没有到主机的路由。" } }, status: { description: "查询机器人状态。", messages: { msg: "{time}\n--- 系统状态 ---\n系统名称:{name}\nCPU使用率:{cpu}\n内存使用率:{memory}\n--- 机器人状态 ---\n昨日收/发消息数量:{msgCount}\n机器人版本:{version}\n运行时间:{online}", failed: "{time}\n状态获取失败。" } }, random: { description: "随机数生成器。", usage: "缺少参数时默认生成 0-10000 的随机数。\n使用示例:", examples: "random 1 128 生成1到128范围的随机数", messages: { msg: "{time}\n生成的随机数:{data}" } }, info: { description: "查询机器人信息。", messages: { msg: "{data}", failed: "{time}\n读取信息失败。" } }, rw: { description: "随机名言名句。", messages: { msg: "{time}\n{data}", failed1: "{time}\n获取失败(1)。", failed2: "{time}\n获取失败(2)。" } } } };
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
|
|
@@ -183,9 +183,20 @@ async function getServer(ctx, session) {
|
|
|
183
183
|
let data;
|
|
184
184
|
let error;
|
|
185
185
|
const time = getHongKongTime();
|
|
186
|
-
if (
|
|
186
|
+
if (ctx.config.cxV2Group.includes(session.event.guild.id)) {
|
|
187
187
|
try {
|
|
188
|
-
const
|
|
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;
|
|
198
|
+
}
|
|
199
|
+
const response = await fetchWithTimeout(api, {}, ctx.config.timeout, log);
|
|
189
200
|
if (response.ok) {
|
|
190
201
|
data = await response.text();
|
|
191
202
|
log.info("Server data: " + data);
|
|
@@ -390,7 +401,7 @@ async function getRW(ctx, session) {
|
|
|
390
401
|
__name(getRW, "getRW");
|
|
391
402
|
|
|
392
403
|
// package.json
|
|
393
|
-
var version = "2.
|
|
404
|
+
var version = "2.4.0";
|
|
394
405
|
|
|
395
406
|
// src/index.ts
|
|
396
407
|
var inject = ["database"];
|
|
@@ -401,7 +412,8 @@ var Config = import_koishi2.Schema.intersect([
|
|
|
401
412
|
timeout: import_koishi2.Schema.number().default(8e3).description("超时时间(毫秒)")
|
|
402
413
|
}).description("基础"),
|
|
403
414
|
import_koishi2.Schema.object({
|
|
404
|
-
|
|
415
|
+
cxV2Group: import_koishi2.Schema.array(String).description("查询 群,对应 API"),
|
|
416
|
+
cxV2API: import_koishi2.Schema.array(String).description("查询 API,对应 群")
|
|
405
417
|
}).description("查询"),
|
|
406
418
|
import_koishi2.Schema.object({
|
|
407
419
|
rwAPI: import_koishi2.Schema.string().default("https://api.tasaed.top/rw/").description("随机文本 API")
|
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.
|
|
4
|
+
"version": "2.4.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"contributors": [
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@koishijs/client": "^5.30.4"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
+
"@koishijs/plugin-database-sqlite": "^4.6.0",
|
|
34
35
|
"@koishijs/plugin-help": "^2.4.5",
|
|
35
|
-
"koishi": "^4.18.7"
|
|
36
|
-
"@koishijs/plugin-database-sqlite": "^4.6.0"
|
|
36
|
+
"koishi": "^4.18.7"
|
|
37
37
|
}
|
|
38
38
|
}
|