mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-11-19 18:47:37 +01:00
move ExternalPointer to nip73 and write nip27.Parse() that gets all the parts of the text including URLs, Nostr URIs and just raw text.
This commit is contained in:
23
nip73/pointer.go
Normal file
23
nip73/pointer.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package nip73
|
||||
|
||||
import "github.com/nbd-wtf/go-nostr"
|
||||
|
||||
var _ nostr.Pointer = (*ExternalPointer)(nil)
|
||||
|
||||
// ExternalPointer represents a pointer to a URL or something else.
|
||||
type ExternalPointer struct {
|
||||
Thing string
|
||||
}
|
||||
|
||||
// ExternalPointerFromTag creates a ExternalPointer from an "i" tag
|
||||
func ExternalPointerFromTag(refTag nostr.Tag) (ExternalPointer, error) {
|
||||
return ExternalPointer{refTag[1]}, nil
|
||||
}
|
||||
|
||||
func (ep ExternalPointer) MatchesEvent(_ nostr.Event) bool { return false }
|
||||
func (ep ExternalPointer) AsTagReference() string { return ep.Thing }
|
||||
func (ep ExternalPointer) AsFilter() nostr.Filter { return nostr.Filter{} }
|
||||
|
||||
func (ep ExternalPointer) AsTag() nostr.Tag {
|
||||
return nostr.Tag{"i", ep.Thing}
|
||||
}
|
||||
Reference in New Issue
Block a user