Skip to content

Commit

Permalink
add subscription event kind
Browse files Browse the repository at this point in the history
  • Loading branch information
believethehype committed Apr 3, 2024
1 parent b206457 commit fa957a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nostr_dvm/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __init__(self, dvm_config, admin_config=None):
if admin_config is not None:
for key in admin_config.USERNPUBS:
authors.append(PublicKey.parse(key))
dvm_filter = Filter().authors(authors).pubkey(public_key).kinds([Kind(5906)]).since(Timestamp.now())
dvm_filter = Filter().authors(authors).pubkey(public_key).kinds([EventDefinitions.KIND_NIP90_DVM_SUBSCRIPTION]).since(Timestamp.now())

self.client.subscribe([zap_filter, dvm_filter, cancel_subscription_filter], None)

Expand Down Expand Up @@ -208,7 +208,7 @@ def __init__(self, subscription):
self.subscription = subscription

def handle(self, relay_url, subscription_id, nostr_event: Event):
if nostr_event.kind().as_u64() == 5906: # TODO add to list of events
if nostr_event.kind().as_u64() == EventDefinitions.KIND_NIP90_DVM_SUBSCRIPTION.as_u64():
self.subscription.handle_nwc_request(nostr_event)
elif nostr_event.kind().as_u64() == EventDefinitions.KIND_NIP88_STOP_SUBSCRIPTION_EVENT.as_u64():
self.subscription.handle_cancel(nostr_event)
Expand Down
3 changes: 3 additions & 0 deletions nostr_dvm/utils/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class EventDefinitions:
KIND_NIP90_RESULTS_CONTENT_SEARCH = Kind(6302)
KIND_NIP90_USER_SEARCH = Kind(5303)
KIND_NIP90_RESULTS_USER_SEARCH = Kind(6303)
KIND_NIP90_DVM_SUBSCRIPTION = Kind(5906)
KIND_NIP90_RESULT_DVM_SUBSCRIPTION = Kind(6906)

KIND_NIP90_GENERIC = Kind(5999)
KIND_NIP90_RESULT_GENERIC = Kind(6999)

Expand Down

0 comments on commit fa957a2

Please sign in to comment.