chore: get the extension started
This commit is contained in:
parent
94ce670866
commit
9b6b1e87b9
4 changed files with 36 additions and 2 deletions
33
tasks.py
Normal file
33
tasks.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import asyncio
|
||||
import json
|
||||
import threading
|
||||
|
||||
import httpx
|
||||
import websocket
|
||||
from loguru import logger
|
||||
|
||||
from lnbits.core.models import Payment
|
||||
from lnbits.helpers import url_for
|
||||
from lnbits.tasks import register_invoice_listener
|
||||
|
||||
|
||||
|
||||
async def wait_for_paid_invoices():
|
||||
invoice_queue = asyncio.Queue()
|
||||
register_invoice_listener(invoice_queue)
|
||||
|
||||
while True:
|
||||
payment = await invoice_queue.get()
|
||||
await on_invoice_paid(payment)
|
||||
|
||||
|
||||
async def on_invoice_paid(payment: Payment) -> None:
|
||||
if payment.extra.get("tag") != "market":
|
||||
return
|
||||
|
||||
print("### on_invoice_paid")
|
||||
|
||||
|
||||
async def subscribe_nostrclient_ws():
|
||||
print("### subscribe_nostrclient_ws")
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue