diff --git a/nostr.go b/nostr.go index ed47382..6fed3fb 100644 --- a/nostr.go +++ b/nostr.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "os" + "sort" "time" "github.com/dgraph-io/ristretto" @@ -163,5 +164,8 @@ func getLastNotes(ctx context.Context, code string) []*nostr.Event { for event := range events { lastNotes = append(lastNotes, event) } + sort.Slice(lastNotes, func(i, j int) bool { + return lastNotes[i].CreatedAt.Time().After(lastNotes[j].CreatedAt.Time()) + }) return lastNotes }