Skip to content

Commit

Permalink
Logger
Browse files Browse the repository at this point in the history
  • Loading branch information
YoSoyVillaa committed Jul 26, 2022
1 parent a1b41ac commit eb25d4e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.yosoyvillaa</groupId>
<artifactId>VJCommands</artifactId>
<version>1.1</version>
<version>1.2</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
14 changes: 9 additions & 5 deletions src/main/java/com/yosoyvillaa/vjcommands/CommandManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.hooks.AnnotatedEventManager;
import net.dv8tion.jda.api.hooks.SubscribeEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.HashSet;
Expand All @@ -16,6 +18,8 @@

public class CommandManager {

private static final Logger logger = LoggerFactory.getLogger("VJCommands");

private final JDA jda;
private final Map<String, PrefixCommand> prefixCommands;
private final Map<String, SlashCommand> slashCommands;
Expand Down Expand Up @@ -48,7 +52,7 @@ public Set<SlashCommand> getSlashCommands() {
}

public void registerCommand(ICommand command) {
System.out.println("[VJCommands] Registering command " + command.getName());
logger.info("Registering command " + command.getName());
if (command instanceof PrefixCommand) {
PrefixCommand prefixCommand = (PrefixCommand) command;
if (prefixCommands.containsKey(prefixCommand.getPrefix() + prefixCommand.getName()))
Expand All @@ -65,7 +69,7 @@ public void registerCommand(ICommand command) {
slashCommands.put(slashCommand.getName(), slashCommand);
jda.upsertCommand(slashCommand.getCommandData()).queue();
}
System.out.println("[VJCommands] Command " + command.getName() + " registered");
logger.info("Command " + command.getName() + " registered");
}

public void registerCommands(ICommand... commands) {
Expand All @@ -75,7 +79,7 @@ public void registerCommands(ICommand... commands) {
}

public void unregisterCommand(ICommand command) {
System.out.println("[VJCommands] Unregistering command " + command.getName());
logger.info("Unregistering command " + command.getName());
if (command instanceof PrefixCommand) {
PrefixCommand prefixCommand = (PrefixCommand) command;
prefixCommands.remove(prefixCommand.getPrefix() + prefixCommand.getName());
Expand All @@ -84,9 +88,9 @@ public void unregisterCommand(ICommand command) {
if (command instanceof SlashCommand) {
SlashCommand slashCommand = (SlashCommand) command;
slashCommands.remove(slashCommand.getName());
System.out.println("Slash commands will be already being shown on the client, you will need to restart the bot with the command disabled");
logger.warn("Slash commands will be already being shown on the client, you will need to restart the bot with the command disabled");
}
System.out.println("[VJCommands] Command " + command.getName() + " unregistered");
logger.info("Command " + command.getName() + " unregistered");
}

public void unregisterAllCommands() {
Expand Down

0 comments on commit eb25d4e

Please sign in to comment.