Tweak the welcome message some more

This commit is contained in:
Vankka 2024-06-29 17:31:13 +03:00
parent 9daa138a12
commit 3c7d4074dc
No known key found for this signature in database
GPG Key ID: 62E48025ED4E7EBB
2 changed files with 13 additions and 11 deletions

View File

@ -675,13 +675,15 @@ public abstract class AbstractDiscordSRV<
} }
if (connectionConfig().bot.token.equals(BotConfig.DEFAULT_TOKEN)) { if (connectionConfig().bot.token.equals(BotConfig.DEFAULT_TOKEN)) {
logger().info(""); if (initial) {
logger().info("Welcome to DiscordSRV!"); logger().info("");
logger().info(""); logger().info("Welcome to DiscordSRV!");
logger().info("To get started with using DiscordSRV please configure a bot token, instructions will be listed below"); logger().info("");
logger().info("You can review and/or disable external services DiscordSRV uses in the " + ConnectionConfig.FILE_NAME + " before adding a bot token"); logger().info("To get started with using DiscordSRV please configure a bot token, instructions will be printed below");
logger().info(""); logger().info("You can review and/or disable external services DiscordSRV uses in the " + ConnectionConfig.FILE_NAME + " before adding a bot token");
JDAConnectionManager.invalidToken(this, true); logger().info("");
}
discordConnectionManager.invalidToken(true);
results.add(ReloadResults.DEFAULT_BOT_TOKEN); results.add(ReloadResults.DEFAULT_BOT_TOKEN);
return results; return results;
} }

View File

@ -288,7 +288,7 @@ public class JDAConnectionManager implements DiscordConnectionManager {
String token = botConfig.token; String token = botConfig.token;
boolean defaultToken = false; boolean defaultToken = false;
if (StringUtils.isBlank(token) || (defaultToken = token.equals(BotConfig.DEFAULT_TOKEN))) { if (StringUtils.isBlank(token) || (defaultToken = token.equals(BotConfig.DEFAULT_TOKEN))) {
invalidToken(discordSRV, defaultToken); invalidToken(defaultToken);
return; return;
} }
@ -406,7 +406,7 @@ public class JDAConnectionManager implements DiscordConnectionManager {
try { try {
instance = jdaBuilder.build(); instance = jdaBuilder.build();
} catch (InvalidTokenException ignored) { } catch (InvalidTokenException ignored) {
invalidToken(discordSRV, false); invalidToken(false);
} catch (Throwable t) { } catch (Throwable t) {
discordSRV.logger().error("Could not create JDA instance due to an unknown error", 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); discordSRV.setStatus(DiscordSRVApi.Status.FAILED_TO_CONNECT);
return true; return true;
} else if (closeCode == CloseCode.AUTHENTICATION_FAILED) { } else if (closeCode == CloseCode.AUTHENTICATION_FAILED) {
invalidToken(discordSRV, false); invalidToken(false);
return true; return true;
} }
return false; return false;
} }
public static void invalidToken(DiscordSRV discordSRV, boolean defaultToken) { public void invalidToken(boolean defaultToken) {
List<String> lines = Arrays.asList( List<String> lines = Arrays.asList(
"+------------------------------>", "+------------------------------>",
"| Failed to connect to Discord:", "| Failed to connect to Discord:",