mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-05-30 17:50:12 +02:00
Tags.GetD()
This commit is contained in:
parent
8b1839bfc1
commit
45bdd193c5
10
tags.go
10
tags.go
@ -61,6 +61,16 @@ func (tag Tag) Relay() string {
|
||||
|
||||
type Tags []Tag
|
||||
|
||||
// GetD gets the first "d" tag (for parameterized replaceable events) value or ""
|
||||
func (tags Tags) GetD() string {
|
||||
for _, v := range tags {
|
||||
if v.StartsWith([]string{"d", ""}) {
|
||||
return v[1]
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetFirst gets the first tag in tags that matches the prefix, see [Tag.StartsWith]
|
||||
func (tags Tags) GetFirst(tagPrefix []string) *Tag {
|
||||
for _, v := range tags {
|
||||
|
Loading…
x
Reference in New Issue
Block a user