change some command categories
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 1m26s

This commit is contained in:
Lee 2024-07-07 03:01:36 +01:00
parent 29b44edc6b
commit 898a39e99c
7 changed files with 29 additions and 8 deletions

View File

@ -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() {

View File

@ -150,12 +150,18 @@ public class HelpCommand extends BatCommand implements EventListener {
*/
private LayoutComponent[] createHomeActions(boolean ranInsideGuild) {
List<SelectOption> 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[]{

View File

@ -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() {

View File

@ -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(

View File

@ -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

View File

@ -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

View File

@ -143,7 +143,9 @@ public class CommandService extends ListenerAdapter {
public List<BatCommand> getCommandsByCategory(Category category, boolean includeGuildCommands) {
List<BatCommand> 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);
}
}