From 38089bdcd5fa82436af1b91437809933def76e54 Mon Sep 17 00:00:00 2001 From: Lee Date: Mon, 6 Jan 2025 05:03:10 +0000 Subject: [PATCH] add how gay command --- .../bat/base/commands/fun/HowGayCommand.java | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/main/java/cc/fascinated/bat/base/commands/fun/HowGayCommand.java diff --git a/src/main/java/cc/fascinated/bat/base/commands/fun/HowGayCommand.java b/src/main/java/cc/fascinated/bat/base/commands/fun/HowGayCommand.java new file mode 100644 index 0000000..ef3d260 --- /dev/null +++ b/src/main/java/cc/fascinated/bat/base/commands/fun/HowGayCommand.java @@ -0,0 +1,52 @@ +package cc.fascinated.bat.base.commands.fun; + +import cc.fascinated.bat.common.DescriptionBuilder; +import cc.fascinated.bat.common.EmbedUtils; +import cc.fascinated.bat.common.MathUtils; +import cc.fascinated.bat.common.command.BatCommand; +import cc.fascinated.bat.common.command.Category; +import cc.fascinated.bat.common.command.CommandInfo; +import cc.fascinated.bat.common.model.BatGuild; +import cc.fascinated.bat.common.model.BatUser; +import lombok.NonNull; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.Message; +import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; +import net.dv8tion.jda.api.interactions.commands.OptionMapping; +import net.dv8tion.jda.api.interactions.commands.OptionType; +import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction; +import net.dv8tion.jda.api.interactions.commands.build.OptionData; +import org.springframework.stereotype.Component; + +/** + * @author Fascinated (fascinated7) + */ +@Component +@CommandInfo( + name = "howgay", + description = "Checks how gay someone is", + userInstall = true, + category = Category.FUN +) +public class HowGayCommand extends BatCommand { + public HowGayCommand() { + super.addOptions(new OptionData(OptionType.USER, "user", "The user you want to check the gayness of", true)); + } + + @Override + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) { + OptionMapping userOption = event.getOption("user"); + assert userOption != null; // This should never be null + User target = userOption.getAsUser(); + + event.replyEmbeds(EmbedUtils.genericEmbed() + .setDescription(new DescriptionBuilder("How Gay?") + .appendLine("%s is %s% gay".formatted( + target.getAsMention(), + (int) MathUtils.random(0, 100) + ), false) + .build()) + .build()).queue(); + } +}