1
0
Fork 0
forked from mc/VTools

关机时发tg消息

This commit is contained in:
Sodium-Aluminate 2023-12-08 01:21:23 +08:00
parent 0c17f2cd80
commit 564e1eb5fa
2 changed files with 8 additions and 2 deletions

View file

@ -66,7 +66,10 @@ public class ServerCloser {
boolean httpSuccess = false; boolean httpSuccess = false;
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
httpSuccess = executeAzure(); httpSuccess = executeAzure();
if (httpSuccess) break; if (httpSuccess) {
TGBridge.log("关机命令发送成功,正在关闭 pymcd。");
break;
}
} }
if (!httpSuccess) { if (!httpSuccess) {
TGBridge.error("服务器关机 http 请求失效,服务器可能没有正常关闭。"); TGBridge.error("服务器关机 http 请求失效,服务器可能没有正常关闭。");

View file

@ -310,6 +310,9 @@ public class TGBridge {
public static void error(String context) { public static void error(String context) {
INSTANCE.outbound("*" + MarkdownString.escapeStr(context) + "*", ParseMode.MarkdownV2); INSTANCE.outbound("*" + MarkdownString.escapeStr(context) + "*", ParseMode.MarkdownV2);
} }
public static void log(String context) {
INSTANCE.outbound("_" + MarkdownString.escapeStr(context) + "_", ParseMode.MarkdownV2);
}
protected void outbound(String content) {outbound(content, (ParseMode) null);} protected void outbound(String content) {outbound(content, (ParseMode) null);}