Convert some strings to text blocks

this is the coolest thing ive ever seen
This commit is contained in:
Anya 2022-05-21 19:05:53 -07:00
parent ae092d3440
commit 67dafe50bb
3 changed files with 22 additions and 21 deletions

View File

@ -63,8 +63,6 @@ public class KiafumiConfig {
*/
public boolean load() {
try {
var n = System.lineSeparator() + "\033[0m"; // newline
// Discord loaders
var discord = configuration.getConfigurationSection("discord");
token = discord.getString("token"); // This used to log the token into stdout ???
@ -74,14 +72,16 @@ public class KiafumiConfig {
clientId = discord.getString("clientId");
defaultInvitePermissionLevel = discord.getInt("invitePermissionLevel");
// Log discord settings in a neat table.
info("Printing loaded discord configuration." +n+
"DISCORD CONFIGURATION" +n+
"--------------------------------" +n+
"Log Channel: \033[0;34m" + logChannel +n+
"Owner ID: \033[0;34m" + ownerId +n+
"Primary Guild: \033[0;34m" + mainGuild +n+
"Invite URL: \033[0;34m" + assembleDefaultInvite() +n+
"--------------------------------");
info("""
Printing loaded discord configuration.
DISCORD CONFIGURATION
--------------------------------
Log Channel: %s
Owner ID: %s
Primary Guild: %s
Invite URL: %s
--------------------------------
""".formatted(logChannel, ownerId, mainGuild, assembleDefaultInvite()));
// Kiafumi loaders
var main = configuration.getConfigurationSection("main");

View File

@ -37,12 +37,13 @@ public class MainListener extends ListenerAdapter {
*/
@Override
public void onReady(@NotNull ReadyEvent event) {
var n = System.lineSeparator();
info("Received READY signal from Discord, bot is now logged in." +n+
"--------------------------------" +n+
"Active Guilds: " + event.getGuildAvailableCount() +n+
"Guilds Unavailable: " + event.getGuildUnavailableCount() +n+
"--------------------------------");
info("""
Received READY signal from Discord, bot is now logged in.
--------------------------------
Active Guilds: [%s]
Guilds Unavailable: [%s]
--------------------------------
""".formatted(event.getGuildAvailableCount(), event.getGuildUnavailableCount()));
}
/**

View File

@ -101,11 +101,11 @@ public class Server {
* @return - Options in a string that can be printed to discord.
*/
public String getOpts() {
return "welcomeEnabled - whether or not join/leave logs are enabled" +
"\nwelcomeChannel - the channel to send welcome messages to" +
"\njoinRole - the role to apply to new members who join this guild" +
"\nserverProtected - Determines whether or not server protections are enabled." +
"\nmodRole - The moderator role for the /mod command (only works if protection enabled)";
return """
welcomeChannel - the channel to send welcome messages to
modChannel - the channel to send moderation logs to
joinRole - the role to apply to new members who join this guild
""";
}
/**