Ah, ya in go-nostr the nostr.Tag is slice with a length of one to three like [ "p", "something", "something"]

Reply to this note

Please Login to reply.

Discussion

Yeah, but I don't know how to put this in an array. Do you know how?

An array of tags like []nostr.Tag or a flat array of strings? You just have to use range to build your array how you like it..

Do you have an example? I had no problems to get all contacts with something like

pTags := []string{"p"}

allPTags = ev.Tags.GetAll(pTags)

but I don't know how to get the relays.

For nip65 it's "r" tags it looks like, maybe that's why you can't find em yet? P tags are usually for a person.

If I filter for kind 3 I'll get something like this:

[p 7cc328a08ddb2afdf9f9be77beff4c83489ff979721827d628a542f32a247c0e]] {"wss://eden.nostr.land":{"read":true,"write":true},...

It seems like the prefered relays just follow the "p" tags.

Oh ya, if you're looking at kind 3 then that list is in the event content. Not the tag. But the p tag also has a relay in it optionally but it's not very reliable.

Yeah, I'm looking for my own relays in the event content, but I don't manage to get these into an array.

The content is an extra field, you probably have to json.Unmarshal it separately.

Cool, that was it! Thanks! 😃

No problem. I've been using go-nostr a lot lately. Are you building some fun stuff?

I'm going to write a CLI client for nostr, but I'm just started. Thanks a lot for your help! Good night! (it's 2 am here)