fix past tense
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 1m19s

This commit is contained in:
Lee 2024-07-09 20:19:21 +01:00
parent a3f4e2b918
commit 38465f544d
3 changed files with 17 additions and 11 deletions

@ -56,7 +56,6 @@ public class EightBallCommand extends BatCommand {
} }
String response = responses[(int) (Math.random() * responses.length)]; String response = responses[(int) (Math.random() * responses.length)];
event.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("You asked: `%s`\n\n:8ball: The magic 8ball says: `%s`".formatted(question, response)) .setDescription("You asked: `%s`\n\n:8ball: The magic 8ball says: `%s`".formatted(question, response))
.build()) .build())

@ -78,11 +78,10 @@ public class PunishmentProfile extends Serializable {
.setDescription(punishmentDescription.build()) .setDescription(punishmentDescription.build())
.build()); .build());
String name = EnumUtils.getEnumName(type).endsWith("e") ? EnumUtils.getEnumName(type) + "d" : EnumUtils.getEnumName(type) + "ed";
user.getDiscordUser().openPrivateChannel().queue(channel -> { user.getDiscordUser().openPrivateChannel().queue(channel -> {
DescriptionBuilder descriptionBuilder = new DescriptionBuilder(null); DescriptionBuilder descriptionBuilder = new DescriptionBuilder(null);
descriptionBuilder.appendLine("🛡️ You have been **%s** in **%s**".formatted( descriptionBuilder.appendLine("🛡️ You have been **%s** in **%s**".formatted(
name, type.getPastTense(),
discordGuild.getName() discordGuild.getName()
), false); ), false);
if (length != -1 && (type == PunishmentType.MUTE || type == PunishmentType.BAN)) { if (length != -1 && (type == PunishmentType.MUTE || type == PunishmentType.BAN)) {
@ -289,13 +288,12 @@ public class PunishmentProfile extends Serializable {
* @param length The length of the punishment * @param length The length of the punishment
*/ */
public void punishmentResponse(SlashCommandInteraction event, PunishmentType type, BatUser targetUser, String reason, boolean remove, long length) { public void punishmentResponse(SlashCommandInteraction event, PunishmentType type, BatUser targetUser, String reason, boolean remove, long length) {
String name = EnumUtils.getEnumName(type).endsWith("e") ? EnumUtils.getEnumName(type) + "d" : EnumUtils.getEnumName(type) + "ed";
DescriptionBuilder description = new DescriptionBuilder("Successfully %s%s %s".formatted( DescriptionBuilder description = new DescriptionBuilder("Successfully %s%s %s".formatted(
remove ? "Un-" : "", remove ? "Un-" : "",
name, type.getPastTense(),
targetUser.getDiscordUser().getAsMention() targetUser.getDiscordUser().getAsMention()
)); ));
description.appendLine("Reason: %s".formatted(reason == null ? "No reason provided" : reason), true); description.appendLine("Reason: `%s`".formatted(reason == null ? "No reason provided" : reason), true);
if (length != -1) { if (length != -1) {
description.appendLine("Length: %s".formatted(TimeUtils.format(length)), true); description.appendLine("Length: %s".formatted(TimeUtils.format(length)), true);
} }
@ -316,7 +314,6 @@ public class PunishmentProfile extends Serializable {
public boolean canPunish(BatGuild guild, BatUser issuer, BatUser targetUser) { public boolean canPunish(BatGuild guild, BatUser issuer, BatUser targetUser) {
Member owner = guild.getDiscordGuild().getOwner(); Member owner = guild.getDiscordGuild().getOwner();
assert owner != null; assert owner != null;
if (targetUser == null) { if (targetUser == null) {
return false; return false;
} }

@ -1,11 +1,21 @@
package cc.fascinated.bat.features.moderation.punish; package cc.fascinated.bat.features.moderation.punish;
import lombok.AllArgsConstructor;
import lombok.Getter;
/** /**
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@AllArgsConstructor @Getter
public enum PunishmentType { public enum PunishmentType {
KICK, KICK("Kicked"),
BAN, BAN("Banned"),
WARN, WARN("Warned"),
MUTE MUTE("Muted");
/**
* The past tense of the punishment
*/
private final String pastTense;
} }