actually fix it

This commit is contained in:
Lee 2024-06-28 19:11:37 +01:00
parent e17c8a08c2
commit 107ec43149

@ -149,6 +149,7 @@ public class CommandService extends ListenerAdapter {
try { try {
BatCommandExecutor executor = null; BatCommandExecutor executor = null;
CommandInfo commandInfo = command.getCommandInfo();
List<Permission> requiredPermissions = new ArrayList<>(); List<Permission> requiredPermissions = new ArrayList<>();
boolean isSubCommand = false; boolean isSubCommand = false;
@ -164,6 +165,7 @@ public class CommandService extends ListenerAdapter {
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; isSubCommand = true;
commandInfo = subCommand.getValue().getCommandInfo();
break; break;
} }
} }
@ -199,7 +201,11 @@ public class CommandService extends ListenerAdapter {
} }
} }
if (isSubCommand && command.getCommandInfo().guildOnly() && !ranInsideGuild) { System.out.println("isSubCommand = " + isSubCommand);
System.out.println("command.getCommandInfo().guildOnly() = " + command.getCommandInfo().guildOnly());
System.out.println("ranInsideGuild = " + ranInsideGuild);
if (isSubCommand && commandInfo.guildOnly() && !ranInsideGuild) {
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();