re-impl help cmd and fix cmd categories
Some checks failed
Deploy to Dokku / docker (ubuntu-latest) (push) Has been cancelled

This commit is contained in:
Lee 2024-07-04 14:21:02 +01:00
parent 57d5dc0c42
commit 69adc56e4e
44 changed files with 109 additions and 92 deletions

@ -16,10 +16,7 @@ public enum Category {
SERVER(Emoji.fromFormatted("U+1F5A5"), "Server"), SERVER(Emoji.fromFormatted("U+1F5A5"), "Server"),
MODERATION(Emoji.fromFormatted("U+1F6E0"), "Moderation"), MODERATION(Emoji.fromFormatted("U+1F6E0"), "Moderation"),
UTILITY(Emoji.fromFormatted("U+1F6E0"), "Utility"), UTILITY(Emoji.fromFormatted("U+1F6E0"), "Utility"),
MUSIC(Emoji.fromFormatted("U+1F3B5"), "Music"), MEDIA(Emoji.fromFormatted("U+1F3A5"), "Media"),
MOVIES_TV(Emoji.fromFormatted("U+1F3A5"), "Movies & TV"),
MESSAGES(Emoji.fromFormatted("U+1F4A3"), "Messages"),
LOGS(Emoji.fromFormatted("U+1F4D1"), "Logs"),
BEAT_SABER(Emoji.fromFormatted("U+1FA84"), "Beat Saber"); BEAT_SABER(Emoji.fromFormatted("U+1FA84"), "Beat Saber");
/** /**

@ -25,11 +25,6 @@ public abstract class Feature {
*/ */
public final boolean canBeDisabled; public final boolean canBeDisabled;
/**
* The category of the feature
*/
private final Category category;
/** /**
* Registers the command for the feature * Registers the command for the feature
* *

@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
@Component @Component
public class AfkFeature extends Feature { public class AfkFeature extends Feature {
public AfkFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) { public AfkFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("AFK", true, Category.GENERAL); super("AFK", true);
registerCommand(commandService, context.getBean(AfkCommand.class)); registerCommand(commandService, context.getBean(AfkCommand.class));
} }

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.afk.command; package cc.fascinated.bat.features.afk.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 cc.fascinated.bat.common.MemberUtils; import cc.fascinated.bat.common.MemberUtils;
import cc.fascinated.bat.features.afk.profile.AfkProfile; import cc.fascinated.bat.features.afk.profile.AfkProfile;
@ -19,7 +20,7 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "afk", description = "Sets your AFK status") @CommandInfo(name = "afk", description = "Sets your AFK status", category = Category.GENERAL)
public class AfkCommand extends BatCommand { public class AfkCommand extends BatCommand {
public AfkCommand() { public AfkCommand() {
super.addOptions(new OptionData(OptionType.STRING, "reason", "The reason for being AFK", false)); super.addOptions(new OptionData(OptionType.STRING, "reason", "The reason for being AFK", false));

@ -16,7 +16,7 @@ import org.springframework.stereotype.Component;
public class AutoRoleFeature extends Feature { public class AutoRoleFeature extends Feature {
@Autowired @Autowired
public AutoRoleFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) { public AutoRoleFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("Auto Role",true, Category.SERVER); super("Auto Role",true);
registerCommand(commandService, context.getBean(AutoRoleCommand.class)); registerCommand(commandService, context.getBean(AutoRoleCommand.class));
} }

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.autorole.command; package cc.fascinated.bat.features.autorole.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 net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.Permission;
@ -11,7 +12,7 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component("autoroles.command") @Component("autoroles.command")
@CommandInfo(name = "autorole", description = "Set up the automatic role system for members on join", requiredPermissions = Permission.MANAGE_SERVER) @CommandInfo(name = "autorole", description = "Set up the automatic role system for members on join", requiredPermissions = Permission.MANAGE_SERVER, category = Category.SERVER)
public class AutoRoleCommand extends BatCommand { public class AutoRoleCommand extends BatCommand {
public AutoRoleCommand(@NonNull ApplicationContext context) { public AutoRoleCommand(@NonNull ApplicationContext context) {
super.addSubCommands( super.addSubCommands(

@ -3,7 +3,7 @@ package cc.fascinated.bat.features.base;
import cc.fascinated.bat.command.Category; import cc.fascinated.bat.command.Category;
import cc.fascinated.bat.features.Feature; import cc.fascinated.bat.features.Feature;
import cc.fascinated.bat.features.base.commands.botadmin.premium.PremiumAdminCommand; import cc.fascinated.bat.features.base.commands.botadmin.premium.PremiumAdminCommand;
import cc.fascinated.bat.features.base.commands.discord.LookupUserCommand; import cc.fascinated.bat.features.base.commands.general.LookupUserCommand;
import cc.fascinated.bat.features.base.commands.fun.EightBallCommand; import cc.fascinated.bat.features.base.commands.fun.EightBallCommand;
import cc.fascinated.bat.features.base.commands.fun.image.ImageCommand; import cc.fascinated.bat.features.base.commands.fun.image.ImageCommand;
import cc.fascinated.bat.features.base.commands.general.*; import cc.fascinated.bat.features.base.commands.general.*;
@ -26,7 +26,7 @@ import org.springframework.stereotype.Component;
public class BaseFeature extends Feature { public class BaseFeature extends Feature {
@Autowired @Autowired
public BaseFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) { public BaseFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("Base", false, Category.GENERAL); super("Base", false);
super.registerCommand(commandService, context.getBean(PremiumCommand.class)); super.registerCommand(commandService, context.getBean(PremiumCommand.class));
super.registerCommand(commandService, context.getBean(PremiumAdminCommand.class)); super.registerCommand(commandService, context.getBean(PremiumAdminCommand.class));

@ -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.EmbedUtils; import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatGuild;
@ -18,7 +19,7 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "8ball", description = "Ask the magic 8ball a question", guildOnly = false, userInstall = true) @CommandInfo(name = "8ball", description = "Ask the magic 8ball a question", guildOnly = false, userInstall = true, category = Category.FUN)
public class EightBallCommand extends BatCommand { public class EightBallCommand extends BatCommand {
private final String[] responses = new String[]{ private final String[] responses = new String[]{
"It is certain", "It is certain",

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.base.commands.general; package cc.fascinated.bat.features.base.commands.general;
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;
@ -26,7 +27,7 @@ import java.lang.management.RuntimeMXBean;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "botstats", description = "Shows the bot statistics", guildOnly = false, userInstall = true) @CommandInfo(name = "botstats", description = "Shows the bot statistics", guildOnly = false, userInstall = true, category = Category.GENERAL)
public class BotStatsCommand extends BatCommand { public class BotStatsCommand extends BatCommand {
private final GuildService guildService; private final GuildService guildService;
private final UserService userService; private final UserService userService;

@ -16,6 +16,7 @@ import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.entities.emoji.Emoji; import net.dv8tion.jda.api.entities.emoji.Emoji;
import net.dv8tion.jda.api.events.interaction.component.StringSelectInteractionEvent; import net.dv8tion.jda.api.events.interaction.component.StringSelectInteractionEvent;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction; import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
import net.dv8tion.jda.api.interactions.components.ActionRow; import net.dv8tion.jda.api.interactions.components.ActionRow;
import net.dv8tion.jda.api.interactions.components.LayoutComponent; import net.dv8tion.jda.api.interactions.components.LayoutComponent;
import net.dv8tion.jda.api.interactions.components.buttons.Button; import net.dv8tion.jda.api.interactions.components.buttons.Button;
@ -27,12 +28,13 @@ import org.springframework.stereotype.Component;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "help", description = "View the bots command categories.", guildOnly = false) @CommandInfo(name = "help", description = "View the bots command categories.", guildOnly = false, category = Category.GENERAL)
public class HelpCommand extends BatCommand implements EventListener { public class HelpCommand extends BatCommand implements EventListener {
private final CommandService commandService; private final CommandService commandService;
@ -59,45 +61,44 @@ public class HelpCommand extends BatCommand implements EventListener {
event.reply("Invalid category selected.").queue(); event.reply("Invalid category selected.").queue();
return; return;
} }
event.reply("hello this doesnt work yet").queue();
// StringBuilder commands = new StringBuilder(); StringBuilder commands = new StringBuilder();
// List<BatCommand> categoryCommands = commandService.getCommandsByCategory(category, true); List<BatCommand> categoryCommands = commandService.getCommandsByCategory(category);
// if (categoryCommands.isEmpty()) { if (categoryCommands.isEmpty()) {
// commands = new StringBuilder("No commands available in this category."); commands = new StringBuilder("No commands available in this category.");
// } else { } else {
// for (BatCommand command : categoryCommands) { for (BatCommand command : categoryCommands) {
// if (!command.getSubCommands().isEmpty()) { if (!command.getSubCommands().isEmpty()) {
// for (Map.Entry<String, BatSubCommand> entry : command.getSubCommands().entrySet()) { for (Map.Entry<String, BatCommand> entry : command.getSubCommands().entrySet()) {
// BatSubCommand subCommand = entry.getValue(); BatCommand subCommand = entry.getValue();
// SubcommandData commandData = subCommand.getCommandData(); SubcommandData subcommandData = subCommand.getSubcommandData();
// commands.append("</%s %s:%s> - %s\n".formatted( commands.append("</%s %s:%s> - %s\n".formatted(
// command.getCommandInfo().name(), command.getInfo().getName(),
// commandData.getName(), subcommandData.getName(),
// subCommand.getCommandSnowflake(), subCommand.getSnowflake(),
// commandData.getDescription() subcommandData.getDescription()
// )); ));
// } }
// continue; continue;
// } }
// commands.append("</%s:%s> - %s\n".formatted( commands.append("</%s:%s> - %s\n".formatted(
// command.getCommandInfo().name(), command.getInfo().getName(),
// command.getCommandSnowflake(), command.getSnowflake(),
// command.getCommandInfo().description() command.getInfo().getDescription()
// )); ));
// } }
// } }
//
// int subCommands = categoryCommands.stream().mapToInt(command -> command.getSubCommands().size()).sum(); int subCommands = categoryCommands.stream().mapToInt(command -> command.getSubCommands().size()).sum();
// event.editMessageEmbeds(EmbedUtils.genericEmbed() event.editMessageEmbeds(EmbedUtils.genericEmbed()
// .setAuthor("%s Category".formatted(category.getName())) .setAuthor("%s Category".formatted(category.getName()))
// .setDescription("%s command%s (with %s sub-command%s)\n\n**Commands:**\n%s".formatted( .setDescription("%s command%s (with %s sub-command%s)\n\n**Commands:**\n%s".formatted(
// categoryCommands.size(), categoryCommands.size(),
// categoryCommands.size() == 1 ? "" : "s", categoryCommands.size() == 1 ? "" : "s",
// subCommands, subCommands,
// subCommands == 1 ? "" : "s", subCommands == 1 ? "" : "s",
// commands.toString() commands.toString()
// )).build()).queue(); )).build()).queue();
} }
/** /**

@ -2,6 +2,7 @@ package cc.fascinated.bat.features.base.commands.general;
import cc.fascinated.bat.Consts; import cc.fascinated.bat.Consts;
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.EmbedUtils; import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatGuild;
@ -16,7 +17,7 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "invite", description = "Invite the bot to your server!", guildOnly = false) @CommandInfo(name = "invite", description = "Invite the bot to your server!", guildOnly = false, category = Category.GENERAL)
public class InviteCommand extends BatCommand { public class InviteCommand extends BatCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.base.commands.discord; package cc.fascinated.bat.features.base.commands.general;
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;
@ -22,7 +23,7 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "lookupuser", description = "Lookup a user", userInstall = true) @CommandInfo(name = "lookupuser", description = "Lookup a user", userInstall = true, category = Category.GENERAL)
public class LookupUserCommand extends BatCommand { public class LookupUserCommand extends BatCommand {
public LookupUserCommand() { public LookupUserCommand() {
super.addOptions(new OptionData(OptionType.STRING, "id", "The id of the user", true)); super.addOptions(new OptionData(OptionType.STRING, "id", "The id of the user", true));

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.base.commands.general; package cc.fascinated.bat.features.base.commands.general;
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.model.BatGuild; import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser; import cc.fascinated.bat.model.BatUser;
@ -15,7 +16,7 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "ping", description = "Gets the ping of the bot", guildOnly = false, userInstall = true) @CommandInfo(name = "ping", description = "Gets the ping of the bot", guildOnly = false, userInstall = true, category = Category.GENERAL)
public class PingCommand extends BatCommand { public class PingCommand extends BatCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.base.commands.general; package cc.fascinated.bat.features.base.commands.general;
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;
@ -16,7 +17,7 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "vote", description = "Vote for the bot", guildOnly = false) @CommandInfo(name = "vote", description = "Vote for the bot", guildOnly = false, category = Category.GENERAL)
public class VoteCommand extends BatCommand { public class VoteCommand extends BatCommand {
private static final String[] VOTE_LINKS = new String[]{ private static final String[] VOTE_LINKS = new String[]{
"https://top.gg/bot/1254161119975833652/vote", "https://top.gg/bot/1254161119975833652/vote",

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.base.commands.general.avatar; package cc.fascinated.bat.features.base.commands.general.avatar;
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;
@ -11,7 +12,7 @@ import org.springframework.stereotype.Component;
* @author Nick (okNick) * @author Nick (okNick)
*/ */
@Component @Component
@CommandInfo(name = "avatar", description = "View the avatar of the guild or a user", guildOnly = false) @CommandInfo(name = "avatar", description = "View the avatar of the guild or a user", guildOnly = false, category = Category.GENERAL)
public class AvatarCommand extends BatCommand { public class AvatarCommand extends BatCommand {
@Autowired @Autowired
public AvatarCommand(@NonNull ApplicationContext context) { public AvatarCommand(@NonNull ApplicationContext context) {

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.base.commands.general.avatar; package cc.fascinated.bat.features.base.commands.general.avatar;
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.EmbedUtils; import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatGuild;
@ -16,7 +17,7 @@ import org.springframework.stereotype.Component;
* @author Nick (okNick) * @author Nick (okNick)
*/ */
@Component("avatar:guild.sub") @Component("avatar:guild.sub")
@CommandInfo(name = "guild", description = "View the avatar of the guild") @CommandInfo(name = "guild", description = "View the avatar of the guild", category = Category.GENERAL)
public class GuildSubCommand extends BatCommand { public class GuildSubCommand extends BatCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.base.commands.general.avatar; package cc.fascinated.bat.features.base.commands.general.avatar;
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.EmbedUtils; import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatGuild;
@ -19,7 +20,7 @@ import org.springframework.stereotype.Component;
* @author Nick (okNick) * @author Nick (okNick)
*/ */
@Component("avatar:user.sub") @Component("avatar:user.sub")
@CommandInfo(name = "user", description = "View the avatar of a user", guildOnly = false) @CommandInfo(name = "user", description = "View the avatar of a user", guildOnly = false, category = Category.GENERAL)
public class UserSubCommand extends BatCommand { public class UserSubCommand extends BatCommand {
public UserSubCommand() { public UserSubCommand() {
super.addOptions(new OptionData(OptionType.USER, "user", "The user to view the avatar of", true)); super.addOptions(new OptionData(OptionType.USER, "user", "The user to view the avatar of", true));

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.base.commands.general.banner; package cc.fascinated.bat.features.base.commands.general.banner;
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;
@ -11,7 +12,7 @@ import org.springframework.stereotype.Component;
* @author Nick (okNick) * @author Nick (okNick)
*/ */
@Component @Component
@CommandInfo(name = "banner", description = "View the banner of the guild or a user", guildOnly = false) @CommandInfo(name = "banner", description = "View the banner of the guild or a user", guildOnly = false, category = Category.GENERAL)
public class BannerCommand extends BatCommand { public class BannerCommand extends BatCommand {
@Autowired @Autowired
public BannerCommand(@NonNull ApplicationContext context) { public BannerCommand(@NonNull ApplicationContext context) {

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.base.commands.general.banner; package cc.fascinated.bat.features.base.commands.general.banner;
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.EmbedUtils; import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatGuild;
@ -16,7 +17,7 @@ import org.springframework.stereotype.Component;
* @author Nick (okNick) * @author Nick (okNick)
*/ */
@Component("banner:guild.sub") @Component("banner:guild.sub")
@CommandInfo(name = "guild", description = "View the banner of the guild") @CommandInfo(name = "guild", description = "View the banner of the guild", category = Category.GENERAL)
public class GuildSubCommand extends BatCommand { public class GuildSubCommand extends BatCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.base.commands.general.banner; package cc.fascinated.bat.features.base.commands.general.banner;
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.EmbedUtils; import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatGuild;
@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
* @author Nick (okNick) * @author Nick (okNick)
*/ */
@Component("banner:user.sub") @Component("banner:user.sub")
@CommandInfo(name = "user", description = "View the banner of a user", guildOnly = false) @CommandInfo(name = "user", description = "View the banner of a user", guildOnly = false, category = Category.GENERAL)
public class UserSubCommand extends BatCommand { public class UserSubCommand extends BatCommand {
public UserSubCommand() { public UserSubCommand() {
super.addOptions(new OptionData(OptionType.USER, "user", "The user to view the banner of", true)); super.addOptions(new OptionData(OptionType.USER, "user", "The user to view the banner of", true));

@ -23,7 +23,7 @@ public class BirthdayFeature extends Feature implements EventListener {
private final GuildService guildService; private final GuildService guildService;
public BirthdayFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService, @NonNull GuildService guildService) { public BirthdayFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService, @NonNull GuildService guildService) {
super("Birthday", true, Category.UTILITY); super("Birthday", true);
this.guildService = guildService; this.guildService = guildService;
registerCommand(commandService, context.getBean(BirthdayCommand.class)); registerCommand(commandService, context.getBean(BirthdayCommand.class));

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.birthday.command; package cc.fascinated.bat.features.birthday.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.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -11,7 +12,7 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "birthday", description = "Modify your birthday settings.") @CommandInfo(name = "birthday", description = "Modify your birthday settings.", category = Category.UTILITY)
public class BirthdayCommand extends BatCommand { public class BirthdayCommand extends BatCommand {
@Autowired @Autowired
public BirthdayCommand(@NonNull ApplicationContext context) { public BirthdayCommand(@NonNull ApplicationContext context) {

@ -16,7 +16,7 @@ import org.springframework.stereotype.Component;
public class DragFeature extends Feature { public class DragFeature extends Feature {
@Autowired @Autowired
public DragFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) { public DragFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("Drag", true,Category.GENERAL); super("Drag", true);
super.registerCommand(commandService, context.getBean(DragCommand.class)); super.registerCommand(commandService, context.getBean(DragCommand.class));
} }

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.drag.command; package cc.fascinated.bat.features.drag.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.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -11,7 +12,7 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "drag", description = "Drag command") @CommandInfo(name = "drag", description = "Drag command", category = Category.GENERAL)
public class DragCommand extends BatCommand { public class DragCommand extends BatCommand {
@Autowired @Autowired
public DragCommand(@NonNull ApplicationContext context) { public DragCommand(@NonNull ApplicationContext context) {

@ -21,7 +21,7 @@ import org.springframework.stereotype.Component;
public class LogFeature extends Feature { public class LogFeature extends Feature {
@Autowired @Autowired
public LogFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) { public LogFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("Logging", false, Category.LOGS); super("Logging", true);
super.registerCommand(commandService, context.getBean(LogsCommand.class)); super.registerCommand(commandService, context.getBean(LogsCommand.class));
} }

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.logging.command; package cc.fascinated.bat.features.logging.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 net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.Permission;
@ -12,7 +13,7 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "logs", description = "Edit logging settings", requiredPermissions = Permission.MANAGE_SERVER) @CommandInfo(name = "logs", description = "Edit logging settings", requiredPermissions = Permission.MANAGE_SERVER, category = Category.SERVER)
public class LogsCommand extends BatCommand { public class LogsCommand extends BatCommand {
@Autowired @Autowired
public LogsCommand(@NonNull ApplicationContext context) { public LogsCommand(@NonNull ApplicationContext context) {

@ -30,7 +30,7 @@ public class MessageSnipeFeature extends Feature implements EventListener {
@Autowired @Autowired
public MessageSnipeFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) { public MessageSnipeFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("Message Snipe", false, Category.MESSAGES); super("Message Snipe", false);
super.registerCommand(commandService, context.getBean(MessageSnipeCommand.class)); super.registerCommand(commandService, context.getBean(MessageSnipeCommand.class));
} }

@ -16,7 +16,7 @@ import org.springframework.stereotype.Component;
public class ModerationFeature extends Feature { public class ModerationFeature extends Feature {
@Autowired @Autowired
public ModerationFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) { public ModerationFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("Moderation", true,Category.MODERATION); super("Moderation", true);
super.registerCommand(commandService, context.getBean(PurgeCommand.class)); super.registerCommand(commandService, context.getBean(PurgeCommand.class));
} }

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.moderation.command; package cc.fascinated.bat.features.moderation.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 cc.fascinated.bat.common.EmbedUtils; import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatGuild;
@ -24,7 +25,7 @@ import java.util.concurrent.TimeUnit;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "purge", description = "Purge messages from a channel", requiredPermissions = Permission.MESSAGE_MANAGE) @CommandInfo(name = "purge", description = "Purge messages from a channel", requiredPermissions = Permission.MESSAGE_MANAGE, category = Category.MODERATION)
public class PurgeCommand extends BatCommand { public class PurgeCommand extends BatCommand {
private final long MESSAGE_DELETE_DELAY = TimeUnit.SECONDS.toMillis(10); private final long MESSAGE_DELETE_DELAY = TimeUnit.SECONDS.toMillis(10);

@ -18,7 +18,7 @@ public class NameHistoryFeature extends Feature {
@Autowired @Autowired
public NameHistoryFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) { public NameHistoryFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("Name History", true,Category.UTILITY); super("Name History", true);
super.registerCommand(commandService, context.getBean(NameHistoryCommand.class)); super.registerCommand(commandService, context.getBean(NameHistoryCommand.class));
} }

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.namehistory.command; package cc.fascinated.bat.features.namehistory.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.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -11,7 +12,7 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "namehistory", description = "View the name history of a user") @CommandInfo(name = "namehistory", description = "View the name history of a user", category = Category.GENERAL)
public class NameHistoryCommand extends BatCommand { public class NameHistoryCommand extends BatCommand {
@Autowired @Autowired
public NameHistoryCommand(@NonNull ApplicationContext context) { public NameHistoryCommand(@NonNull ApplicationContext context) {

@ -87,7 +87,7 @@ public class NameHistoryProfile extends Serializable {
this.nameHistory = new HashMap<>(); this.nameHistory = new HashMap<>();
for (String key : document.keySet()) { for (String key : document.keySet()) {
List<TrackedName> trackedNames = new LinkedList<>(); List<TrackedName> trackedNames = new LinkedList<>();
for (Document trackedNameDocument : (List<Document>) document.get(key)) { for (Document trackedNameDocument : document.getList(key, Document.class)) {
TrackedName trackedName = new TrackedName(); TrackedName trackedName = new TrackedName();
trackedName.load(trackedNameDocument, gson); trackedName.load(trackedNameDocument, gson);
trackedNames.add(trackedName); trackedNames.add(trackedName);

@ -37,7 +37,7 @@ public class ReminderFeature extends Feature {
@Autowired @Autowired
public ReminderFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService, @NonNull GuildService guildService) { public ReminderFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService, @NonNull GuildService guildService) {
super("Reminder", true, Category.GENERAL); super("Reminder", true);
this.guildService = guildService; this.guildService = guildService;
super.registerCommand(commandService, context.getBean(ReminderCommand.class)); super.registerCommand(commandService, context.getBean(ReminderCommand.class));

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.reminder.command; package cc.fascinated.bat.features.reminder.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.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -11,7 +12,7 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "reminder", description = "Set or view reminders.") @CommandInfo(name = "reminder", description = "Set or view reminders.", category = Category.UTILITY)
public class ReminderCommand extends BatCommand { public class ReminderCommand extends BatCommand {
@Autowired @Autowired
public ReminderCommand(@NonNull ApplicationContext context) { public ReminderCommand(@NonNull ApplicationContext context) {

@ -26,7 +26,7 @@ import org.springframework.stereotype.Component;
public class ScoreSaberFeature extends Feature { public class ScoreSaberFeature extends Feature {
@Autowired @Autowired
public ScoreSaberFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) { public ScoreSaberFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("ScoreSaber", true, Category.BEAT_SABER); super("ScoreSaber", true);
registerCommand(commandService, context.getBean(ScoreSaberCommand.class)); registerCommand(commandService, context.getBean(ScoreSaberCommand.class));
registerCommand(commandService, context.getBean(UserFeedCommand.class)); registerCommand(commandService, context.getBean(UserFeedCommand.class));

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.scoresaber.command.numberone; package cc.fascinated.bat.features.scoresaber.command.numberone;
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;
@ -11,7 +12,7 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component("scoresaber-number-one-feed") @Component("scoresaber-number-one-feed")
@CommandInfo(name = "scoresaber-number-one-feed", description = "Modifies the settings for the feed.", requiredPermissions = Permission.MANAGE_SERVER) @CommandInfo(name = "scoresaber-number-one-feed", description = "Modifies the settings for the feed.", requiredPermissions = Permission.MANAGE_SERVER, category = Category.BEAT_SABER)
public class NumberOneFeedCommand extends BatCommand { public class NumberOneFeedCommand extends BatCommand {
public NumberOneFeedCommand(@NonNull ApplicationContext context) { public NumberOneFeedCommand(@NonNull ApplicationContext context) {
super.addSubCommands( super.addSubCommands(

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.scoresaber.command.scoresaber; package cc.fascinated.bat.features.scoresaber.command.scoresaber;
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.Colors; import cc.fascinated.bat.common.Colors;
import cc.fascinated.bat.common.DateUtils; import cc.fascinated.bat.common.DateUtils;
@ -27,7 +28,7 @@ import java.time.LocalDateTime;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "scoresaber", description = "General ScoreSaber commands", guildOnly = false, userInstall = true) @CommandInfo(name = "scoresaber", description = "General ScoreSaber commands", guildOnly = false, userInstall = true, category = Category.BEAT_SABER)
public class ScoreSaberCommand extends BatCommand { public class ScoreSaberCommand extends BatCommand {
private final ScoreSaberService scoreSaberService; private final ScoreSaberService scoreSaberService;

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.scoresaber.command.userfeed; package cc.fascinated.bat.features.scoresaber.command.userfeed;
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;
@ -11,13 +12,13 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component("scoresaber-user-feed.command") @Component("scoresaber-user-feed.command")
@CommandInfo(name = "scoresaber-user-feed", description = "Modifies the settings for the feed.", requiredPermissions = Permission.MANAGE_CHANNEL) @CommandInfo(name = "scoresaber-user-feed", description = "Modifies the settings for the feed.", requiredPermissions = Permission.MANAGE_CHANNEL, category = Category.BEAT_SABER)
public class UserFeedCommand extends BatCommand { public class UserFeedCommand extends BatCommand {
public UserFeedCommand(@NonNull ApplicationContext context) { public UserFeedCommand(@NonNull ApplicationContext context) {
super.addSubCommands( super.addSubCommands(
context.getBean(UserSubCommand.class), context.getBean(UserSubCommand.class),
context.getBean(ChannelSubCommand.class), context.getBean(ChannelSubCommand.class),
context.getBean(ResetSubCommand.class context.getBean(ResetSubCommand.class
)); ));
} }
} }

@ -29,7 +29,7 @@ import se.michaelthelin.spotify.model_objects.specification.Track;
public class SpotifyFeature extends Feature { public class SpotifyFeature extends Feature {
@Autowired @Autowired
public SpotifyFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) { public SpotifyFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("Spotify", true, Category.MUSIC); super("Spotify", true);
super.registerCommand(commandService, context.getBean(SpotifyCommand.class)); super.registerCommand(commandService, context.getBean(SpotifyCommand.class));
} }

@ -12,7 +12,7 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "spotify", description = "Change your Spotify settings", guildOnly = false, userInstall = true, category = Category.MUSIC) @CommandInfo(name = "spotify", description = "Change your Spotify settings", guildOnly = false, userInstall = true, category = Category.MEDIA)
public class SpotifyCommand extends BatCommand { public class SpotifyCommand extends BatCommand {
@Autowired @Autowired
public SpotifyCommand(@NonNull ApplicationContext context) { public SpotifyCommand(@NonNull ApplicationContext context) {

@ -24,7 +24,7 @@ import java.util.List;
public class TMDBFeature extends Feature { public class TMDBFeature extends Feature {
@Autowired @Autowired
public TMDBFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) { public TMDBFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("TMDB", true, Category.MOVIES_TV); super("TMDB", true);
super.registerCommand(commandService, context.getBean(TMDBCommand.class)); super.registerCommand(commandService, context.getBean(TMDBCommand.class));
} }

@ -12,7 +12,7 @@ import org.springframework.stereotype.Component;
* @author Nick (okNick) * @author Nick (okNick)
*/ */
@Component @Component
@CommandInfo(name = "tmdb", description = "Get information about movies and TV shows", guildOnly = false, userInstall = true, category = Category.MOVIES_TV) @CommandInfo(name = "tmdb", description = "Get information about movies and TV shows", guildOnly = false, userInstall = true, category = Category.MEDIA)
public class TMDBCommand extends BatCommand { public class TMDBCommand extends BatCommand {
@Autowired @Autowired
public TMDBCommand(@NonNull ApplicationContext context) { public TMDBCommand(@NonNull ApplicationContext context) {

@ -16,7 +16,7 @@ import org.springframework.stereotype.Component;
public class WelcomerFeature extends Feature { public class WelcomerFeature extends Feature {
@Autowired @Autowired
public WelcomerFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) { public WelcomerFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("Welcomer", true,Category.SERVER); super("Welcomer", true);
super.registerCommand(commandService, context.getBean(WelcomerCommand.class)); super.registerCommand(commandService, context.getBean(WelcomerCommand.class));
} }

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.welcomer.command; package cc.fascinated.bat.features.welcomer.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 net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.Permission;
@ -12,7 +13,7 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "welcomer", description = "Configure the welcomer on your server", requiredPermissions = Permission.MANAGE_SERVER) @CommandInfo(name = "welcomer", description = "Configure the welcomer on your server", requiredPermissions = Permission.MANAGE_SERVER, category = Category.SERVER)
public class WelcomerCommand extends BatCommand { public class WelcomerCommand extends BatCommand {
@Autowired @Autowired
public WelcomerCommand(@NonNull ApplicationContext context) { public WelcomerCommand(@NonNull ApplicationContext context) {