This commit is contained in:
Lee 2024-07-04 12:05:37 +01:00
parent cbc28701c9
commit 66a2d8b2a9

@ -164,7 +164,6 @@ public class CommandService extends ListenerAdapter {
BatCommandExecutor executor = null; BatCommandExecutor executor = null;
CommandInfo commandInfo = command.getCommandInfo(); CommandInfo commandInfo = command.getCommandInfo();
List<Permission> requiredPermissions = new ArrayList<>(); List<Permission> requiredPermissions = new ArrayList<>();
boolean isSubCommand = false;
// No args provided, use the main command executor // No args provided, use the main command executor
if (event.getInteraction().getSubcommandName() == null) { if (event.getInteraction().getSubcommandName() == null) {
@ -177,7 +176,6 @@ public class CommandService extends ListenerAdapter {
executor = subCommand.getValue(); executor = subCommand.getValue();
requiredPermissions.addAll(Arrays.asList(subCommand.getValue().getCommandInfo().requiredPermissions())); requiredPermissions.addAll(Arrays.asList(subCommand.getValue().getCommandInfo().requiredPermissions()));
requiredPermissions.addAll(Arrays.asList(command.getCommandInfo().requiredPermissions())); // not sure if we'd want this, but it's here for now requiredPermissions.addAll(Arrays.asList(command.getCommandInfo().requiredPermissions())); // not sure if we'd want this, but it's here for now
isSubCommand = true;
commandInfo = subCommand.getValue().getCommandInfo(); commandInfo = subCommand.getValue().getCommandInfo();
break; break;
} }
@ -216,7 +214,7 @@ public class CommandService extends ListenerAdapter {
} }
// Check if the command is guild only and if it was not ran inside a guild // Check if the command is guild only and if it was not ran inside a guild
if (commandInfo.guildOnly() && !ranInsideGuild) { if (commandInfo.guildOnly() && guild == null) {
event.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("This command can only be executed in a guild") .setDescription("This command can only be executed in a guild")
.build()).setEphemeral(true).queue(); .build()).setEphemeral(true).queue();