mirror of
https://github.com/aljazceru/python-nostr.git
synced 2025-12-19 07:14:23 +01:00
filter for DM
This commit is contained in:
6
main.py
6
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()
|
||||
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user