mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-04-02 17:08:10 +02:00
nip29: NewGroupFromMetadataEvent()
This commit is contained in:
parent
b173c40f14
commit
d6d02686a9
@ -63,6 +63,20 @@ func NewGroup(gadstr string) (Group, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func NewGroupFromMetadataEvent(relayURL string, evt *nostr.Event) (Group, error) {
|
||||
g := Group{
|
||||
Address: GroupAddress{
|
||||
Relay: relayURL,
|
||||
ID: evt.Tags.GetD(),
|
||||
},
|
||||
Name: evt.Tags.GetD(),
|
||||
Members: make(map[string]*Role),
|
||||
}
|
||||
|
||||
err := g.MergeInMetadataEvent(evt)
|
||||
return g, err
|
||||
}
|
||||
|
||||
func (group Group) ToMetadataEvent() *nostr.Event {
|
||||
evt := &nostr.Event{
|
||||
Kind: nostr.KindSimpleGroupMetadata,
|
||||
|
Loading…
x
Reference in New Issue
Block a user