File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed
src/main/kotlin/me/ddivad/judgebot Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ suspend fun main(args: Array<String>) {
6767 field {
6868 name = " Build Info"
6969 value = " ```" +
70- " Version: 2.4.0 \n " +
70+ " Version: 2.4.1 \n " +
7171 " DiscordKt: ${versions.library} \n " +
7272 " Kotlin: $kotlinVersion " +
7373 " ```"
Original file line number Diff line number Diff line change @@ -99,14 +99,17 @@ data class GuildMember(
9999 infraction.id = nextId
100100 this .infractions.add(infraction)
101101 this .points + = infraction.points
102- this .pointDecayTimer = DateTime ().millis.plus(infraction.punishment?.duration ? : 0 )
103102 this .lastInfraction = DateTime ().millis
104103 }
105104
106105 fun incrementHistoryCount (guildId : String ) {
107106 this .getGuildInfo(guildId).historyCount + = 1
108107 }
109108
109+ fun updatePointDecayDate (guild : Guild , punishmentDuration : Long ) = with (this .getGuildInfo(guild.id.asString)) {
110+ this .pointDecayTimer = DateTime ().millis.plus(punishmentDuration)
111+ }
112+
110113 fun addMessageDeleted (guild : Guild , deleteReaction : Boolean ) = with (this .getGuildInfo(guild.id.asString)) {
111114 this .deletedMessageCount.total++
112115 if (deleteReaction) this .deletedMessageCount.deleteReaction++
Original file line number Diff line number Diff line change @@ -86,8 +86,9 @@ class UserOperations(
8686 }
8787
8888 suspend fun addInfraction (guild : Guild , user : GuildMember , infraction : Infraction ): Infraction {
89- infraction.punishment = getPunishmentForPoints(guild, user)
9089 user.addInfraction(infraction, guild)
90+ infraction.punishment = getPunishmentForPoints(guild, user)
91+ user.updatePointDecayDate(guild, infraction.punishment?.duration ? : 0 )
9192 this .updateUser(user)
9293 return infraction
9394 }
You can’t perform that action at this time.
0 commit comments