add how gay command

This commit is contained in:
Lee 2025-01-06 05:03:10 +00:00
parent c424694068
commit 38089bdcd5

View File

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