Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to retrieve the last 3 notes from a user? #105

Open
R3DRUN3 opened this issue Oct 5, 2023 · 4 comments
Open

How to retrieve the last 3 notes from a user? #105

R3DRUN3 opened this issue Oct 5, 2023 · 4 comments

Comments

@R3DRUN3
Copy link
Contributor

R3DRUN3 commented Oct 5, 2023

Hi, I am trying to retrieve the last 3 notes from a single user (by modifying example.go) but I dont understand how to do this.
I am using the Author field in the filters but the results from the relay are empty.

@fiatjaf
Copy link
Collaborator

fiatjaf commented Oct 5, 2023

Can you paste your code?

@R3DRUN3
Copy link
Contributor Author

R3DRUN3 commented Oct 6, 2023

Basically is like in your example but modify the code like this:

// create filters
var filters nostr.Filters
if _, v, err := nip19.Decode(npub); err == nil {
	t := make(map[string][]string)
	// making a "p" tag for the above public key.
	// this filters for messages tagged with the user, mainly replies.
	t["p"] = []string{v.(string)}
	filters = []nostr.Filter{{
		Kinds: []int{nostr.KindTextNote},
                Authors: []string{"<HARDCODED-PUB-KEY-HERE>"}
		Tags:  t,
		Limit: 3,

@fiatjaf
Copy link
Collaborator

fiatjaf commented Oct 6, 2023

Maybe the relay you're querying doesn't have any of the results you want? That's the only explanation I can think of.

Maybe try doing the same query manually or with https://github.com/fiatjaf/nak.

@R3DRUN3
Copy link
Contributor Author

R3DRUN3 commented Oct 6, 2023

Silly me! I was querying a closed relay that is behind a paywall 🙈
Sorry for your time, you can close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants