This commit is contained in:
parent
d023e21575
commit
11299b3ca7
@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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",
|
||||
|
@ -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<Command> discordCommands = jda.updateCommands().addCommands(commands.values().stream()
|
||||
.filter(command -> !command.getInfo().isBotOwnerOnly())
|
||||
List<Command> 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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user