aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorjani270 <69345714+jani270@users.noreply.github.com>2025-01-21 00:09:04 +0100
committerLinnea Gräf <nea@nea.moe>2025-01-21 00:15:49 +0100
commit65eb43646abc6b9d9abf34bff5df2ba1f7e4dff3 (patch)
tree0aa1d950cad4a0a49a98e6d0816cfe5bf64f259a /mod
parent7375808ececd341d92533bc52c583524d25af792 (diff)
downloadLocalTransactionLedger-65eb43646abc6b9d9abf34bff5df2ba1f7e4dff3.tar.gz
LocalTransactionLedger-65eb43646abc6b9d9abf34bff5df2ba1f7e4dff3.tar.bz2
LocalTransactionLedger-65eb43646abc6b9d9abf34bff5df2ba1f7e4dff3.zip
feat: Support for offline personal bank interest
Diffstat (limited to 'mod')
-rw-r--r--mod/src/main/kotlin/moe/nea/ledger/modules/BankInterestDetection.kt13
1 files changed, 13 insertions, 0 deletions
diff --git a/mod/src/main/kotlin/moe/nea/ledger/modules/BankInterestDetection.kt b/mod/src/main/kotlin/moe/nea/ledger/modules/BankInterestDetection.kt
index 1e8da23..fb39d87 100644
--- a/mod/src/main/kotlin/moe/nea/ledger/modules/BankInterestDetection.kt
+++ b/mod/src/main/kotlin/moe/nea/ledger/modules/BankInterestDetection.kt
@@ -17,6 +17,8 @@ class BankInterestDetection {
val bankInterestPattern =
Pattern.compile("You have just received (?<coins>$SHORT_NUMBER_PATTERN) coins as interest in your (co-op|personal) bank account!")
+ val offlineBankInterestPattern =
+ Pattern.compile("Since you've been away you earned (?<coins>$SHORT_NUMBER_PATTERN) coins as interest in your personal bank account!")
@Inject
lateinit var logger: LedgerLogger
@@ -34,5 +36,16 @@ class BankInterestDetection {
)
)
}
+ offlineBankInterestPattern.useMatcher(event.message) {
+ logger.logEntry(
+ LedgerEntry(
+ TransactionType.BANK_WITHDRAW,
+ event.timestamp,
+ listOf(
+ ItemChange.gainCoins(parseShortNumber(group("coins"))),
+ )
+ )
+ )
+ }
}
}