koishi-plugin-minecraft-search 0.1.1 → 0.1.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 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -212,8 +212,25 @@ function apply(ctx, config) {
|
|
|
212
212
|
]);
|
|
213
213
|
}
|
|
214
214
|
const message = (0, import_koishi.h)("message");
|
|
215
|
+
let iconElement = null;
|
|
216
|
+
if (config2.querySettings.showIcon && status.icon) {
|
|
217
|
+
try {
|
|
218
|
+
if (status.icon.startsWith("data:image/")) {
|
|
219
|
+
iconElement = import_koishi.h.image(status.icon);
|
|
220
|
+
} else if (status.icon.startsWith("http")) {
|
|
221
|
+
iconElement = import_koishi.h.image(status.icon);
|
|
222
|
+
} else {
|
|
223
|
+
iconElement = import_koishi.h.image(`base64://${status.icon}`);
|
|
224
|
+
}
|
|
225
|
+
} catch (error) {
|
|
226
|
+
ctx.logger.warn("处理服务器图标失败:", error);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
215
229
|
message.children.push(
|
|
216
|
-
(0, import_koishi.h)("p",
|
|
230
|
+
(0, import_koishi.h)("p", [
|
|
231
|
+
iconElement ? (0, import_koishi.h)("span", [iconElement, " "]) : "",
|
|
232
|
+
`🟢 ${server.name}`
|
|
233
|
+
]),
|
|
217
234
|
(0, import_koishi.h)("p", `📍 地址: ${server.host}`),
|
|
218
235
|
(0, import_koishi.h)("p", `🎮 版本: ${status.version.name_clean} (协议: ${status.version.protocol})`),
|
|
219
236
|
(0, import_koishi.h)("p", `📅 状态获取时间: ${new Date(status.retrieved_at).toLocaleString("zh-CN")}`)
|