upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/25.md
diff options
context:
space:
mode:
authorPablo Fernandez <p@f7z.io>2023-10-15 21:30:42 +0300
committerGitHub <noreply@github.com>2023-10-15 21:30:42 +0300
commita482f47ae4c36d38062cd0fd3ee6235e57691673 (patch)
treea16f57208cd3c3ef74237dafcef277f16d70e688 /25.md
parentd9400e1e7b08225aedb6c78b522c5ad07b5198b4 (diff)
parent202e18f2b256646148805880ed58731c1c8b2b9b (diff)
Merge branch 'master' into vending-machine
Diffstat (limited to '25.md')
-rw-r--r--25.md9
1 files changed, 7 insertions, 2 deletions
diff --git a/25.md b/25.md
index 86ce763..7b29140 100644
--- a/25.md
+++ b/25.md
@@ -7,7 +7,7 @@ Reactions
7 7
8`draft` `optional` `author:jb55` 8`draft` `optional` `author:jb55`
9 9
10A reaction is a `kind 7` note that is used to react to other notes. 10A reaction is a `kind 7` event that is used to react to other events.
11 11
12The generic reaction, represented by the `content` set to a `+` string, SHOULD 12The generic reaction, represented by the `content` set to a `+` string, SHOULD
13be interpreted as a "like" or "upvote". 13be interpreted as a "like" or "upvote".
@@ -19,7 +19,8 @@ dislikes in a reddit-like system of upvotes and downvotes, or display them as
19separate tallies. 19separate tallies.
20 20
21The `content` MAY be an emoji, or [NIP-30](30.md) custom emoji in this case it MAY be interpreted as a "like" or "dislike", 21The `content` MAY be an emoji, or [NIP-30](30.md) custom emoji in this case it MAY be interpreted as a "like" or "dislike",
22or the client MAY display this emoji reaction on the post. 22or the client MAY display this emoji reaction on the post. If the `content` is an empty string then the client should
23consider it a "+".
23 24
24Tags 25Tags
25---- 26----
@@ -33,6 +34,9 @@ The last `e` tag MUST be the `id` of the note that is being reacted to.
33 34
34The last `p` tag MUST be the `pubkey` of the event being reacted to. 35The last `p` tag MUST be the `pubkey` of the event being reacted to.
35 36
37The reaction event MAY include a `k` tag with the stringified kind number
38of the reacted event as its value.
39
36Example code 40Example code
37 41
38```swift 42```swift
@@ -42,6 +46,7 @@ func make_like_event(pubkey: String, privkey: String, liked: NostrEvent) -> Nost
42 } 46 }
43 tags.append(["e", liked.id]) 47 tags.append(["e", liked.id])
44 tags.append(["p", liked.pubkey]) 48 tags.append(["p", liked.pubkey])
49 tags.append(["k", liked.kind])
45 let ev = NostrEvent(content: "+", pubkey: pubkey, kind: 7, tags: tags) 50 let ev = NostrEvent(content: "+", pubkey: pubkey, kind: 7, tags: tags)
46 ev.calculate_id() 51 ev.calculate_id()
47 ev.sign(privkey: privkey) 52 ev.sign(privkey: privkey)