add nerddetector command
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 1m35s
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 1m35s
This commit is contained in:
@ -1,12 +1,9 @@
|
|||||||
package cc.fascinated.bat.base;
|
package cc.fascinated.bat.base;
|
||||||
|
|
||||||
import cc.fascinated.bat.base.commands.fun.HowGayCommand;
|
import cc.fascinated.bat.base.commands.fun.*;
|
||||||
import cc.fascinated.bat.common.feature.Feature;
|
import cc.fascinated.bat.common.feature.Feature;
|
||||||
import cc.fascinated.bat.common.feature.FeatureProfile;
|
import cc.fascinated.bat.common.feature.FeatureProfile;
|
||||||
import cc.fascinated.bat.base.commands.botadmin.BotAdminCommand;
|
import cc.fascinated.bat.base.commands.botadmin.BotAdminCommand;
|
||||||
import cc.fascinated.bat.base.commands.fun.CoinFlipCommand;
|
|
||||||
import cc.fascinated.bat.base.commands.fun.EightBallCommand;
|
|
||||||
import cc.fascinated.bat.base.commands.fun.PPSizeCommand;
|
|
||||||
import cc.fascinated.bat.base.commands.fun.image.ImageCommand;
|
import cc.fascinated.bat.base.commands.fun.image.ImageCommand;
|
||||||
import cc.fascinated.bat.base.commands.general.*;
|
import cc.fascinated.bat.base.commands.general.*;
|
||||||
import cc.fascinated.bat.base.commands.general.avatar.AvatarCommand;
|
import cc.fascinated.bat.base.commands.general.avatar.AvatarCommand;
|
||||||
@ -51,5 +48,6 @@ public class BaseFeature extends Feature {
|
|||||||
super.registerCommand(commandService, context.getBean(PastebinCommand.class));
|
super.registerCommand(commandService, context.getBean(PastebinCommand.class));
|
||||||
super.registerCommand(commandService, context.getBean(CoinFlipCommand.class));
|
super.registerCommand(commandService, context.getBean(CoinFlipCommand.class));
|
||||||
super.registerCommand(commandService, context.getBean(HowGayCommand.class));
|
super.registerCommand(commandService, context.getBean(HowGayCommand.class));
|
||||||
|
super.registerCommand(commandService, context.getBean(NerdDetectorCommand.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 = "nerddetector",
|
||||||
|
description = "Checks how much of a nerd someone is",
|
||||||
|
userInstall = true,
|
||||||
|
category = Category.FUN
|
||||||
|
)
|
||||||
|
public class NerdDetectorCommand extends BatCommand {
|
||||||
|
public NerdDetectorCommand() {
|
||||||
|
super.addOptions(new OptionData(OptionType.USER, "user", "The user you want to check how much of a nerd they are", 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("Nerd Detector")
|
||||||
|
.appendLine("%s is %s%% nerd 🤓".formatted(
|
||||||
|
target.getAsMention(),
|
||||||
|
(int) MathUtils.random(0, 100)
|
||||||
|
), false)
|
||||||
|
.build())
|
||||||
|
.build()).queue();
|
||||||
|
}
|
||||||
|
}
|
@ -30,8 +30,6 @@ import org.springframework.stereotype.Component;
|
|||||||
category = Category.FUN
|
category = Category.FUN
|
||||||
)
|
)
|
||||||
public class PPSizeCommand extends BatCommand {
|
public class PPSizeCommand extends BatCommand {
|
||||||
private final int maxSize = 12;
|
|
||||||
private final int minSize = 1;
|
|
||||||
|
|
||||||
public PPSizeCommand() {
|
public PPSizeCommand() {
|
||||||
super.addOptions(new OptionData(OptionType.USER, "user", "The user you want to get the pp size of", true));
|
super.addOptions(new OptionData(OptionType.USER, "user", "The user you want to get the pp size of", true));
|
||||||
@ -43,7 +41,8 @@ public class PPSizeCommand extends BatCommand {
|
|||||||
assert userOption != null; // This should never be null
|
assert userOption != null; // This should never be null
|
||||||
User target = userOption.getAsUser();
|
User target = userOption.getAsUser();
|
||||||
|
|
||||||
int size = (int) MathUtils.random(minSize, maxSize);
|
int maxSize = 12;
|
||||||
|
int size = (int) MathUtils.random(1, maxSize);
|
||||||
event.replyEmbeds(EmbedUtils.genericEmbed()
|
event.replyEmbeds(EmbedUtils.genericEmbed()
|
||||||
.setDescription(new DescriptionBuilder("PP Size")
|
.setDescription(new DescriptionBuilder("PP Size")
|
||||||
.appendLine("""
|
.appendLine("""
|
||||||
|
Reference in New Issue
Block a user