From 2b2018b74290c66ddf0078d55c85cfe7e1c5c895 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Mon, 26 Jun 2023 20:52:12 -0300 Subject: [PATCH] allow extra tag elements on event creation, separated by ";" --- event.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/event.go b/event.go index 73ab6bd..8c143dd 100644 --- a/event.go +++ b/event.go @@ -82,11 +82,17 @@ standalone: Tags: make(nostr.Tags, 0, 3), } - tags := make([][]string, 0, 5) + tags := make(nostr.Tags, 0, 5) for _, tagFlag := range c.StringSlice("tag") { + // tags are in the format key=value spl := strings.Split(tagFlag, "=") if len(spl) == 2 && len(spl[0]) > 0 { - tags = append(tags, spl) + tag := nostr.Tag{spl[0]} + // tags may also contain extra elements separated with a ";" + spl2 := strings.Split(spl[1], ";") + tag = append(tag, spl2...) + // ~ + tags = append(tags, tag) } } for _, etag := range c.StringSlice("e") {