Complete moving to SFL4J
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-01-15 02:05:23 +01:00
parent 6bbaf3fe7e
commit 4c653fc93c
10 changed files with 72 additions and 65 deletions

View File

@@ -1,5 +1,6 @@
package wtf.beatrice.hidekobot.util;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Message;
@@ -11,6 +12,8 @@ import net.dv8tion.jda.api.interactions.commands.Command;
import net.dv8tion.jda.api.interactions.commands.build.CommandData;
import net.dv8tion.jda.api.interactions.components.LayoutComponent;
import net.dv8tion.jda.api.requests.RestAction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import wtf.beatrice.hidekobot.Cache;
import wtf.beatrice.hidekobot.HidekoBot;
import wtf.beatrice.hidekobot.datasources.DatabaseSource;
@@ -22,7 +25,7 @@ import java.util.List;
public class CommandUtil
{
private static final Logger logger = new Logger(CommandUtil.class);
private static final Logger LOGGER = LoggerFactory.getLogger(CommandUtil.class);
/**
* Function to delete a message when a user clicks the "delete" button attached to that message.
@@ -133,13 +136,13 @@ public class CommandUtil
}
}
logger.log("Found " + registeredCommands.size() + " commands.");
LOGGER.info("Found {} commands.", registeredCommands.size());
if(update)
{
// send updated command list.
jdaInstance.updateCommands().addCommands(allCommands).queue();
logger.log("Commands updated. New total: " + allCommands.size() + ".");
LOGGER.info("Commands updated. New total: {}.", allCommands.size());
}
}
@@ -208,7 +211,7 @@ public class CommandUtil
RestAction<Message> retrieveAction = textChannel.retrieveMessageById(messageId);
if(Cache.isVerbose()) logger.log("cleaning up: " + messageId);
if(Cache.isVerbose()) LOGGER.info("cleaning up: {}", messageId);
retrieveAction.queue(
message -> {

View File

@@ -12,6 +12,27 @@ import java.util.Arrays;
public class FormatUtil
{
// cosmetic string to print on startup.
private static final String LOGO =
"██╗░░██╗██╗██████╗░███████╗██╗░░██╗░█████╗░\n" +
"██║░░██║██║██╔══██╗██╔════╝██║░██╔╝██╔══██╗\n" +
"███████║██║██║░░██║█████╗░░█████═╝░██║░░██║\n" +
"██╔══██║██║██║░░██║██╔══╝░░██╔═██╗░██║░░██║\n" +
"██║░░██║██║██████╔╝███████╗██║░╚██╗╚█████╔╝\n" +
"╚═╝░░╚═╝╚═╝╚═════╝░╚══════╝╚═╝░░╚═╝░╚════╝░";
/**
* Returns ASCII art saying the bot name.
*
* @return a String containing the logo
*/
public static String getLogo()
{
return LOGO;
}
/**
* Generate a nicely formatted time-diff String that omits unnecessary data
* (e.g. 0 days, 0 hours, 4 minutes, 32 seconds -> 4m 32s)

View File

@@ -9,15 +9,6 @@ import java.util.concurrent.TimeUnit;
public class Logger
{
// cosmetic string to print on startup.
private String logo =
"██╗░░██╗██╗██████╗░███████╗██╗░░██╗░█████╗░\n" +
"██║░░██║██║██╔══██╗██╔════╝██║░██╔╝██╔══██╗\n" +
"███████║██║██║░░██║█████╗░░█████═╝░██║░░██║\n" +
"██╔══██║██║██║░░██║██╔══╝░░██╔═██╗░██║░░██║\n" +
"██║░░██║██║██████╔╝███████╗██║░╚██╗╚█████╔╝\n" +
"╚═╝░░╚═╝╚═╝╚═════╝░╚══════╝╚═╝░░╚═╝░╚════╝░";
// objects that we need to have for a properly formatted message
private String className;
private final String format = "[%date% %time%] [%class%] %message%";
@@ -72,14 +63,5 @@ public class Logger
System.out.println(message);
}
/**
* Returns ASCII art saying the bot name.
*
* @return a String containing the logo
*/
public String getLogo()
{
return logo;
}
}