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)) {
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;
}

View File

@ -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<String> lines = Arrays.asList(
"+------------------------------>",
"| Failed to connect to Discord:",