koishi-plugin-minecraft-search 1.3.1 → 1.3.2
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 +18 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
8
|
var __export = (target, all) => {
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
@@ -26,7 +36,10 @@ __export(src_exports, {
|
|
|
26
36
|
});
|
|
27
37
|
module.exports = __toCommonJS(src_exports);
|
|
28
38
|
var import_koishi = require("koishi");
|
|
29
|
-
var
|
|
39
|
+
var getMinecraftServerStatus;
|
|
40
|
+
import("mc-server-util").then((m) => {
|
|
41
|
+
getMinecraftServerStatus = m.getMinecraftServerStatus;
|
|
42
|
+
});
|
|
30
43
|
var name = "minecraft-search";
|
|
31
44
|
var Config = import_koishi.Schema.intersect([
|
|
32
45
|
import_koishi.Schema.object({
|
|
@@ -93,6 +106,9 @@ function apply(ctx, config) {
|
|
|
93
106
|
__name(minekuaiApiRequest, "minekuaiApiRequest");
|
|
94
107
|
async function queryServerStatus(server) {
|
|
95
108
|
try {
|
|
109
|
+
if (!getMinecraftServerStatus) {
|
|
110
|
+
throw new Error("mc-server-util 模块未正确加载");
|
|
111
|
+
}
|
|
96
112
|
const defaultPort = server.serverType === "bedrock" ? 19132 : 25565;
|
|
97
113
|
const { host, port } = parseServerAddress(server.host, defaultPort);
|
|
98
114
|
const timeout = (server.timeout || 5) * 1e3;
|
|
@@ -100,7 +116,7 @@ function apply(ctx, config) {
|
|
|
100
116
|
if (server.serverType === "bedrock") {
|
|
101
117
|
throw new Error("Bedrock服务器暂不支持");
|
|
102
118
|
} else {
|
|
103
|
-
result = await
|
|
119
|
+
result = await getMinecraftServerStatus(host, port, {
|
|
104
120
|
timeout,
|
|
105
121
|
debug: false
|
|
106
122
|
});
|