fix pp size for not in guild
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 1m11s

This commit is contained in:
Lee 2024-07-06 19:41:16 +01:00
parent b63b25f8ab
commit d0ba6e72a4

@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
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;
@ -34,8 +35,7 @@ public class PPSizeCommand extends BatCommand {
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
OptionMapping userOption = event.getOption("user");
assert userOption != null; // This should never be null
Member targetMember = userOption.getAsMember();
assert targetMember != null; // This should never be null
User target = userOption.getAsUser();
int size = (int) MathUtils.random(1, 12);
event.replyEmbeds(EmbedUtils.genericEmbed()
@ -44,7 +44,7 @@ public class PPSizeCommand extends BatCommand {
The size of %s's pp is %s inches
**8%sD**
""".formatted(
targetMember.getAsMention(),
target.getAsMention(),
size,
"=".repeat(size)
), false)