mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-11-19 18:16:25 +01:00
Update bot.py
This commit is contained in:
@@ -206,7 +206,11 @@ class Bot:
|
|||||||
|
|
||||||
|
|
||||||
elif decrypted_text.lower().startswith("invoice"):
|
elif decrypted_text.lower().startswith("invoice"):
|
||||||
|
requests_rq = False
|
||||||
amount_str = decrypted_text.lower().split(" ")[1]
|
amount_str = decrypted_text.lower().split(" ")[1]
|
||||||
|
if amount_str == "qr":
|
||||||
|
amount_str = decrypted_text.lower().split(" ")[2]
|
||||||
|
requests_rq = True
|
||||||
try:
|
try:
|
||||||
amount = int(amount_str)
|
amount = int(amount_str)
|
||||||
except:
|
except:
|
||||||
@@ -214,9 +218,14 @@ class Bot:
|
|||||||
|
|
||||||
invoice, hash = create_bolt11_ln_bits(amount, self.dvm_config)
|
invoice, hash = create_bolt11_ln_bits(amount, self.dvm_config)
|
||||||
expires = nostr_event.created_at().as_secs() + (60 * 60 * 24)
|
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))
|
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:
|
if giftwrap:
|
||||||
await self.client.send_private_msg(PublicKey.parse(sender), message, None)
|
await self.client.send_private_msg(PublicKey.parse(sender), message, None)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user