Skip to content

Commit

Permalink
Created the Help Command
Browse files Browse the repository at this point in the history
  • Loading branch information
beanbeanjuice committed Jul 3, 2024
1 parent dbb077f commit 8137f01
Show file tree
Hide file tree
Showing 78 changed files with 769 additions and 51 deletions.
9 changes: 8 additions & 1 deletion src/main/java/com/beanbeanjuice/cafebot/CafeBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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();
}

Expand All @@ -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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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];
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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];
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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];
Expand Down
Loading

0 comments on commit 8137f01

Please sign in to comment.