mirror of
https://github.com/aljazceru/nostrdvm.git
synced 2025-12-19 23:14:20 +01:00
add NIP65 relay announcement, add blastr option to send_event function
This commit is contained in:
21
nostr_dvm/utils/nip65_utils.py
Normal file
21
nostr_dvm/utils/nip65_utils.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from nostr_sdk import Tag, Keys, EventBuilder
|
||||
|
||||
from nostr_dvm.utils.definitions import EventDefinitions
|
||||
from nostr_dvm.utils.nostr_utils import send_event
|
||||
from nostr_dvm.utils.print import bcolors
|
||||
|
||||
|
||||
def nip65_announce_relays(dvm_config, client):
|
||||
tags = []
|
||||
|
||||
for relay in dvm_config.RELAY_LIST:
|
||||
r_tag = Tag.parse(["r", relay])
|
||||
tags.append(r_tag)
|
||||
|
||||
keys = Keys.parse(dvm_config.NIP89.PK)
|
||||
content = ""
|
||||
|
||||
event = EventBuilder(EventDefinitions.KIND_RELAY_ANNOUNCEMENT, content, tags).to_event(keys)
|
||||
eventid = send_event(event, client=client, dvm_config=dvm_config, blastr=True)
|
||||
|
||||
print(bcolors.BLUE + "[" + dvm_config.NIP89.NAME + "] Announced NIP 65 for " + dvm_config.NIP89.NAME +" (EventID: " + eventid.to_hex() +")" + bcolors.ENDC)
|
||||
Reference in New Issue
Block a user