Skip to content

Commit d513c8d

Browse files
authored
Merge pull request #132 from the-programmers-hangout/develop
chore: merge develop for v2.7.1
2 parents e1bb224 + 4ee8b0a commit d513c8d

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ suspend fun main() {
6969
field {
7070
name = "Build Info"
7171
value = "```" +
72-
"Version: 2.7.0\n" +
72+
"Version: 2.7.1\n" +
7373
"DiscordKt: ${versions.library}\n" +
7474
"Kord: ${versions.kord}\n" +
7575
"Kotlin: $kotlinVersion" +

src/main/kotlin/me/ddivad/judgebot/dataclasses/GuildMember.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,14 @@ data class GuildMember(
114114
suspend fun checkPointDecay(guild: Guild, configuration: GuildConfiguration, loggingService: LoggingService) = with(this.getGuildInfo(guild.id.toString())) {
115115
val weeksSincePointsDecayed = Weeks.weeksBetween(DateTime(this.pointDecayTimer), DateTime()).weeks
116116
if (weeksSincePointsDecayed > 0) {
117-
val pointsToRemove = configuration.infractionConfiguration.pointDecayPerWeek * weeksSincePointsDecayed
118-
this.points -= pointsToRemove
119-
if (this.points < 0) this.points = 0
117+
if (this.points > 0) {
118+
val pointsToRemove = configuration.infractionConfiguration.pointDecayPerWeek * weeksSincePointsDecayed
119+
if (pointsToRemove > this.points) {
120+
this.points = 0
121+
} else this.points -= pointsToRemove
122+
loggingService.pointDecayApplied(guild, this@GuildMember, this.points, pointsToRemove, weeksSincePointsDecayed)
123+
}
120124
this.pointDecayTimer = DateTime().millis
121-
loggingService.pointDecayApplied(guild, this@GuildMember, this.points, pointsToRemove, weeksSincePointsDecayed)
122125
}
123126
}
124127

src/main/kotlin/me/ddivad/judgebot/services/LoggingService.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ class LoggingService(private val configuration: Configuration) {
8484

8585
log(
8686
guild,
87-
"**Info ::** Infraction Points for ${user?.descriptor()} " +
88-
"reduced by **$pointsDeducted** to **$newPoints** " +
87+
"**Info ::** Infraction point decay for ${user?.descriptor()} " +
88+
"\nPoints reduced by **$pointsDeducted** to **$newPoints** " +
8989
"for **$weeksSinceLastInfraction** infraction free weeks."
9090
)
9191
}

0 commit comments

Comments
 (0)