diff --git a/src/main/java/cc/fascinated/bat/command/BatCommand.java b/src/main/java/cc/fascinated/bat/command/BatCommand.java index 79435f7..f18ba97 100644 --- a/src/main/java/cc/fascinated/bat/command/BatCommand.java +++ b/src/main/java/cc/fascinated/bat/command/BatCommand.java @@ -67,7 +67,7 @@ public abstract class BatCommand { commandData = new CommandDataImpl(info.getName(), info.getDescription()) .setContexts(InteractionContextType.ALL) .setIntegrationTypes(integrationTypes) - .setGuildOnly(info.isGuildOnly()); + .setGuildOnly(!getInfo().isUserInstall() && getInfo().isGuildOnly()); } /** diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/general/HelpCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/general/HelpCommand.java index 8fb032a..52c094e 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/general/HelpCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/general/HelpCommand.java @@ -36,7 +36,7 @@ import java.util.Map; * @author Fascinated (fascinated7) */ @Component -@CommandInfo(name = "help", description = "View the bots command categories.", guildOnly = false, category = Category.GENERAL) +@CommandInfo(name = "help", description = "View the bots command categories.", guildOnly = false, userInstall = true, category = Category.GENERAL) public class HelpCommand extends BatCommand implements EventListener { private final CommandService commandService; diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/general/VoteCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/general/VoteCommand.java index edbf705..4515abe 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/general/VoteCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/general/VoteCommand.java @@ -17,7 +17,7 @@ import org.springframework.stereotype.Component; * @author Fascinated (fascinated7) */ @Component -@CommandInfo(name = "vote", description = "Vote for the bot", guildOnly = false, category = Category.GENERAL) +@CommandInfo(name = "vote", description = "Vote for the bot", guildOnly = false, userInstall = true, category = Category.GENERAL) public class VoteCommand extends BatCommand { private static final String[] VOTE_LINKS = new String[]{ "https://top.gg/bot/1254161119975833652/vote", diff --git a/src/main/java/cc/fascinated/bat/service/CommandService.java b/src/main/java/cc/fascinated/bat/service/CommandService.java index 43d5ae3..34804e9 100644 --- a/src/main/java/cc/fascinated/bat/service/CommandService.java +++ b/src/main/java/cc/fascinated/bat/service/CommandService.java @@ -94,8 +94,7 @@ public class CommandService extends ListenerAdapter { // Unregister all commands that Discord has but we don't jda.retrieveCommands().complete().forEach(command -> { - if (commands.containsKey(command.getName()) - && commands.get(command.getName()).getInfo().isBotOwnerOnly()) { + if (commands.containsKey(command.getName()) && commands.get(command.getName()).getInfo().isBotOwnerOnly()) { jda.deleteCommandById(command.getId()).complete(); // Unregister the command on Discord log.info("Unregistered hidden command \"{}\" from Discord", command.getName()); return; @@ -109,8 +108,7 @@ public class CommandService extends ListenerAdapter { }); // Register all commands - List discordCommands = jda.updateCommands().addCommands(commands.values().stream() - .filter(command -> !command.getInfo().isBotOwnerOnly()) + List discordCommands = jda.updateCommands().addCommands(commands.values().stream().filter(command -> !command.getInfo().isBotOwnerOnly()) .map(BatCommand::getCommandData).toList()).complete(); for (Command discordCommand : discordCommands) { commands.get(discordCommand.getName()).setSnowflake(discordCommand.getIdLong()); @@ -121,8 +119,7 @@ public class CommandService extends ListenerAdapter { } } if (adminGuild != null) { - adminGuild.updateCommands().addCommands(commands.values().stream() - .filter(command -> command.getInfo().isBotOwnerOnly()) + adminGuild.updateCommands().addCommands(commands.values().stream().filter(command -> command.getInfo().isBotOwnerOnly()) .map(BatCommand::getCommandData).toList()).complete(); } else { log.error("Unable to find the admin guild to register hidden commands");