Update startup method
All checks were successful
continuous-integration/drone/push Build is passing

Small changes to improve stability and readability.
This commit is contained in:
Bea 2022-11-20 03:25:51 +01:00
parent fddabae3c3
commit 771e115bbd

@ -61,7 +61,7 @@ public class HidekoBot
} catch (LoginException | InterruptedException e) } catch (LoginException | InterruptedException e)
{ {
logger.log(e.getMessage()); // print the error message, omit the stack trace. logger.log(e.getMessage()); // print the error message, omit the stack trace.
return; // if we failed connecting and authenticating, then quit. shutdown(); // if we failed connecting and authenticating, then quit.
} }
// find the bot's user id and generate an invite-link. // find the bot's user id and generate an invite-link.
@ -73,7 +73,7 @@ public class HidekoBot
jda.addEventListener(new SlashCommandListener()); jda.addEventListener(new SlashCommandListener());
// update slash commands (delayed) // update slash commands (delayed)
Executors.newSingleThreadScheduledExecutor().schedule(SlashCommandsUtil::updateSlashCommands, 5, TimeUnit.SECONDS); Executors.newSingleThreadScheduledExecutor().schedule(SlashCommandsUtil::updateSlashCommands, 1, TimeUnit.SECONDS);
// set the bot's status // set the bot's status
jda.getPresence().setStatus(OnlineStatus.ONLINE); jda.getPresence().setStatus(OnlineStatus.ONLINE);
@ -106,7 +106,7 @@ public class HidekoBot
public static void shutdown() public static void shutdown()
{ {
logger.log("WARNING! Shutting down!"); logger.log("WARNING! Shutting down!");
jda.shutdown(); if(jda != null) jda.shutdown();
System.exit(0); System.exit(0);
} }