关机时发tg消息
This commit is contained in:
parent
0c17f2cd80
commit
564e1eb5fa
2 changed files with 8 additions and 2 deletions
|
@ -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 请求失效,服务器可能没有正常关闭。");
|
||||||
|
@ -134,7 +137,7 @@ public class ServerCloser {
|
||||||
plugin.logger.info("ServerCloser: 即将关机。");
|
plugin.logger.info("ServerCloser: 即将关机。");
|
||||||
close();
|
close();
|
||||||
} else {
|
} else {
|
||||||
plugin.logger.error("ServerCloser: 定时器到点时发现服务器有人。这不应发生,因为定时器本应该被打断。");
|
plugin.logger.error("ServerCloser: 定时器到点时发现服务器有人。这不应发生,因为定时器本应该被打断。");
|
||||||
TGBridge.error("ServerCloser: #bug @NaAlOH4 定时器到点时发现服务器有人。这不应发生,因为定时器本应该被打断。");
|
TGBridge.error("ServerCloser: #bug @NaAlOH4 定时器到点时发现服务器有人。这不应发生,因为定时器本应该被打断。");
|
||||||
}
|
}
|
||||||
closeServerTimer.cancel();
|
closeServerTimer.cancel();
|
||||||
|
|
|
@ -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);}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue