mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-04-09 04:18:02 +02:00
support kind filter.
This commit is contained in:
parent
ba7f7b5398
commit
ee53d55800
@ -5,7 +5,7 @@ import "github.com/fiatjaf/go-nostr/event"
|
||||
type EventFilter struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Author string `json:"author,omitempty"`
|
||||
Kind uint8 `json:"kind,omitempty"`
|
||||
Kind *uint8 `json:"kind,omitempty"`
|
||||
Authors []string `json:"authors,omitempty"`
|
||||
TagEvent string `json:"#e,omitempty"`
|
||||
TagProfile string `json:"#p,omitempty"`
|
||||
@ -96,6 +96,10 @@ func (ef EventFilter) Matches(event *event.Event) bool {
|
||||
}
|
||||
}
|
||||
|
||||
if ef.Kind != nil && *ef.Kind != event.Kind {
|
||||
return false
|
||||
}
|
||||
|
||||
if ef.Since != 0 && event.CreatedAt < ef.Since {
|
||||
return false
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user