feat: keep customer profiles up to date

This commit is contained in:
Vlad Stan 2023-03-27 17:19:51 +03:00
parent e7b16dd17f
commit 89f46fff35
7 changed files with 175 additions and 5 deletions

View file

@ -4,6 +4,7 @@ from lnbits.core.models import Payment
from lnbits.tasks import register_invoice_listener
from .crud import (
get_all_customers,
get_last_direct_messages_time,
get_last_order_time,
get_public_keys_for_merchants,
@ -42,6 +43,10 @@ async def wait_for_nostr_events(nostr_client: NostrClient):
await nostr_client.subscribe_to_direct_messages(p, since)
customers = await get_all_customers()
for c in customers:
await nostr_client.subscribe_to_user_profile(c.public_key, c.event_created_at)
while True:
message = await nostr_client.get_event()
await process_nostr_message(message)