From 2872fe3c24ad0036e1bcf262790930d9a1e65d70 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Mon, 13 Feb 2023 23:02:36 +0100 Subject: [PATCH] filter for DM --- main.py | 6 +----- nostr/client/client.py | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 5232101..08a3c61 100644 --- a/main.py +++ b/main.py @@ -33,13 +33,9 @@ async def dm(): print(f"Your public key: {client.public_key.bech32()}") - # await asyncio.sleep(1) t = threading.Thread( target=client.get_dm, - args=( - client.public_key, - callback, - ), + args=(client.public_key, callback), ) t.start() diff --git a/nostr/client/client.py b/nostr/client/client.py index 0c246d8..52676e0 100644 --- a/nostr/client/client.py +++ b/nostr/client/client.py @@ -96,12 +96,13 @@ class NostrClient: self.private_key.sign_event(dm) self.relay_manager.publish_event(dm) - def get_dm(self, sender_publickey: PublicKey, callback_func=None): + def get_dm(self, sender_publickey: PublicKey, callback_func=None, filter_kwargs={}): filters = Filters( [ Filter( kinds=[EventKind.ENCRYPTED_DIRECT_MESSAGE], pubkey_refs=[sender_publickey.hex()], + **filter_kwargs, ) ] )