From 65eb43646abc6b9d9abf34bff5df2ba1f7e4dff3 Mon Sep 17 00:00:00 2001 From: jani270 <69345714+jani270@users.noreply.github.com> Date: Tue, 21 Jan 2025 00:09:04 +0100 Subject: feat: Support for offline personal bank interest --- .../kotlin/moe/nea/ledger/modules/BankInterestDetection.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mod/src') 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 (?$SHORT_NUMBER_PATTERN) coins as interest in your (co-op|personal) bank account!") + val offlineBankInterestPattern = + Pattern.compile("Since you've been away you earned (?$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"))), + ) + ) + ) + } } } -- cgit