mirror of
https://github.com/LamGC/ContentGrabbingJi.git
synced 2025-04-30 06:37:36 +00:00
[Add] MiraiMain 增加正常关闭过程;
This commit is contained in:
parent
084be3970a
commit
36460e4c34
@ -24,6 +24,7 @@ public class MiraiMain implements Closeable {
|
|||||||
private final static Properties botProperties = new Properties();
|
private final static Properties botProperties = new Properties();
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
|
Runtime.getRuntime().addShutdownHook(new Thread(this::close));
|
||||||
try {
|
try {
|
||||||
Class.forName(BotEventHandler.class.getName());
|
Class.forName(BotEventHandler.class.getName());
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
@ -47,7 +48,9 @@ public class MiraiMain implements Closeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
|
log.warn("正在关闭机器人...");
|
||||||
bot.close(null);
|
bot.close(null);
|
||||||
|
log.warn("机器人已关闭.");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user