diff options
| author | fiatjaf <fiatjaf@gmail.com> | 2025-02-26 17:04:45 -0300 |
|---|---|---|
| committer | fiatjaf <fiatjaf@gmail.com> | 2025-02-26 17:04:45 -0300 |
| commit | 23b069d469580c95cb2716167c50abbf957d50d5 (patch) | |
| tree | c93d40e89c63d15556ed05eff7d132e7f75339b2 /25.md | |
| parent | 1b86a40df497fae2c3d5e68b81583f585f1719be (diff) | |
recommend using "k" tag always.reaction-targets
Diffstat (limited to '25.md')
| -rw-r--r-- | 25.md | 6 |
1 files changed, 2 insertions, 4 deletions
| @@ -31,7 +31,7 @@ The SHOULD be a `p` tag set to the `pubkey` of the event being reacted to. If a | |||
| 31 | 31 | ||
| 32 | If the event being reacted to is an addressable event, an `a` SHOULD be included together with the `e` tag, it must be set to the coordinates (`kind:pubkey:d-tag`) of the event being reacted to. | 32 | If the event being reacted to is an addressable event, an `a` SHOULD be included together with the `e` tag, it must be set to the coordinates (`kind:pubkey:d-tag`) of the event being reacted to. |
| 33 | 33 | ||
| 34 | If the target event is not a `kind:1`, then the reaction MAY include a `k` tag with the stringified kind number of the reacted event as its value. | 34 | The reaction SHOULD include a `k` tag with the stringified kind number of the reacted event as its value. |
| 35 | 35 | ||
| 36 | **Example code** | 36 | **Example code** |
| 37 | 37 | ||
| @@ -39,9 +39,7 @@ If the target event is not a `kind:1`, then the reaction MAY include a `k` tag w | |||
| 39 | func make_like_event(pubkey: String, privkey: String, liked: NostrEvent) -> NostrEvent { | 39 | func make_like_event(pubkey: String, privkey: String, liked: NostrEvent) -> NostrEvent { |
| 40 | tags.append(["e", liked.id, liked.source_relays.first ?? ""]) | 40 | tags.append(["e", liked.id, liked.source_relays.first ?? ""]) |
| 41 | tags.append(["p", liked.pubkey]) | 41 | tags.append(["p", liked.pubkey]) |
| 42 | if liked.kind != 1 { | 42 | tags.append(["k", String(liked.kind)]) |
| 43 | tags.append(["k", liked.kind]) | ||
| 44 | } | ||
| 45 | let ev = NostrEvent(content: "+", pubkey: pubkey, kind: 7, tags: tags) | 43 | let ev = NostrEvent(content: "+", pubkey: pubkey, kind: 7, tags: tags) |
| 46 | ev.calculate_id() | 44 | ev.calculate_id() |
| 47 | ev.sign(privkey: privkey) | 45 | ev.sign(privkey: privkey) |