Skip to content

Commit 466ae0e

Browse files
authored
Merge pull request #58 from the-programmers-hangout/fix/warn-rule
fix: add rule to warn embed
2 parents 7868abc + 84388e0 commit 466ae0e

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/main/kotlin/me/ddivad/judgebot/Main.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ suspend fun main(args: Array<String>) {
5858
field {
5959
name = "Build Info"
6060
value = "```" +
61-
"Version: 1.4.0\n" +
61+
"Version: 1.4.1\n" +
6262
"DiscordKt: ${versions.library}\n" +
6363
"Kotlin: $kotlinVersion" +
6464
"```"

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,24 @@ 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, configuration, user, guildMember, infraction)
15+
if (infraction.type == InfractionType.Warn) createWarnEmbed(guild, configuration, user, guildMember, infraction, rule)
1616
else if (infraction.type == InfractionType.Strike) createStrikeEmbed(guild, configuration, user, guildMember, infraction, rule)
1717
}
1818

19-
fun EmbedBuilder.createWarnEmbed(guild: Guild, configuration: GuildConfiguration, user: User, guildMember: GuildMember, infraction: Infraction) {
19+
fun EmbedBuilder.createWarnEmbed(guild: Guild, configuration: GuildConfiguration, user: User, guildMember: GuildMember, infraction: Infraction, rule: Rule?) {
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.
2323
| If you think this to be unjustified, please **do not** post about it in a public channel but take it up with **Modmail**.
2424
""".trimMargin()
2525

26+
if (infraction.ruleNumber != null) {
27+
field {
28+
name = "__Rule Broken__"
29+
value = "**[${rule?.title}](${rule?.link})** \n${rule?.description}"
30+
}
31+
}
32+
2633
field {
2734
name = "__Reason__"
2835
value = infraction.reason

0 commit comments

Comments
 (0)