Skip to content

Commit e0b337e

Browse files
authored
Merge pull request #46 from the-programmers-hangout/fix/warn-embed
fix: add points to warn embed if set to >0
2 parents d4846f5 + 66e0b18 commit e0b337e

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/main/kotlin/me/ddivad/judgebot/embeds/InfractionEmbeds.kt

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import me.jakejmattson.discordkt.api.extensions.addField
1212
import java.awt.Color
1313

1414
fun EmbedBuilder.createInfractionEmbed(guild: Guild, configuration: GuildConfiguration, user: User, guildMember: GuildMember, infraction: Infraction, rule: Rule?) {
15-
if (infraction.type == InfractionType.Warn) createWarnEmbed(guild, user, infraction)
15+
if (infraction.type == InfractionType.Warn) createWarnEmbed(guild, configuration, user, guildMember, infraction)
1616
else if (infraction.type == InfractionType.Strike) createStrikeEmbed(guild, configuration, user, guildMember, infraction, rule)
1717
}
1818

19-
fun EmbedBuilder.createWarnEmbed(guild: Guild, user: User, infraction: Infraction) {
19+
fun EmbedBuilder.createWarnEmbed(guild: Guild, configuration: GuildConfiguration, user: User, guildMember: GuildMember, infraction: Infraction) {
2020
title = "Warn"
2121
description = """
2222
| ${user.mention}, you have received a **warning** from **${guild.name}**. A warning is a way for staff to inform you that your behaviour needs to change or further infractions will follow.
@@ -26,8 +26,23 @@ fun EmbedBuilder.createWarnEmbed(guild: Guild, user: User, infraction: Infractio
2626
field {
2727
name = "__Reason__"
2828
value = infraction.reason
29-
inline = false
29+
inline = true
30+
}
31+
32+
if (configuration.infractionConfiguration.warnPoints > 0) {
33+
field {
34+
name = "__Points__"
35+
value = "${infraction.points}"
36+
inline = true
37+
}
38+
39+
field {
40+
name = "__Points Count__"
41+
value = "${guildMember.getPoints(guild)} / ${configuration.infractionConfiguration.pointCeiling}"
42+
inline = true
43+
}
3044
}
45+
3146
color = Color.RED
3247
thumbnail {
3348
url = guild.getIconUrl(Image.Format.PNG) ?: ""

0 commit comments

Comments
 (0)