diff --git a/src/main/java/wtf/beatrice/hidekobot/HidekoBot.java b/src/main/java/wtf/beatrice/hidekobot/HidekoBot.java index 4a2eb6a..b5ce394 100644 --- a/src/main/java/wtf/beatrice/hidekobot/HidekoBot.java +++ b/src/main/java/wtf/beatrice/hidekobot/HidekoBot.java @@ -77,7 +77,12 @@ public class HidekoBot ); jda = jdaBuilder.build().awaitReady(); - } catch (Exception e) + } catch (InterruptedException e) { + LOGGER.error(e.getMessage()); // print the error message, omit the stack trace. + Thread.currentThread().interrupt(); // send interrupt to the thread. + shutdown(); // if we failed connecting and authenticating, then quit. + } + catch (Exception e) { LOGGER.error(e.getMessage()); // print the error message, omit the stack trace. shutdown(); // if we failed connecting and authenticating, then quit. diff --git a/src/main/java/wtf/beatrice/hidekobot/commands/base/Trivia.java b/src/main/java/wtf/beatrice/hidekobot/commands/base/Trivia.java index b4bf9c6..d6d9e8e 100644 --- a/src/main/java/wtf/beatrice/hidekobot/commands/base/Trivia.java +++ b/src/main/java/wtf/beatrice/hidekobot/commands/base/Trivia.java @@ -67,7 +67,7 @@ public class Trivia List categories = Trivia.parseCategories(categoriesJson); if(categories.isEmpty()) return new MessageResponse("Error parsing trivia categories!", null); // todo nicer with emojis - + categories.sort(new TriviaCategoryComparator()); EmbedBuilder embedBuilder = new EmbedBuilder(); diff --git a/src/main/java/wtf/beatrice/hidekobot/datasources/ConfigurationSource.java b/src/main/java/wtf/beatrice/hidekobot/datasources/ConfigurationSource.java index 5ee0b6d..f4755b2 100644 --- a/src/main/java/wtf/beatrice/hidekobot/datasources/ConfigurationSource.java +++ b/src/main/java/wtf/beatrice/hidekobot/datasources/ConfigurationSource.java @@ -47,7 +47,14 @@ public class ConfigurationSource if(!fsConfigFile.exists()) { // try to create config file - try { fsConfigFile.createNewFile(); } + try { + if(!fsConfigFile.createNewFile()) + { + LOGGER.error("We tried creating a file that already exists!"); + HidekoBot.shutdown(); + return; + } + } catch (IOException e) { LOGGER.error("Error creating configuration file!", e); HidekoBot.shutdown();