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

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.base.commands.fun; package cc.fascinated.bat.features.base.commands.fun;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.Category;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;
import cc.fascinated.bat.common.EmbedDescriptionBuilder; import cc.fascinated.bat.common.EmbedDescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils; import cc.fascinated.bat.common.EmbedUtils;
@ -24,7 +25,8 @@ import org.springframework.stereotype.Component;
@CommandInfo( @CommandInfo(
name = "ppsize", name = "ppsize",
description = "Get the size of someone's pp", description = "Get the size of someone's pp",
userInstall = true userInstall = true,
category = Category.FUN
) )
public class PPSizeCommand extends BatCommand { public class PPSizeCommand extends BatCommand {
public PPSizeCommand() { public PPSizeCommand() {

@ -150,12 +150,18 @@ public class HelpCommand extends BatCommand implements EventListener {
*/ */
private LayoutComponent[] createHomeActions(boolean ranInsideGuild) { private LayoutComponent[] createHomeActions(boolean ranInsideGuild) {
List<SelectOption> options = new ArrayList<>(); 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()) { for (Category category : Category.values()) {
if (commandService.getCommandsByCategory(category, ranInsideGuild).isEmpty()) { if (commandService.getCommandsByCategory(category, ranInsideGuild).isEmpty()) {
continue; 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[]{ return new LayoutComponent[]{

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.base.commands.utility; package cc.fascinated.bat.features.base.commands.utility;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.Category;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;
import cc.fascinated.bat.common.EmbedDescriptionBuilder; import cc.fascinated.bat.common.EmbedDescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils; import cc.fascinated.bat.common.EmbedUtils;
@ -23,7 +24,8 @@ import org.springframework.stereotype.Component;
@CommandInfo( @CommandInfo(
name = "pastebin", name = "pastebin",
description = "Uploads the given text to Paste", description = "Uploads the given text to Paste",
userInstall = true userInstall = true,
category = Category.UTILITY
) )
public class PastebinCommand extends BatCommand { public class PastebinCommand extends BatCommand {
public PastebinCommand() { public PastebinCommand() {

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.messagesnipe.command; package cc.fascinated.bat.features.messagesnipe.command;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.Category;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;
import lombok.NonNull; import lombok.NonNull;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
@ -10,7 +11,11 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "snipe", description = "Snipe messages") @CommandInfo(
name = "snipe",
description = "Snipe messages",
category = Category.UTILITY
)
public class MessageSnipeCommand extends BatCommand { public class MessageSnipeCommand extends BatCommand {
public MessageSnipeCommand(@NonNull ApplicationContext context) { public MessageSnipeCommand(@NonNull ApplicationContext context) {
super.addSubCommands( super.addSubCommands(

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.minecraft.command.minecraft; package cc.fascinated.bat.features.minecraft.command.minecraft;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.Category;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;
import lombok.NonNull; import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -14,7 +15,8 @@ import org.springframework.stereotype.Component;
@CommandInfo( @CommandInfo(
name = "minecraft", name = "minecraft",
description = "Minecraft related commands", description = "Minecraft related commands",
userInstall = true userInstall = true,
category = Category.UTILITY
) )
public class MinecraftCommand extends BatCommand { public class MinecraftCommand extends BatCommand {
@Autowired @Autowired

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.minecraft.command.serverwatcher; package cc.fascinated.bat.features.minecraft.command.serverwatcher;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.Category;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;
import lombok.NonNull; import lombok.NonNull;
import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.Permission;
@ -15,7 +16,8 @@ import org.springframework.stereotype.Component;
@CommandInfo( @CommandInfo(
name = "minecraft-server-watcher", name = "minecraft-server-watcher",
description = "Configure the server watcher for Minecraft servers", description = "Configure the server watcher for Minecraft servers",
requiredPermissions = Permission.MANAGE_SERVER requiredPermissions = Permission.MANAGE_SERVER,
category = Category.UTILITY
) )
public class ServerWatcherCommand extends BatCommand { public class ServerWatcherCommand extends BatCommand {
@Autowired @Autowired

@ -143,7 +143,9 @@ public class CommandService extends ListenerAdapter {
public List<BatCommand> getCommandsByCategory(Category category, boolean includeGuildCommands) { public List<BatCommand> getCommandsByCategory(Category category, boolean includeGuildCommands) {
List<BatCommand> commands = new ArrayList<>(); List<BatCommand> commands = new ArrayList<>();
for (BatCommand command : this.commands.values()) { 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); commands.add(command);
} }
} }