From 9997ae9c9a5d5e52d8957d4e2b574089cb3d01eb Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Mon, 17 Jun 2024 17:31:39 +0200 Subject: [PATCH] Update bot.py --- nostr_dvm/bot.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nostr_dvm/bot.py b/nostr_dvm/bot.py index 58d0742..6257880 100644 --- a/nostr_dvm/bot.py +++ b/nostr_dvm/bot.py @@ -206,7 +206,11 @@ class Bot: elif decrypted_text.lower().startswith("invoice"): + requests_rq = False amount_str = decrypted_text.lower().split(" ")[1] + if amount_str == "qr": + amount_str = decrypted_text.lower().split(" ")[2] + requests_rq = True try: amount = int(amount_str) except: @@ -214,9 +218,14 @@ class Bot: invoice, hash = create_bolt11_ln_bits(amount, self.dvm_config) expires = nostr_event.created_at().as_secs() + (60 * 60 * 24) + qr_code = "https://qrcode.tec-it.com/API/QRCode?data="+ invoice +"&backcolor=%23ffffff&size=small&quietzone=1&errorcorrection=H" self.invoice_list.append(InvoiceToWatch(sender=sender, bolt11=invoice, payment_hash=hash, is_paid=False, expires=expires, amount=amount)) - message = invoice + + if requests_rq: + message = invoice + "\n" + qr_code + else: + message = invoice if giftwrap: await self.client.send_private_msg(PublicKey.parse(sender), message, None) else: