koishi-plugin-node-async-bot-all 2.2.0 → 2.3.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.js +12 -5
- package/package.json +3 -3
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
|
|
|
@@ -179,13 +179,19 @@ 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;
|
|
182
183
|
let dataError;
|
|
183
184
|
let data;
|
|
184
185
|
let error;
|
|
185
186
|
const time = getHongKongTime();
|
|
186
|
-
if (session.event.guild.id == "757729218" || session.event.guild.id == "1047732162") {
|
|
187
|
+
if (session.event.guild.id == "757729218" || session.event.guild.id == "1047732162" || session.event.guild.id == "917260212") {
|
|
187
188
|
try {
|
|
188
|
-
|
|
189
|
+
if (session.event.guild.id == "917260212") {
|
|
190
|
+
api = ctx.config.cxAPI2;
|
|
191
|
+
} else {
|
|
192
|
+
api = ctx.config.cxAPI;
|
|
193
|
+
}
|
|
194
|
+
const response = await fetchWithTimeout(api, {}, ctx.config.timeout, log);
|
|
189
195
|
if (response.ok) {
|
|
190
196
|
data = await response.text();
|
|
191
197
|
log.info("Server data: " + data);
|
|
@@ -390,7 +396,7 @@ async function getRW(ctx, session) {
|
|
|
390
396
|
__name(getRW, "getRW");
|
|
391
397
|
|
|
392
398
|
// package.json
|
|
393
|
-
var version = "2.
|
|
399
|
+
var version = "2.3.0";
|
|
394
400
|
|
|
395
401
|
// src/index.ts
|
|
396
402
|
var inject = ["database"];
|
|
@@ -401,7 +407,8 @@ var Config = import_koishi2.Schema.intersect([
|
|
|
401
407
|
timeout: import_koishi2.Schema.number().default(8e3).description("超时时间(毫秒)")
|
|
402
408
|
}).description("基础"),
|
|
403
409
|
import_koishi2.Schema.object({
|
|
404
|
-
cxAPI: import_koishi2.Schema.string().default("https://api.tasaed.top/get/minecraftServer/").description("查询 API")
|
|
410
|
+
cxAPI: import_koishi2.Schema.string().default("https://api.tasaed.top/get/minecraftServer/").description("查询 API"),
|
|
411
|
+
cxAPI2: import_koishi2.Schema.string().default("https://api.tasaed.top/get/minecraftServer/bas.php").description("查询 API 2")
|
|
405
412
|
}).description("查询"),
|
|
406
413
|
import_koishi2.Schema.object({
|
|
407
414
|
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.3.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
|
}
|