我正在制造Dicord机器人,我需要一些能够在关闭计算机,在IntelliJ中关闭程序或在终端中关闭程序时发送一些消息的消息。
public class run {
public static JDABuilder builder = new JDABuilder(AccountType.BOT);
public static void main(String[] args) throws IOException {
System.out.println("\n\033[31mBooting Version:" + SECRETS.VERSION);
System.out.println("\033[31m[setup] setting token");
builder.setToken(SECRETS.TOKEN);
builder.setAutoReconnect(true);
builder.addEventListeners(new Listerner());
builder.setStatus(OnlineStatus.ONLINE);
builder.setActivity(Activity.playing("booting Version:"+SECRETS.VERSION));
try {
System.out.println("\033[31m[setup] connecting");
JDA jda = builder.build();
TimeUnit.SECONDS.sleep(3);
} catch (Exception e) {
e.printStackTrace();
}
}
}
如果您能给我发一些例子,我会很好。