diff --git a/common/src/main/java/com/discordsrv/common/AbstractDiscordSRV.java b/common/src/main/java/com/discordsrv/common/AbstractDiscordSRV.java index 124ac486..3a0ce4c3 100644 --- a/common/src/main/java/com/discordsrv/common/AbstractDiscordSRV.java +++ b/common/src/main/java/com/discordsrv/common/AbstractDiscordSRV.java @@ -675,13 +675,15 @@ public abstract class AbstractDiscordSRV< } if (connectionConfig().bot.token.equals(BotConfig.DEFAULT_TOKEN)) { - logger().info(""); - logger().info("Welcome to DiscordSRV!"); - logger().info(""); - logger().info("To get started with using DiscordSRV please configure a bot token, instructions will be listed below"); - logger().info("You can review and/or disable external services DiscordSRV uses in the " + ConnectionConfig.FILE_NAME + " before adding a bot token"); - logger().info(""); - JDAConnectionManager.invalidToken(this, true); + if (initial) { + logger().info(""); + logger().info("Welcome to DiscordSRV!"); + logger().info(""); + logger().info("To get started with using DiscordSRV please configure a bot token, instructions will be printed below"); + logger().info("You can review and/or disable external services DiscordSRV uses in the " + ConnectionConfig.FILE_NAME + " before adding a bot token"); + logger().info(""); + } + discordConnectionManager.invalidToken(true); results.add(ReloadResults.DEFAULT_BOT_TOKEN); return results; } diff --git a/common/src/main/java/com/discordsrv/common/discord/connection/jda/JDAConnectionManager.java b/common/src/main/java/com/discordsrv/common/discord/connection/jda/JDAConnectionManager.java index 1c79e92e..0fffc2e7 100644 --- a/common/src/main/java/com/discordsrv/common/discord/connection/jda/JDAConnectionManager.java +++ b/common/src/main/java/com/discordsrv/common/discord/connection/jda/JDAConnectionManager.java @@ -288,7 +288,7 @@ public class JDAConnectionManager implements DiscordConnectionManager { String token = botConfig.token; boolean defaultToken = false; if (StringUtils.isBlank(token) || (defaultToken = token.equals(BotConfig.DEFAULT_TOKEN))) { - invalidToken(discordSRV, defaultToken); + invalidToken(defaultToken); return; } @@ -406,7 +406,7 @@ public class JDAConnectionManager implements DiscordConnectionManager { try { instance = jdaBuilder.build(); } catch (InvalidTokenException ignored) { - invalidToken(discordSRV, false); + invalidToken(false); } catch (Throwable t) { discordSRV.logger().error("Could not create JDA instance due to an unknown error", t); } @@ -565,13 +565,13 @@ public class JDAConnectionManager implements DiscordConnectionManager { discordSRV.setStatus(DiscordSRVApi.Status.FAILED_TO_CONNECT); return true; } else if (closeCode == CloseCode.AUTHENTICATION_FAILED) { - invalidToken(discordSRV, false); + invalidToken(false); return true; } return false; } - public static void invalidToken(DiscordSRV discordSRV, boolean defaultToken) { + public void invalidToken(boolean defaultToken) { List lines = Arrays.asList( "+------------------------------>", "| Failed to connect to Discord:",