From 898a39e99cb04b0f6470c10eb32ebe8c21ce17b3 Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 7 Jul 2024 03:01:36 +0100 Subject: [PATCH] change some command categories --- .../bat/features/base/commands/fun/PPSizeCommand.java | 4 +++- .../features/base/commands/general/HelpCommand.java | 10 ++++++++-- .../base/commands/utility/PastebinCommand.java | 4 +++- .../messagesnipe/command/MessageSnipeCommand.java | 7 ++++++- .../minecraft/command/minecraft/MinecraftCommand.java | 4 +++- .../command/serverwatcher/ServerWatcherCommand.java | 4 +++- .../java/cc/fascinated/bat/service/CommandService.java | 4 +++- 7 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/fun/PPSizeCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/fun/PPSizeCommand.java index fec9441..765e67c 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/fun/PPSizeCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/fun/PPSizeCommand.java @@ -1,6 +1,7 @@ package cc.fascinated.bat.features.base.commands.fun; import cc.fascinated.bat.command.BatCommand; +import cc.fascinated.bat.command.Category; import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.common.EmbedDescriptionBuilder; import cc.fascinated.bat.common.EmbedUtils; @@ -24,7 +25,8 @@ import org.springframework.stereotype.Component; @CommandInfo( name = "ppsize", description = "Get the size of someone's pp", - userInstall = true + userInstall = true, + category = Category.FUN ) public class PPSizeCommand extends BatCommand { public PPSizeCommand() { 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 38b6880..d5a0d59 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 @@ -150,12 +150,18 @@ public class HelpCommand extends BatCommand implements EventListener { */ private LayoutComponent[] createHomeActions(boolean ranInsideGuild) { List options = new ArrayList<>(); - options.add(SelectOption.of("Home", "help-home").withEmoji(Emoji.fromUnicode("U+1F3E0"))); + options.add(SelectOption.of("Home", "help-home") + .withEmoji(Emoji.fromUnicode("U+1F3E0")) + .withDescription("Return to the Home menu") + ); for (Category category : Category.values()) { if (commandService.getCommandsByCategory(category, ranInsideGuild).isEmpty()) { continue; } - options.add(SelectOption.of(category.getName(), "help-" + category.getName()).withEmoji(category.getEmoji())); + options.add(SelectOption.of(category.getName(), "help-" + category.getName()) + .withEmoji(category.getEmoji()) + .withDescription("View commands in the %s category".formatted(category.getName())) + ); } return new LayoutComponent[]{ diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/utility/PastebinCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/utility/PastebinCommand.java index 828ff33..983b6a8 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/utility/PastebinCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/utility/PastebinCommand.java @@ -1,6 +1,7 @@ package cc.fascinated.bat.features.base.commands.utility; import cc.fascinated.bat.command.BatCommand; +import cc.fascinated.bat.command.Category; import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.common.EmbedDescriptionBuilder; import cc.fascinated.bat.common.EmbedUtils; @@ -23,7 +24,8 @@ import org.springframework.stereotype.Component; @CommandInfo( name = "pastebin", description = "Uploads the given text to Paste", - userInstall = true + userInstall = true, + category = Category.UTILITY ) public class PastebinCommand extends BatCommand { public PastebinCommand() { diff --git a/src/main/java/cc/fascinated/bat/features/messagesnipe/command/MessageSnipeCommand.java b/src/main/java/cc/fascinated/bat/features/messagesnipe/command/MessageSnipeCommand.java index 4d3a373..23eabdf 100644 --- a/src/main/java/cc/fascinated/bat/features/messagesnipe/command/MessageSnipeCommand.java +++ b/src/main/java/cc/fascinated/bat/features/messagesnipe/command/MessageSnipeCommand.java @@ -1,6 +1,7 @@ package cc.fascinated.bat.features.messagesnipe.command; import cc.fascinated.bat.command.BatCommand; +import cc.fascinated.bat.command.Category; import cc.fascinated.bat.command.CommandInfo; import lombok.NonNull; import org.springframework.context.ApplicationContext; @@ -10,7 +11,11 @@ import org.springframework.stereotype.Component; * @author Fascinated (fascinated7) */ @Component -@CommandInfo(name = "snipe", description = "Snipe messages") +@CommandInfo( + name = "snipe", + description = "Snipe messages", + category = Category.UTILITY +) public class MessageSnipeCommand extends BatCommand { public MessageSnipeCommand(@NonNull ApplicationContext context) { super.addSubCommands( diff --git a/src/main/java/cc/fascinated/bat/features/minecraft/command/minecraft/MinecraftCommand.java b/src/main/java/cc/fascinated/bat/features/minecraft/command/minecraft/MinecraftCommand.java index d77c2ac..ddc49b2 100644 --- a/src/main/java/cc/fascinated/bat/features/minecraft/command/minecraft/MinecraftCommand.java +++ b/src/main/java/cc/fascinated/bat/features/minecraft/command/minecraft/MinecraftCommand.java @@ -1,6 +1,7 @@ package cc.fascinated.bat.features.minecraft.command.minecraft; import cc.fascinated.bat.command.BatCommand; +import cc.fascinated.bat.command.Category; import cc.fascinated.bat.command.CommandInfo; import lombok.NonNull; import org.springframework.beans.factory.annotation.Autowired; @@ -14,7 +15,8 @@ import org.springframework.stereotype.Component; @CommandInfo( name = "minecraft", description = "Minecraft related commands", - userInstall = true + userInstall = true, + category = Category.UTILITY ) public class MinecraftCommand extends BatCommand { @Autowired diff --git a/src/main/java/cc/fascinated/bat/features/minecraft/command/serverwatcher/ServerWatcherCommand.java b/src/main/java/cc/fascinated/bat/features/minecraft/command/serverwatcher/ServerWatcherCommand.java index faaa166..51c1b75 100644 --- a/src/main/java/cc/fascinated/bat/features/minecraft/command/serverwatcher/ServerWatcherCommand.java +++ b/src/main/java/cc/fascinated/bat/features/minecraft/command/serverwatcher/ServerWatcherCommand.java @@ -1,6 +1,7 @@ package cc.fascinated.bat.features.minecraft.command.serverwatcher; import cc.fascinated.bat.command.BatCommand; +import cc.fascinated.bat.command.Category; import cc.fascinated.bat.command.CommandInfo; import lombok.NonNull; import net.dv8tion.jda.api.Permission; @@ -15,7 +16,8 @@ import org.springframework.stereotype.Component; @CommandInfo( name = "minecraft-server-watcher", description = "Configure the server watcher for Minecraft servers", - requiredPermissions = Permission.MANAGE_SERVER + requiredPermissions = Permission.MANAGE_SERVER, + category = Category.UTILITY ) public class ServerWatcherCommand extends BatCommand { @Autowired diff --git a/src/main/java/cc/fascinated/bat/service/CommandService.java b/src/main/java/cc/fascinated/bat/service/CommandService.java index ae04281..3c2bb9c 100644 --- a/src/main/java/cc/fascinated/bat/service/CommandService.java +++ b/src/main/java/cc/fascinated/bat/service/CommandService.java @@ -143,7 +143,9 @@ public class CommandService extends ListenerAdapter { public List getCommandsByCategory(Category category, boolean includeGuildCommands) { List commands = new ArrayList<>(); for (BatCommand command : this.commands.values()) { - if (command.getInfo().getCategory() == category && (includeGuildCommands || command.getInfo().isUserInstall())) { + if (command.getInfo().getCategory() == category + && (includeGuildCommands || command.getInfo().isUserInstall()) + && !command.getInfo().isBotOwnerOnly()) { commands.add(command); } }