koishi-plugin-minecraft-search 2.0.11 → 2.0.13
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 +8 -2
- package/package.json +3 -3
- package/readme.md +26 -5
package/lib/index.js
CHANGED
|
@@ -387,7 +387,7 @@ function apply(ctx, config) {
|
|
|
387
387
|
await ctx.database.remove("minecraft_server", { id });
|
|
388
388
|
return `✅ 服务器已解绑`;
|
|
389
389
|
});
|
|
390
|
-
ctx.guild().command("mc/修改服务器 <id:number>", "修改Minecraft服务器信息").option("name", "-n <name:string>", { fallback: "" }).option("timeout", "-t <timeout:number>", { fallback: 0 }).option("instance", "-i <instance:string>", { fallback: "" }).action(async ({ session, options }, id) => {
|
|
390
|
+
ctx.guild().command("mc/修改服务器 <id:number>", "修改Minecraft服务器信息").option("name", "-n <name:string>", { fallback: "" }).option("address", "-a <address:string>", { fallback: "" }).option("timeout", "-t <timeout:number>", { fallback: 0 }).option("instance", "-i <instance:string>", { fallback: "" }).action(async ({ session, options }, id) => {
|
|
391
391
|
const permissionError = await checkPermission(session, config);
|
|
392
392
|
if (permissionError) {
|
|
393
393
|
return permissionError;
|
|
@@ -405,6 +405,11 @@ function apply(ctx, config) {
|
|
|
405
405
|
if (options.name) {
|
|
406
406
|
updates.name = options.name;
|
|
407
407
|
}
|
|
408
|
+
if (options.address) {
|
|
409
|
+
const { host, port } = parseServerAddress(options.address, 25565);
|
|
410
|
+
updates.host = host;
|
|
411
|
+
updates.port = port;
|
|
412
|
+
}
|
|
408
413
|
if (options.timeout > 0) {
|
|
409
414
|
updates.timeout = options.timeout;
|
|
410
415
|
}
|
|
@@ -412,11 +417,12 @@ function apply(ctx, config) {
|
|
|
412
417
|
updates.minekuaiInstanceId = options.instance;
|
|
413
418
|
}
|
|
414
419
|
if (Object.keys(updates).length === 0) {
|
|
415
|
-
return "请提供要修改的参数,使用 -n 指定新名称,-t 指定新超时时间,-i 指定新麦块实例ID";
|
|
420
|
+
return "请提供要修改的参数,使用 -n 指定新名称,-a 指定新地址(格式: IP:端口,不带端口时默认为25565),-t 指定新超时时间,-i 指定新麦块实例ID";
|
|
416
421
|
}
|
|
417
422
|
await ctx.database.set("minecraft_server", { id }, updates);
|
|
418
423
|
const parts = [];
|
|
419
424
|
if (updates.name) parts.push(`名称: ${updates.name}`);
|
|
425
|
+
if (updates.host) parts.push(`地址: ${updates.host}:${updates.port}`);
|
|
420
426
|
if (updates.timeout) parts.push(`超时: ${updates.timeout}秒`);
|
|
421
427
|
if (updates.minekuaiInstanceId) parts.push(`麦块实例ID: ${updates.minekuaiInstanceId}`);
|
|
422
428
|
return `✅ 服务器信息已更新!
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-minecraft-search",
|
|
3
3
|
"description": "用于查询Minecraft服务器状态。如果服务器来自于麦块联机,那么可以查询指定服务器的详细资源使用情况,甚至还能对指定服务器进行电源开启或重启操作",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.13",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
],
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
22
|
-
"url": "https://github.com/
|
|
22
|
+
"url": "git+https://github.com/forgetmelodyXL/minecraft-search.git"
|
|
23
23
|
},
|
|
24
|
-
"homepage": "https://github.com/
|
|
24
|
+
"homepage": "https://github.com/forgetmelodyXL/minecraft-search",
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"koishi": "^4.18.7"
|
|
27
27
|
},
|
package/readme.md
CHANGED
|
@@ -65,7 +65,7 @@ npm install koishi-plugin-minecraft-search
|
|
|
65
65
|
```
|
|
66
66
|
mc/绑定服务器 <host> [-n <name>] [-t <timeout>] [-i <instance>] # 绑定服务器,支持指定名称、超时时间和麦块实例ID
|
|
67
67
|
mc/解绑服务器 <id> # 解绑服务器
|
|
68
|
-
mc/修改服务器 <id> [-n <name>] [-t <timeout>] [-i <instance>] #
|
|
68
|
+
mc/修改服务器 <id> [-n <name>] [-a <address>] [-t <timeout>] [-i <instance>] # 修改服务器信息,支持修改名称、地址、超时时间和麦块实例ID
|
|
69
69
|
mc/服务器列表 # 查看已绑定的服务器列表
|
|
70
70
|
mc/设置实例 <id> <instanceId> # 设置服务器的麦块实例ID
|
|
71
71
|
mc/绑定API密钥 <apiKey> # 绑定麦块API密钥
|
|
@@ -126,9 +126,9 @@ mc/资源 1 # 查看ID为1的麦块服务器资源使用情况
|
|
|
126
126
|
- `-t <timeout>`:查询超时时间(可选,默认5秒)
|
|
127
127
|
- `-i <instance>`:麦块实例ID(可选,用于电源控制)
|
|
128
128
|
- **示例**:
|
|
129
|
-
- `mc/绑定服务器
|
|
130
|
-
- `mc/绑定服务器
|
|
131
|
-
- `mc/绑定服务器
|
|
129
|
+
- `mc/绑定服务器 127.0.0.1` - 绑定默认端口的服务器
|
|
130
|
+
- `mc/绑定服务器 127.0.0.1:25565 -n 测试服 -t 10` - 绑定指定端口、名称和超时的服务器
|
|
131
|
+
- `mc/绑定服务器 127.0.0.1 -i abc123` - 绑定服务器并设置麦块实例ID
|
|
132
132
|
|
|
133
133
|
### 绑定API密钥
|
|
134
134
|
- **命令**:`mc/绑定API密钥 <apiKey>`
|
|
@@ -138,7 +138,7 @@ mc/资源 1 # 查看ID为1的麦块服务器资源使用情况
|
|
|
138
138
|
|
|
139
139
|
### 服务器管理指令
|
|
140
140
|
- **`mc/解绑服务器 <id>`**:解绑指定ID的服务器
|
|
141
|
-
- **`mc/修改服务器 <id> [-n <name>] [-t <timeout>] [-i <instance>]
|
|
141
|
+
- **`mc/修改服务器 <id> [-n <name>] [-a <address>] [-t <timeout>] [-i <instance>]`**:修改服务器名称、地址、超时时间或麦块实例ID,其中 `-a` 选项支持合并输入IP和端口(如 `127.0.0.1:25565`),不带端口时默认使用25565端口
|
|
142
142
|
- **`mc/设置实例 <id> <instanceId>`**:为服务器设置麦块实例ID,用于电源控制
|
|
143
143
|
- **`mc/服务器列表`**:查看当前群组已绑定的所有服务器
|
|
144
144
|
- **`mc/服务器状态 <id> [状态]`**:查询或设置服务器活跃状态(状态:启用/停用)
|
|
@@ -188,6 +188,27 @@ mc/资源 1 # 查看ID为1的麦块服务器资源使用情况
|
|
|
188
188
|
<details>
|
|
189
189
|
<summary>点我查看更新日志详情</summary>
|
|
190
190
|
|
|
191
|
+
### v2.0.13
|
|
192
|
+
- 优化 `mc/修改服务器` 指令,新增 `-a` 选项支持合并输入服务器地址和端口
|
|
193
|
+
- 支持类似 `127.0.0.1:25565` 的格式,代码自动分离IP和端口
|
|
194
|
+
- 不带端口时默认使用25565端口
|
|
195
|
+
|
|
196
|
+
### v2.0.12
|
|
197
|
+
- 修复指令名称不一致问题,统一使用"绑定API密钥"指令名称
|
|
198
|
+
|
|
199
|
+
### v2.0.11
|
|
200
|
+
- 新增服务器活跃状态管理功能
|
|
201
|
+
- 在 minecraft_server 数据库中添加 active 字段(boolean 类型)
|
|
202
|
+
- 绑定服务器后默认设置为活跃状态
|
|
203
|
+
- 新增 `mc/服务器状态` 指令,支持查询和设置服务器活跃状态
|
|
204
|
+
- 修改 `mc/查服` 指令,过滤掉不活跃的服务器
|
|
205
|
+
- 修改 `mc/服务器列表` 指令,显示服务器活跃状态
|
|
206
|
+
- 当查询不活跃的服务器时,显示提示信息
|
|
207
|
+
- 兼容旧数据:已存在的服务器 active 字段为 null 时,视为活跃状态
|
|
208
|
+
|
|
209
|
+
### v2.0.10
|
|
210
|
+
- 优化指令命名,将"绑定"改为"绑定服务器","解绑"改为"解绑服务器","修改"改为"修改服务器"
|
|
211
|
+
|
|
191
212
|
### v2.0.9
|
|
192
213
|
- 修复指令名称不一致问题,统一使用"绑定API密钥"指令名称
|
|
193
214
|
|