From 910717a90e1dedb25c6a549b065f96c9f94009d9 Mon Sep 17 00:00:00 2001 From: blackcoffeexbt <87530449+blackcoffeexbt@users.noreply.github.com> Date: Tue, 31 Oct 2023 11:34:52 +0000 Subject: [PATCH] Added fun phrases for zap receipts --- nostrZapLamp/nostrZapLamp.ino | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/nostrZapLamp/nostrZapLamp.ino b/nostrZapLamp/nostrZapLamp.ino index d912730..91edaef 100644 --- a/nostrZapLamp/nostrZapLamp.ino +++ b/nostrZapLamp/nostrZapLamp.ino @@ -528,11 +528,23 @@ uint16_t getRandomNum(uint16_t min, uint16_t max) { */ void zapReceiptEvent(const std::string& key, const char* payload) { if(lastPayload != payload) { // Prevent duplicate events from multiple relays triggering the same logic, as we are using multiple relays, this is likely to happen + // define an array of phrases to use when a zap is a received + String zapPhrases[] = { + "Zap!", + "A zap happened! ", + "The zappenning!", + "Zap! Zap!", + "Pew pew!", + "Zap! Zap! Zap!" + }; + lastPayload = payload; String bolt11 = getBolt11InvoiceFromEvent(payload); // Serial.println("BOLT11: " + bolt11); uint64_t amountInSatoshis = getAmountInSatoshis(bolt11); - Serial.println("Zapped! " + String(amountInSatoshis)); + // Choose a random phrase from the array + int randomPhraseIndex = getRandomNum(0, sizeof(zapPhrases) / sizeof(zapPhrases[0]) - 1); + Serial.println(zapPhrases[randomPhraseIndex] + " " + String(amountInSatoshis) + " sats"); flashLightning(amountInSatoshis); } }