diff --git a/src/main/java/com/beanbeanjuice/cafebot/CafeBot.java b/src/main/java/com/beanbeanjuice/cafebot/CafeBot.java index daaadcce..7c6b410d 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/CafeBot.java +++ b/src/main/java/com/beanbeanjuice/cafebot/CafeBot.java @@ -28,6 +28,8 @@ import com.beanbeanjuice.cafeapi.wrapper.CafeAPI; import com.beanbeanjuice.cafeapi.wrapper.requests.RequestLocation; import com.beanbeanjuice.cafebot.utility.sections.cafe.MenuHandler; +import com.beanbeanjuice.cafebot.utility.sections.generic.HelpHandler; +import com.beanbeanjuice.cafebot.utility.sections.generic.HelpListener; import com.sun.management.OperatingSystemMXBean; import lombok.Getter; import net.dv8tion.jda.api.EmbedBuilder; @@ -71,6 +73,7 @@ public class CafeBot { // Handlers private CommandHandler commandHandler; @Getter private MenuHandler menuHandler; + @Getter private HelpHandler helpHandler; // Additional Items @Getter private int commandsRun = 0; @@ -124,6 +127,7 @@ public CafeBot() throws InterruptedException { logger.log(CafeBot.class, LogLevel.INFO, "Adding commands..."); setupCommands(); this.menuHandler = new MenuHandler(this); + setupListeners(); this.JDA.getGuilds(); @@ -156,6 +160,7 @@ private void setupCommands() { new FeatureCommand(this), new DefineCommand(this), new GenerateCode(this), + new HelpCommand(this), new PingCommand(this), new InfoCommand(this), new StatsCommand(this), @@ -232,13 +237,15 @@ private void setupCommands() { ); this.JDA.addEventListener(commandHandler); + this.helpHandler = new HelpHandler(commandHandler); } private void setupListeners() { this.JDA.addEventListener( new BotAddListener(this), new BotRemoveListener(this), - new CountingListener(this) + new CountingListener(this), + new HelpListener(commandHandler, helpHandler) ); } diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/cafe/BalanceCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/cafe/BalanceCommand.java index d6e56ce6..b6962489 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/cafe/BalanceCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/cafe/BalanceCommand.java @@ -4,6 +4,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.cafe.CafeUsersEndpoint; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.EmbedBuilder; @@ -62,6 +63,11 @@ public String getDescription() { return "Get your balance!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.CAFE; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/cafe/DonateCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/cafe/DonateCommand.java index d9563e25..4a098585 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/cafe/DonateCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/cafe/DonateCommand.java @@ -6,6 +6,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.cafe.CafeUsersEndpoint; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import com.beanbeanjuice.cafebot.utility.logging.LogLevel; @@ -171,6 +172,11 @@ public String getDescription() { return "Donate your beanCoins to another user!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.CAFE; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/cafe/MenuCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/cafe/MenuCommand.java index 493459a0..4d0c2484 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/cafe/MenuCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/cafe/MenuCommand.java @@ -2,17 +2,11 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; -import com.beanbeanjuice.cafebot.utility.sections.cafe.CafeCategory; -import com.beanbeanjuice.cafebot.utility.sections.cafe.MenuListener; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; -import net.dv8tion.jda.api.interactions.commands.build.OptionData; import net.dv8tion.jda.api.interactions.components.ActionRow; -import net.dv8tion.jda.api.interactions.components.buttons.Button; -import net.dv8tion.jda.api.interactions.components.selections.StringSelectMenu; - -import java.util.Arrays; public class MenuCommand extends Command implements ICommand { @@ -22,15 +16,9 @@ public MenuCommand(final CafeBot cafeBot) { @Override public void handle(SlashCommandInteractionEvent event) { -// Button leftButton = Button.primary("left", "⬅️"); -// Button rightButton = Button.primary("right", "➡️"); - event.getHook() .sendMessageEmbeds(cafeBot.getMenuHandler().getAllMenuEmbed()) - .addComponents( - ActionRow.of(cafeBot.getMenuHandler().getAllStringSelectMenu()) -// ActionRow.of(leftButton, rightButton) - ) + .addComponents(ActionRow.of(cafeBot.getMenuHandler().getAllStringSelectMenu())) .queue(); } @@ -44,6 +32,11 @@ public String getDescription() { return "Hungry? Check the menu out!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.CAFE; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/cafe/ServeCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/cafe/ServeCommand.java index 83c07041..663ebbbf 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/cafe/ServeCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/cafe/ServeCommand.java @@ -5,6 +5,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.words.Word; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.Permission; @@ -122,6 +123,11 @@ public String getDescription() { return "Serve some words to customers to earn some bC (beanCoins)!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.CAFE; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/fun/AvatarCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/fun/AvatarCommand.java index 542d8831..05669eed 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/fun/AvatarCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/fun/AvatarCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.EmbedBuilder; @@ -76,6 +77,11 @@ public String getDescription() { return "Get someone's avatar!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.FUN; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/fun/BannerCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/fun/BannerCommand.java index 58473692..29e1a44e 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/fun/BannerCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/fun/BannerCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.EmbedBuilder; @@ -61,6 +62,11 @@ public String getDescription() { return "Get someone's banner!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.FUN; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/fun/EightBallCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/fun/EightBallCommand.java index b301cada..b0be1802 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/fun/EightBallCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/fun/EightBallCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.EmbedBuilder; @@ -66,6 +67,11 @@ public String getDescription() { return "Ask me a question!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.FUN; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/fun/JokeCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/fun/JokeCommand.java index 7c57f933..d1d84e51 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/fun/JokeCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/fun/JokeCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.api.RedditAPIWrapper; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.Permission; @@ -41,6 +42,11 @@ public String getDescription() { return "Get a random joke!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.FUN; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/fun/birthday/BirthdayCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/fun/birthday/BirthdayCommand.java index 1053bba5..d02fcb73 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/fun/birthday/BirthdayCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/fun/birthday/BirthdayCommand.java @@ -1,10 +1,7 @@ package com.beanbeanjuice.cafebot.commands.fun.birthday; import com.beanbeanjuice.cafebot.CafeBot; -import com.beanbeanjuice.cafebot.utility.commands.Command; -import com.beanbeanjuice.cafebot.utility.commands.ICommand; -import com.beanbeanjuice.cafebot.utility.commands.ISubCommand; -import com.beanbeanjuice.cafebot.utility.commands.SubCommandGroup; +import com.beanbeanjuice.cafebot.utility.commands.*; import net.dv8tion.jda.api.Permission; public class BirthdayCommand extends Command implements ICommand { @@ -23,6 +20,11 @@ public String getDescription() { return "Get someone's birthday or change your own!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.FUN; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/fun/counting/CountingCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/fun/counting/CountingCommand.java index 9a926474..200f666a 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/fun/counting/CountingCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/fun/counting/CountingCommand.java @@ -1,10 +1,7 @@ package com.beanbeanjuice.cafebot.commands.fun.counting; import com.beanbeanjuice.cafebot.CafeBot; -import com.beanbeanjuice.cafebot.utility.commands.Command; -import com.beanbeanjuice.cafebot.utility.commands.ICommand; -import com.beanbeanjuice.cafebot.utility.commands.ISubCommand; -import com.beanbeanjuice.cafebot.utility.commands.SubCommandGroup; +import com.beanbeanjuice.cafebot.utility.commands.*; import net.dv8tion.jda.api.Permission; public class CountingCommand extends Command implements ICommand { @@ -23,6 +20,11 @@ public String getDescription() { return "This command has everything to do with counting and stuff!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.FUN; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/fun/meme/MemeCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/fun/meme/MemeCommand.java index 9123c408..4d499ac0 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/fun/meme/MemeCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/fun/meme/MemeCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.commands.ISubCommand; import net.dv8tion.jda.api.Permission; @@ -22,6 +23,11 @@ public String getDescription() { return "Get a meme from a specified subreddit!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.FUN; + } + @Override public ISubCommand[] getSubCommands() { return new ISubCommand[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/fun/rate/RateCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/fun/rate/RateCommand.java index 0ff51da0..66ba0bff 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/fun/rate/RateCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/fun/rate/RateCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.commands.ISubCommand; import net.dv8tion.jda.api.Permission; @@ -22,6 +23,11 @@ public String getDescription() { return "Rate something!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.FUN; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/games/CoinFlipCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/games/CoinFlipCommand.java index efbe1ccc..842c3239 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/games/CoinFlipCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/games/CoinFlipCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.Permission; @@ -30,6 +31,11 @@ public String getDescription() { return "Flip a coin!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.GAME; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/games/DiceRollCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/games/DiceRollCommand.java index 909d17d9..ef7b72fc 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/games/DiceRollCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/games/DiceRollCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.Permission; @@ -36,6 +37,11 @@ public String getDescription() { return "Roll a pair of dice!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.GAME; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/games/game/GameCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/games/game/GameCommand.java index 0b580ffc..e0743de6 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/games/game/GameCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/games/game/GameCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.commands.ISubCommand; import net.dv8tion.jda.api.Permission; @@ -22,6 +23,11 @@ public String getDescription() { return "Something to do with games!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.GAME; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/BotDonateCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/BotDonateCommand.java index 7aacf6f5..739e1b5b 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/BotDonateCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/BotDonateCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.Permission; @@ -37,6 +38,11 @@ public String getDescription() { return "Donate to keep the bot up!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.GENERIC; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/BotInviteCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/BotInviteCommand.java index 9cf29e60..69a8f08a 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/BotInviteCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/BotInviteCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.emoji.Emoji; @@ -37,6 +38,11 @@ public String getDescription() { return "Want to invite this bot to a server? Use this command!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.GENERIC; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/BotUpvoteCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/BotUpvoteCommand.java index 39db08ed..fbc4f9d9 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/BotUpvoteCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/BotUpvoteCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.Permission; @@ -51,6 +52,11 @@ public String getDescription() { return "Upvote the bot!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.GENERIC; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/BugReportCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/BugReportCommand.java index 9c74503e..5263906d 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/BugReportCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/BugReportCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.emoji.Emoji; @@ -34,6 +35,11 @@ public String getDescription() { return "Discovered a bug with me?"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.GENERIC; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/DefineCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/DefineCommand.java index 903814fb..97c29bbb 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/DefineCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/DefineCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.api.dictionary.DictionaryAPIWrapper; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.Permission; @@ -16,7 +17,7 @@ public class DefineCommand extends Command implements ICommand { // TODO: Check if other languages actually work. - public DefineCommand(CafeBot cafeBot) { + public DefineCommand(final CafeBot cafeBot) { super(cafeBot); } @@ -49,6 +50,11 @@ public String getDescription() { return "Define something!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.GENERIC; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/FeatureCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/FeatureCommand.java index fb503032..1e844319 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/FeatureCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/FeatureCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.emoji.Emoji; @@ -34,6 +35,11 @@ public String getDescription() { return "Request a new feature for me!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.GENERIC; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/GenerateCode.java b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/GenerateCode.java index f749540b..a22a968f 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/GenerateCode.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/GenerateCode.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.Permission; @@ -46,6 +47,11 @@ public String getDescription() { return "Generate a random 32 character code!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.GENERIC; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/HelpCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/HelpCommand.java new file mode 100644 index 00000000..0869004d --- /dev/null +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/HelpCommand.java @@ -0,0 +1,60 @@ +package com.beanbeanjuice.cafebot.commands.generic; + +import com.beanbeanjuice.cafebot.CafeBot; +import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; +import com.beanbeanjuice.cafebot.utility.commands.ICommand; +import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; +import net.dv8tion.jda.api.interactions.components.ActionRow; + +public class HelpCommand extends Command implements ICommand { + + public HelpCommand(final CafeBot cafeBot) { + super(cafeBot); + } + + @Override + public void handle(SlashCommandInteractionEvent event) { + event.getHook() + .sendMessageEmbeds(cafeBot.getHelpHandler().getCategoriesEmbed()) + .addComponents(ActionRow.of(cafeBot.getHelpHandler().getAllCategoriesSelectMenu(0))) + .queue(); + } + + @Override + public String getName() { + return "help"; + } + + @Override + public String getDescription() { + return "Get help with some commands!"; + } + + @Override + public CommandCategory getCategory() { + return CommandCategory.GENERIC; + } + + @Override + public Permission[] getPermissions() { + return new Permission[0]; + } + + @Override + public boolean isEphemeral() { + return true; + } + + @Override + public boolean isNSFW() { + return false; + } + + @Override + public boolean allowDM() { + return true; + } + +} diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/InfoCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/InfoCommand.java index f402ac35..806b937e 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/InfoCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/InfoCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.EmbedBuilder; @@ -46,6 +47,11 @@ public String getDescription() { return "Get information about the bot!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.GENERIC; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/PingCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/PingCommand.java index b63029df..0c555b82 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/PingCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/PingCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import com.sun.management.OperatingSystemMXBean; @@ -83,6 +84,11 @@ public String getDescription() { return "Pong!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.GENERIC; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/RemoveMyDataCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/RemoveMyDataCommand.java index 8b241b7a..44b30786 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/RemoveMyDataCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/RemoveMyDataCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.Permission; @@ -36,6 +37,11 @@ public String getDescription() { return "Remove your data from this bot."; } + @Override + public CommandCategory getCategory() { + return CommandCategory.GENERIC; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/StatsCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/StatsCommand.java index 98766932..2c477a29 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/StatsCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/StatsCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.EmbedBuilder; @@ -42,6 +43,11 @@ public String getDescription() { return "Get statistics about the bot!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.GENERIC; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/SupportCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/SupportCommand.java index 76b13eb3..a5799346 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/SupportCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/SupportCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.Permission; @@ -36,6 +37,11 @@ public String getDescription() { return "Something wrong with me? Get some support!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.GENERIC; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/VersionCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/VersionCommand.java index 8303c642..da3c919f 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/VersionCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/VersionCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.api.GitHubVersionEndpointWrapper; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.Permission; @@ -54,6 +55,11 @@ public String getDescription() { return "Get release notes for the any of the previous versions!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.GENERIC; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/WhoCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/WhoCommand.java index 3fa77e3d..3360d9c7 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/generic/WhoCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/generic/WhoCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.EmbedBuilder; @@ -89,6 +90,11 @@ public String getDescription() { return "See stats about yourself or another user!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.GENERIC; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/AmazedCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/AmazedCommand.java index 6b580e78..c18ba791 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/AmazedCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/AmazedCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Be amazed at something or someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/AskCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/AskCommand.java index a16ac9ed..94f6b6c8 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/AskCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/AskCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Ask someone something!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/BiteCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/BiteCommand.java index a65216d5..c708cc03 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/BiteCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/BiteCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Bite someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/BlushCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/BlushCommand.java index 7fdfc598..a6c712d6 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/BlushCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/BlushCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Blush at someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/BonkCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/BonkCommand.java index b19c3ea1..e462a3d7 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/BonkCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/BonkCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Bonk someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/BoopCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/BoopCommand.java index 907255ab..874491a6 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/BoopCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/BoopCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Boop someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/CryCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/CryCommand.java index db411528..29483a4e 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/CryCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/CryCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Cry because of someone... :("; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/CuddleCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/CuddleCommand.java index c51ba4ab..b247e596 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/CuddleCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/CuddleCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Cuddle someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/DabCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/DabCommand.java index 4d1cf872..58a899b8 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/DabCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/DabCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Dab! Why?"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/DanceCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/DanceCommand.java index b239fa76..2b654bc7 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/DanceCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/DanceCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Dance with someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/DieCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/DieCommand.java index 192a74d1..fb2a29f9 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/DieCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/DieCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Die because of someone..."; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/GreetCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/GreetCommand.java index e96628f5..6ea02961 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/GreetCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/GreetCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Greet someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/HeadPatCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/HeadPatCommand.java index 8a3adf0f..e019db4d 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/HeadPatCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/HeadPatCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Headpat someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/HmphCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/HmphCommand.java index 6a722e56..4173852a 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/HmphCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/HmphCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Hmph at someone~"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/HugCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/HugCommand.java index 0a23241c..ca513245 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/HugCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/HugCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Hug someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/KissCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/KissCommand.java index bda4019c..e21f0b15 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/KissCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/KissCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Kiss someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/LickCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/LickCommand.java index 1f24065e..f9145c81 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/LickCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/LickCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Lick someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/LoveCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/LoveCommand.java index ab41aaf6..24500fb0 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/LoveCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/LoveCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Love someone!~ <3"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/NomCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/NomCommand.java index 779a45ce..f579e3fd 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/NomCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/NomCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Nom on someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/NoseBleedCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/NoseBleedCommand.java index 725fc4ea..49963b34 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/NoseBleedCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/NoseBleedCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Tell someone you caused them to have a nosebleed!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/OkCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/OkCommand.java index 1b75d02f..80d3bc4e 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/OkCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/OkCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Be \"ok\" with something."; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/PokeCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/PokeCommand.java index cdeb989b..42e0877d 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/PokeCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/PokeCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Poke someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/PoutCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/PoutCommand.java index 5acc4735..893a6436 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/PoutCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/PoutCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Pout at someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/PunchCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/PunchCommand.java index 98269b84..c190dbc6 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/PunchCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/PunchCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Punch someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/RageCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/RageCommand.java index 70f7125f..12ebb482 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/RageCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/RageCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Rage at someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/ShootCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/ShootCommand.java index 64175197..ac64cc45 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/ShootCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/ShootCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Shoot someone! 🔫"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/ShushCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/ShushCommand.java index 4a75ba1f..ddf343a8 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/ShushCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/ShushCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Shush someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/SlapCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/SlapCommand.java index 957c8ace..18e703cf 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/SlapCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/SlapCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -34,6 +35,11 @@ public String getDescription() { return "Slap someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/SleepCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/SleepCommand.java index eed931e7..a63d4adf 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/SleepCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/SleepCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Sleep with someone~"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/SmileCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/SmileCommand.java index cbc1918a..e845a030 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/SmileCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/SmileCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Smile at someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/StabCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/StabCommand.java index f9642fa1..f7be2071 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/StabCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/StabCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Stab someone."; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/StareCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/StareCommand.java index ba10435f..ea2e4609 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/StareCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/StareCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Stare at someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/ThrowCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/ThrowCommand.java index 418c6d7c..9f3427db 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/ThrowCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/ThrowCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Throw someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/TickleCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/TickleCommand.java index 34721306..af1a2697 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/TickleCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/TickleCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Tickle someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/UWUCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/UWUCommand.java index 49c52840..9db939c3 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/UWUCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/UWUCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "UWU at someone!~"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/WaveCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/WaveCommand.java index 3dcd57da..95a8147c 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/WaveCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/WaveCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Wave at someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/WinkCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/WinkCommand.java index 73936656..d60c269f 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/WinkCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/WinkCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Wink at someone! ;)"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/YellCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/YellCommand.java index 7f87e105..ee3b67e6 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/YellCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/YellCommand.java @@ -3,6 +3,7 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.interactions.InteractionType; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.sections.interactions.ICommandInteraction; import net.dv8tion.jda.api.Permission; @@ -31,6 +32,11 @@ public String getDescription() { return "Yell at someone!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + @Override public OptionData[] getOptions() { return new OptionData[] { diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/social/MemberCountCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/social/MemberCountCommand.java index 1fa5316a..33508d1a 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/social/MemberCountCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/social/MemberCountCommand.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.commands.Command; +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; import com.beanbeanjuice.cafebot.utility.commands.ICommand; import com.beanbeanjuice.cafebot.utility.helper.Helper; import net.dv8tion.jda.api.Permission; @@ -35,6 +36,11 @@ public String getDescription() { return "Get the member count for your server!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.SOCIAL; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/commands/social/vent/VentCommand.java b/src/main/java/com/beanbeanjuice/cafebot/commands/social/vent/VentCommand.java index a2c23a93..313cfefe 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/commands/social/vent/VentCommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/commands/social/vent/VentCommand.java @@ -1,10 +1,7 @@ package com.beanbeanjuice.cafebot.commands.social.vent; import com.beanbeanjuice.cafebot.CafeBot; -import com.beanbeanjuice.cafebot.utility.commands.Command; -import com.beanbeanjuice.cafebot.utility.commands.ICommand; -import com.beanbeanjuice.cafebot.utility.commands.ISubCommand; -import com.beanbeanjuice.cafebot.utility.commands.SubCommandGroup; +import com.beanbeanjuice.cafebot.utility.commands.*; import net.dv8tion.jda.api.Permission; public class VentCommand extends Command implements ICommand { @@ -23,6 +20,11 @@ public String getDescription() { return "Anything to do with anonymous venting!"; } + @Override + public CommandCategory getCategory() { + return CommandCategory.SOCIAL; + } + @Override public Permission[] getPermissions() { return new Permission[0]; diff --git a/src/main/java/com/beanbeanjuice/cafebot/utility/commands/CommandCategory.java b/src/main/java/com/beanbeanjuice/cafebot/utility/commands/CommandCategory.java new file mode 100644 index 00000000..0e4e61d7 --- /dev/null +++ b/src/main/java/com/beanbeanjuice/cafebot/utility/commands/CommandCategory.java @@ -0,0 +1,22 @@ +package com.beanbeanjuice.cafebot.utility.commands; + +import lombok.Getter; + +public enum CommandCategory { + + CAFE("Looking to order something?", "https://cdn.beanbeanjuice.com/images/cafeBot/category_type/cafe.jpg"), + FUN("Ooo! This looks fun!", "https://cdn.beanbeanjuice.com/images/cafeBot/category_type/fun.jpg"), + GAME("Bored huh?", "https://cdn.beanbeanjuice.com/images/cafeBot/category_type/games.png"), + GENERIC("Very basic...", "https://cdn.beanbeanjuice.com/images/cafeBot/category_type/generic.png"), + INTERACTION("Hugs, waves, slaps, and more!", "https://cdn.beanbeanjuice.com/images/cafeBot/category_type/interaction.png"), + SOCIAL("Hmm... I just need to let it out... you know?", "https://cdn.beanbeanjuice.com/images/cafeBot/category_type/social.gif"); + + @Getter private final String description; + @Getter private final String link; + + CommandCategory(final String description, final String link) { + this.description = description; + this.link = link; + } + +} diff --git a/src/main/java/com/beanbeanjuice/cafebot/utility/commands/CommandHandler.java b/src/main/java/com/beanbeanjuice/cafebot/utility/commands/CommandHandler.java index 993e8d50..dc60b439 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/utility/commands/CommandHandler.java +++ b/src/main/java/com/beanbeanjuice/cafebot/utility/commands/CommandHandler.java @@ -2,6 +2,7 @@ import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.logging.LogLevel; +import lombok.Getter; import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent; import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; import net.dv8tion.jda.api.hooks.ListenerAdapter; @@ -17,7 +18,7 @@ public class CommandHandler extends ListenerAdapter { private final CafeBot cafeBot; - private final HashMap commands; + @Getter private final HashMap commands; public CommandHandler(final CafeBot cafeBot) { this.cafeBot = cafeBot; @@ -229,4 +230,10 @@ private List getOptions(final ArrayList autoCompleteOptions, fin .toList(); } + public List getCommandsForCategory(final CommandCategory category) { + return commands.values().stream() + .filter((command) -> command.getCategory().equals(category)) + .toList(); + } + } diff --git a/src/main/java/com/beanbeanjuice/cafebot/utility/commands/ICommand.java b/src/main/java/com/beanbeanjuice/cafebot/utility/commands/ICommand.java index a38a4a66..fd0325f7 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/utility/commands/ICommand.java +++ b/src/main/java/com/beanbeanjuice/cafebot/utility/commands/ICommand.java @@ -16,27 +16,17 @@ public interface ICommand { String getName(); - /** - * @return The description for the actual command. - */ String getDescription(); - /** - * @return The available parameters for the actual command. - */ + CommandCategory getCategory(); + default OptionData[] getOptions() { return new OptionData[0]; } default HashMap> getAutoComplete() { return null; } Permission[] getPermissions(); - /** - * @return True if you should reply with a message only the user who ran the command can read. - */ boolean isEphemeral(); - /** - * @return True if the {@link ICommand} can only run in NSFW channels. - */ boolean isNSFW(); boolean allowDM(); diff --git a/src/main/java/com/beanbeanjuice/cafebot/utility/sections/cafe/MenuHandler.java b/src/main/java/com/beanbeanjuice/cafebot/utility/sections/cafe/MenuHandler.java index d38e130b..10ee9a2c 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/utility/sections/cafe/MenuHandler.java +++ b/src/main/java/com/beanbeanjuice/cafebot/utility/sections/cafe/MenuHandler.java @@ -9,9 +9,7 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.interactions.components.selections.EntitySelectMenu; -import net.dv8tion.jda.api.interactions.components.selections.SelectOption; import net.dv8tion.jda.api.interactions.components.selections.StringSelectMenu; -import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.util.ArrayList; @@ -161,21 +159,21 @@ private int convertItemToIndex(final String itemName) { } public StringSelectMenu getAllStringSelectMenu() { - StringSelectMenu.Builder builder = StringSelectMenu.create("menu:id"); + StringSelectMenu.Builder builder = StringSelectMenu.create("cafeBot:menu"); builder.addOption("All", "ALL"); Arrays.stream(CafeCategory.values()).forEach((category) -> builder.addOption(category.getTitle(), category.toString())); return builder.setPlaceholder("Choose Category").setMaxValues(1).setMinValues(1).build(); } public StringSelectMenu getItemStringSelectMenu(final CafeCategory category) { - StringSelectMenu.Builder builder = StringSelectMenu.create("menu-item:id"); + StringSelectMenu.Builder builder = StringSelectMenu.create("cafeBot:menu:item"); menu.get(category).forEach((item) -> builder.addOption(item.getName(), item.getName())); return builder.setPlaceholder("Choose Item").setMaxValues(1).setMinValues(1).build(); } public EntitySelectMenu getItemEntitySelectMenu(final String itemString) { int itemID = convertItemToIndex(itemString); - EntitySelectMenu.Builder builder = EntitySelectMenu.create("menu-entity:" + itemID, EntitySelectMenu.SelectTarget.USER); + EntitySelectMenu.Builder builder = EntitySelectMenu.create("cafeBot:menu:user:" + itemID, EntitySelectMenu.SelectTarget.USER); return builder.setPlaceholder("Select User to Order For").setMaxValues(1).build(); // TODO: Is there a way to select multiple users without firing the event? } diff --git a/src/main/java/com/beanbeanjuice/cafebot/utility/sections/cafe/MenuListener.java b/src/main/java/com/beanbeanjuice/cafebot/utility/sections/cafe/MenuListener.java index efaa74c9..0cd8bcb9 100644 --- a/src/main/java/com/beanbeanjuice/cafebot/utility/sections/cafe/MenuListener.java +++ b/src/main/java/com/beanbeanjuice/cafebot/utility/sections/cafe/MenuListener.java @@ -5,7 +5,6 @@ import com.beanbeanjuice.cafeapi.wrapper.endpoints.cafe.CafeUsersEndpoint; import com.beanbeanjuice.cafebot.CafeBot; import com.beanbeanjuice.cafebot.utility.helper.Helper; -import com.beanbeanjuice.cafebot.utility.logging.LogLevel; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.IMentionable; import net.dv8tion.jda.api.entities.MessageEmbed; @@ -30,13 +29,13 @@ public MenuListener(final CafeBot cafeBot) { @Override public void onStringSelectInteraction(StringSelectInteractionEvent event) { - if (event.getComponentId().equals("menu:id")) handleCategory(event); - if (event.getComponentId().equals("menu-item:id")) handleItem(event); + if (event.getComponentId().equals("cafeBot:menu")) handleCategory(event); + if (event.getComponentId().equals("cafeBot:menu:item")) handleItem(event); } @Override public void onEntitySelectInteraction(EntitySelectInteractionEvent event) { - if (event.getComponentId().startsWith("menu-entity:")) handlePurchase(event); + if (event.getComponentId().startsWith("cafeBot:menu:user:")) handlePurchase(event); } private void handleCategory(final StringSelectInteractionEvent event) { @@ -75,7 +74,7 @@ private void handleItem(final StringSelectInteractionEvent event) { } private void handlePurchase(final EntitySelectInteractionEvent event) { - int itemID = Integer.parseInt(event.getComponentId().split(":")[1]); + int itemID = Integer.parseInt(event.getComponentId().split(":")[3]); MenuItem item = cafeBot.getMenuHandler().getAllItems().get(itemID); User sender = event.getUser(); diff --git a/src/main/java/com/beanbeanjuice/cafebot/utility/sections/generic/HelpHandler.java b/src/main/java/com/beanbeanjuice/cafebot/utility/sections/generic/HelpHandler.java new file mode 100644 index 00000000..acc5da16 --- /dev/null +++ b/src/main/java/com/beanbeanjuice/cafebot/utility/sections/generic/HelpHandler.java @@ -0,0 +1,156 @@ +package com.beanbeanjuice.cafebot.utility.sections.generic; + +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; +import com.beanbeanjuice.cafebot.utility.commands.CommandHandler; +import com.beanbeanjuice.cafebot.utility.commands.ICommand; +import com.beanbeanjuice.cafebot.utility.helper.Helper; +import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.entities.MessageEmbed; +import net.dv8tion.jda.api.entities.emoji.Emoji; +import net.dv8tion.jda.api.interactions.commands.build.OptionData; +import net.dv8tion.jda.api.interactions.components.ActionRow; +import net.dv8tion.jda.api.interactions.components.buttons.Button; +import net.dv8tion.jda.api.interactions.components.selections.StringSelectMenu; + +import java.util.*; +import java.util.stream.Collectors; + +public class HelpHandler { + + private final CommandHandler commandHandler; + + public HelpHandler(final CommandHandler commandHandler) { + this.commandHandler = commandHandler; + } + + public MessageEmbed getCategoriesEmbed() { + String categoriesString = Arrays.stream(CommandCategory.values()).map((category) -> String.format( + """ + ### %d. %s + > *%s* + """, category.ordinal() + 1, category.name(), category.getDescription() + )).collect(Collectors.joining()); + + String description = String.format( + """ + # Command Categories + *Please select one of the categories below!* + + %s + """, categoriesString); + + return new EmbedBuilder() + .setDescription(description) + .setColor(Helper.getRandomColor()) + .setFooter("Use the tabs below to select the category!") + .build(); + } + + public MessageEmbed getCategoryEmbed(final CommandCategory category, final int index) { + int skipAmount = 25 * index; + String description = String.format("# Commands for %s", category.name()); + + EmbedBuilder embedBuilder = new EmbedBuilder(); + + commandHandler.getCommands().values() + .stream() + .filter(command -> command.getCategory() == category) + .sorted(Comparator.comparing(ICommand::getName)) + .skip(skipAmount) + .limit(25) + .forEach((command) -> { + embedBuilder.addField( + String.format("**/%s**", command.getName()), + String.format("> *%s*", command.getDescription()), + true + ); + }); + + return embedBuilder + .setDescription(description) + .setColor(Helper.getRandomColor()) + .setFooter("Select a command below!") + .setThumbnail(category.getLink()) + .build(); + } + + public MessageEmbed getCommandEmbed(final String commandName) { + ICommand command = commandHandler.getCommands().get(commandName); + + String subCommandsString = Arrays.stream(command.getSubCommands()).map((subCommand) -> { + return String.format( + """ + `%s %s` + > %s + + """, subCommand.getName(), this.getOptionsString(subCommand.getOptions()), subCommand.getDescription() + ); + }).collect(Collectors.joining("\n")); + subCommandsString = (subCommandsString.isBlank()) ? "*None*" : subCommandsString; + + String optionsString = this.getOptionsString(command.getOptions()); + optionsString = (optionsString.isBlank()) ? "*None*" : optionsString; + + String commandString = String.format( + """ + # /%s + > *%s* + + ### Arguments + %s + ### Subcommands + %s + """, + command.getName(), + command.getDescription(), + optionsString, + subCommandsString + ); + + return new EmbedBuilder() + .setDescription(commandString) + .setColor(Helper.getRandomColor()) + .build(); + } + + public String getOptionsString(final OptionData[] options) { + return Arrays.stream(options).map((option) -> { + String requiredString = (option.isRequired()) ? "REQUIRED" : "OPTIONAL"; + return String.format( + """ + <%s:%s:%s> + """, option.getName(), option.getType().name(), requiredString); + }).collect(Collectors.joining(" ")); + } + + public StringSelectMenu getAllCategoriesSelectMenu(int index) { + StringSelectMenu.Builder builder = StringSelectMenu.create("cafeBot:help:" + index); + builder.addOption("ALL", "ALL"); + Arrays.stream(CommandCategory.values()).forEach((category) -> builder.addOption(category.name(), category.toString())); + return builder.setPlaceholder("Choose Category").setMaxValues(1).setMinValues(1).build(); + } + + public StringSelectMenu getCommandSelectionMenu(final CommandCategory category, final int index) { + int skipAmount = 25 * index; + StringSelectMenu.Builder builder = StringSelectMenu.create("cafeBot:help:commands"); + + commandHandler.getCommandsForCategory(category) + .stream() + .sorted(Comparator.comparing(ICommand::getName)) + .skip(skipAmount) + .limit(25) + .forEach((item) -> builder.addOption("/" + item.getName(), item.getName())); + return builder.setPlaceholder("Choose Command").setMaxValues(1).setMinValues(1).build(); + } + + public ActionRow getCommandButtons(final int index, final int max, final CommandCategory category) { + Button left = Button.primary(String.format("cafeBot:help:button:left:%s:%d", category.name(), index), Emoji.fromFormatted("⬅️")); + Button right = Button.primary(String.format("cafeBot:help:button:right:%s:%d", category.name(), index), Emoji.fromFormatted("➡️")); + + if (index <= 0) left = left.asDisabled(); + if (index >= max) right = right.asDisabled(); + + return ActionRow.of(left, right); + } + +} diff --git a/src/main/java/com/beanbeanjuice/cafebot/utility/sections/generic/HelpListener.java b/src/main/java/com/beanbeanjuice/cafebot/utility/sections/generic/HelpListener.java new file mode 100644 index 00000000..f0af238a --- /dev/null +++ b/src/main/java/com/beanbeanjuice/cafebot/utility/sections/generic/HelpListener.java @@ -0,0 +1,90 @@ +package com.beanbeanjuice.cafebot.utility.sections.generic; + +import com.beanbeanjuice.cafebot.utility.commands.CommandCategory; +import com.beanbeanjuice.cafebot.utility.commands.CommandHandler; +import net.dv8tion.jda.api.entities.MessageEmbed; +import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent; +import net.dv8tion.jda.api.events.interaction.component.StringSelectInteractionEvent; +import net.dv8tion.jda.api.hooks.ListenerAdapter; +import net.dv8tion.jda.api.interactions.components.ActionRow; + +import java.util.ArrayList; +import java.util.List; + +public class HelpListener extends ListenerAdapter { + + private final CommandHandler commandHandler; + private final HelpHandler helpHandler; + + public HelpListener(final CommandHandler commandHandler, final HelpHandler helpHandler) { + this.commandHandler = commandHandler; + this.helpHandler = helpHandler; + } + + @Override + public void onStringSelectInteraction(StringSelectInteractionEvent event) { + if (event.getComponentId().equals("cafeBot:help:commands")) handleCommand(event); + else if (event.getComponentId().startsWith("cafeBot:help:")) handleCategories(event); + } + + @Override + public void onButtonInteraction(ButtonInteractionEvent event) { + if (!event.getComponentId().startsWith("cafeBot:help:button:")) return; + + String[] splitString = event.getComponentId().split(":"); + String direction = splitString[3]; + CommandCategory category = CommandCategory.valueOf(splitString[4]); + int index = Integer.parseInt(event.getComponentId().split(":")[5]); + index = direction.equals("left") ? index - 1 : index + 1; + + MessageEmbed categoryEmbed = helpHandler.getCategoryEmbed(category, index); + + List rows = new ArrayList<>(); + rows.add(ActionRow.of(helpHandler.getAllCategoriesSelectMenu(0))); + + int maxIndices = commandHandler.getCommandsForCategory(category).size() / 25; + rows.add(ActionRow.of(helpHandler.getCommandSelectionMenu(category, index))); + rows.add(helpHandler.getCommandButtons(index, maxIndices, category)); + + event.editMessageEmbeds(categoryEmbed) + .setComponents(rows) + .setReplace(true).queue(); + } + + private void handleCategories(final StringSelectInteractionEvent event) { + List values = event.getValues(); // the values the user selected + String value = values.getFirst(); + + int index = Integer.parseInt(event.getComponentId().split(":")[2]); + + boolean isHome = value.equalsIgnoreCase("all"); + MessageEmbed categoryEmbed = isHome ? helpHandler.getCategoriesEmbed() : helpHandler.getCategoryEmbed(CommandCategory.valueOf(value), 0); + + List rows = new ArrayList<>(); + rows.add(ActionRow.of(helpHandler.getAllCategoriesSelectMenu(0))); + + if (!isHome) { + CommandCategory category = CommandCategory.valueOf(value); + int maxIndices = commandHandler.getCommandsForCategory(category).size() / 25; + rows.add(ActionRow.of(helpHandler.getCommandSelectionMenu(category, index))); + rows.add(helpHandler.getCommandButtons(index, maxIndices, category)); + } + + event.editMessageEmbeds(categoryEmbed) + .setComponents(rows) + .setReplace(true).queue(); + } + + private void handleCommand(final StringSelectInteractionEvent event) { + List values = event.getValues(); // the values the user selected + String commandName = values.getFirst(); + + List rows = new ArrayList<>(); + rows.add(ActionRow.of(helpHandler.getAllCategoriesSelectMenu(0))); + + event.editMessageEmbeds(helpHandler.getCommandEmbed(commandName)) + .setComponents(rows) + .setReplace(true).queue(); + } + +}