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)];
event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("You asked: `%s`\n\n:8ball: The magic 8ball says: `%s`".formatted(question, response))
.build())

@ -78,11 +78,10 @@ public class PunishmentProfile extends Serializable {
.setDescription(punishmentDescription.build())
.build());
String name = EnumUtils.getEnumName(type).endsWith("e") ? EnumUtils.getEnumName(type) + "d" : EnumUtils.getEnumName(type) + "ed";
user.getDiscordUser().openPrivateChannel().queue(channel -> {
DescriptionBuilder descriptionBuilder = new DescriptionBuilder(null);
descriptionBuilder.appendLine("🛡️ You have been **%s** in **%s**".formatted(
name,
type.getPastTense(),
discordGuild.getName()
), false);
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
*/
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(
remove ? "Un-" : "",
name,
type.getPastTense(),
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) {
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) {
Member owner = guild.getDiscordGuild().getOwner();
assert owner != null;
if (targetUser == null) {
return false;
}

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