Rename SLASH type to CHAT in command framework.

Replaced all references to the `SLASH` command type with `CHAT` for improved clarity and alignment with its intended functionality. Updated relevant classes, methods, and test cases to reflect this change.
This commit is contained in:
anthorob committed 2026-10-24 05:32:51 -04:00
1 parent 10462a08a4
commit 8e4e77cd31
7 files changed
+7 -7

No files matched your search

@@ -12,7 +12,7 @@ import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions;
public interface Command { public interface Command {
enum Type { enum Type {
SLASH, USER, MESSAGE CHAT, USER, MESSAGE
} }
boolean needAdmin(); boolean needAdmin();
@@ -96,7 +96,7 @@ public class CommandManager implements CommandRegistry {
return; return;
} }
if (command.getDescription() == null && command.getType() == Command.Type.SLASH) { if (command.getDescription() == null && command.getType() == Command.Type.CHAT) {
logger.error("Failed to load command {}: Command description is null", command.getClass().getName()); logger.error("Failed to load command {}: Command description is null", command.getClass().getName());
return; return;
} }
@@ -31,7 +31,7 @@ public class CommandOptionsBuilder implements SlashCommandData {
public CommandOptionsBuilder(Command.Type type, Command command) { public CommandOptionsBuilder(Command.Type type, Command command) {
if (type == Command.Type.SLASH) { if (type == Command.Type.CHAT) {
commandData = (CommandDataImpl) Commands.slash(command.getCommandName(), command.getDescription()); commandData = (CommandDataImpl) Commands.slash(command.getCommandName(), command.getDescription());
} }
@@ -83,7 +83,7 @@ public class CommandProcessor {
logger.info("Executing command {} on guild {}", command.getCommandName(), context.getGuild() == null ? "PrivateMessage" : context.getGuild().getId()); logger.info("Executing command {} on guild {}", command.getCommandName(), context.getGuild() == null ? "PrivateMessage" : context.getGuild().getId());
configureSentry(command); configureSentry(command);
if (command.getType() == Command.Type.SLASH && !usageValidator.validate(context, container)) { if (command.getType() == Command.Type.CHAT && !usageValidator.validate(context, container)) {
return; return;
} }
@@ -34,7 +34,7 @@ public abstract class AbstractCommand implements Command {
@Override @Override
public Type getType() { public Type getType() {
return Type.SLASH; return Type.CHAT;
} }
@Override @Override
@@ -13,7 +13,7 @@ public class PermissionPrecondition implements CommandPrecondition {
@Override @Override
public boolean check(CommandContext context, Command command) { public boolean check(CommandContext context, Command command) {
if (command.getType() != Command.Type.SLASH) { if (command.getType() != Command.Type.CHAT) {
return true; return true;
} }
@@ -109,7 +109,7 @@ class CommandProcessorTest {
when(commands.getCommandContainer(COMMAND_NAME)).thenReturn(container); when(commands.getCommandContainer(COMMAND_NAME)).thenReturn(container);
when(container.getCommand()).thenReturn(command); when(container.getCommand()).thenReturn(command);
when(command.getCommandName()).thenReturn(COMMAND_NAME); when(command.getCommandName()).thenReturn(COMMAND_NAME);
when(command.getType()).thenReturn(Command.Type.SLASH); when(command.getType()).thenReturn(Command.Type.CHAT);
when(command.execute(context)).thenReturn(result); when(command.execute(context)).thenReturn(result);
when(usageValidator.validate(context, container)).thenReturn(true); when(usageValidator.validate(context, container)).thenReturn(true);
} }