From 96d0e0f51c38311b5553d4f31c8bbc027fc8611f Mon Sep 17 00:00:00 2001 From: polyfloyd Date: Sun, 6 Jul 2025 15:08:07 +0200 Subject: [PATCH] bitlair_mqtt: Add hook to publish the amount of cash --- bitlair_mqtt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bitlair_mqtt b/bitlair_mqtt index 9ffd004..2919c52 100644 --- a/bitlair_mqtt +++ b/bitlair_mqtt @@ -17,3 +17,10 @@ sub hook_checkout { for 1..$entry->quantity; } } + +sub hook_user_balance { + my ($class, $user, $old, $delta, $new, $transaction_id) = @_; + + $mqtt->publish("bitlair/bank/cash" => -$new) + if $user eq "-cash"; +}