From b76e88a626aae84a95dd7a0fb2d0c5aaaec55752 Mon Sep 17 00:00:00 2001 From: beanbeanjuice Date: Tue, 13 Aug 2024 01:38:17 -0400 Subject: [PATCH] Added the Hide Command --- .../com/beanbeanjuice/cafebot/CafeBot.java | 2 + .../commands/interaction/HideCommand.java | 88 +++++++++++++++++++ .../interactions/InteractionType.java | 3 +- 3 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 bot/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/HideCommand.java diff --git a/bot/src/main/java/com/beanbeanjuice/cafebot/CafeBot.java b/bot/src/main/java/com/beanbeanjuice/cafebot/CafeBot.java index 5705f503..5aaa21e1 100644 --- a/bot/src/main/java/com/beanbeanjuice/cafebot/CafeBot.java +++ b/bot/src/main/java/com/beanbeanjuice/cafebot/CafeBot.java @@ -104,6 +104,7 @@ public class CafeBot { @Getter private int commandsRun = 0; @Getter private final String discordAvatarUrl = "https://cdn.beanbeanjuice.com/images/cafeBot/cafeBot.gif"; + // TODO: Store mutual guilds in database. public CafeBot() throws InterruptedException { this.logger = new LogManager( this, @@ -225,6 +226,7 @@ private void setupCommands() { new DieCommand(this), new GreetCommand(this), new HeadPatCommand(this), + new HideCommand(this), new HmphCommand(this), new HugCommand(this), new KissCommand(this), diff --git a/bot/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/HideCommand.java b/bot/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/HideCommand.java new file mode 100644 index 00000000..f5c42cb8 --- /dev/null +++ b/bot/src/main/java/com/beanbeanjuice/cafebot/commands/interaction/HideCommand.java @@ -0,0 +1,88 @@ +package com.beanbeanjuice.cafebot.commands.interaction; + +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; +import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; +import net.dv8tion.jda.api.interactions.commands.OptionType; +import net.dv8tion.jda.api.interactions.commands.build.OptionData; + +public class HideCommand extends Command implements ICommand, ICommandInteraction { + + public HideCommand(final CafeBot cafeBot) { + super(cafeBot); + } + + @Override + public void handle(SlashCommandInteractionEvent event) { + this.handleInteraction(InteractionType.HIDE, event, this.cafeBot); + } + + @Override + public String getName() { + return "hide"; + } + + @Override + public String getDescription() { + return "Hide from someone... ;^;"; + } + + @Override + public CommandCategory getCategory() { + return CommandCategory.INTERACTION; + } + + @Override + public OptionData[] getOptions() { + return new OptionData[] { + new OptionData(OptionType.USER, "user", "The user you want to hide from..."), + new OptionData(OptionType.STRING, "message", "An optional message you can send.") + }; + } + + @Override + public Permission[] getPermissions() { + return new Permission[0]; + } + + @Override + public boolean isEphemeral() { + return false; + } + + @Override + public boolean isNSFW() { + return false; + } + + @Override + public boolean allowDM() { + return true; + } + + @Override + public String getSelfString() { + return "%s is **hiding** for... no reason? What? <:kuromi_question:841921649132568576>"; + } + + @Override + public String getOtherString() { + return "%s is **hiding** from %s! Um... what did you do? <:kuromi_question:841921649132568576>"; + } + + @Override + public String getBotString() { + return "Why are you hiding from me?! Come back! <:cafeBot_angry:1171726164092518441>"; + } + + @Override + public String getFooterString() { + return "%s hid from others %d times. %s caused others to hide %d times."; + } + +} diff --git a/bot/wrappers/cafe-api-wrapper/src/main/java/com/beanbeanjuice/cafeapi/wrapper/endpoints/interactions/InteractionType.java b/bot/wrappers/cafe-api-wrapper/src/main/java/com/beanbeanjuice/cafeapi/wrapper/endpoints/interactions/InteractionType.java index 1037869f..5845573c 100644 --- a/bot/wrappers/cafe-api-wrapper/src/main/java/com/beanbeanjuice/cafeapi/wrapper/endpoints/interactions/InteractionType.java +++ b/bot/wrappers/cafe-api-wrapper/src/main/java/com/beanbeanjuice/cafeapi/wrapper/endpoints/interactions/InteractionType.java @@ -52,7 +52,8 @@ public enum InteractionType { NOSEBLEED ("nosebleed_amount", "nosebleed"), OK ("ok_amount", "ok"), UWU ("uwu_amount", "uwu"), - WINK ("wink_amount", "wink"); + WINK ("wink_amount", "wink"), + HIDE ("hide_amount", "hide"); @Getter private final String type; private final String kawaiiAPIString;