NIP-25 ====== Reactions --------- `draft` `optional` A reaction is a `kind 7` event that is used to react to other events. A reaction's `content` field MUST include a single character indicating the value of the reaction. A reaction with `content` set to `+` or an empty string MUST be interpreted as a "like" or "upvote". A reaction with `content` set to `-` MUST be interpreted as a "dislike" or "downvote". A reaction with `content` set to an emoji or [NIP-30](30.md) custom emoji SHOULD NOT be interpreted as a "like" or "dislike". Clients MAY instead display this emoji reaction on the post. Tags ---- The reaction event SHOULD include `e` and `p` tags from the note the user is reacting to (and optionally `a` tags if the target is a replaceable event). This allows users to be notified of reactions to posts they were mentioned in. Including the `e` tags enables clients to pull all the reactions associated with individual posts or all the posts in a thread. `a` tags enables clients to seek reactions for all versions of a replaceable event. The last `e` tag MUST be the `id` of the note that is being reacted to. The last `p` tag MUST be the `pubkey` of the event being reacted to. The `a` tag MUST contain the coordinates (`kind:pubkey:d-tag`) of the replaceable being reacted to. The reaction event MAY include a `k` tag with the stringified kind number of the reacted event as its value. Example code ```swift func make_like_event(pubkey: String, privkey: String, liked: NostrEvent) -> NostrEvent { var tags: [[String]] = liked.tags.filter { tag in tag.count >= 2 && (tag[0] == "e" || tag[0] == "p") } tags.append(["e", liked.id]) tags.append(["p", liked.pubkey]) tags.append(["k", liked.kind]) let ev = NostrEvent(content: "+", pubkey: pubkey, kind: 7, tags: tags) ev.calculate_id() ev.sign(privkey: privkey) return ev } ``` Reactions to a website --------------------- If the target of the reaction is a website, the reaction MUST be a `kind 17` event and MUST include an `r` tag with the website's URL. ```jsonc { "kind": 17, "content": "⭐", "tags": [ ["r", "https://example.com/"] ], // other fields... } ``` URLs SHOULD be [normalized](https://datatracker.ietf.org/doc/html/rfc3986#section-6), so that reactions to the same website are not omitted from queries. A fragment MAY be attached to the URL, to react to a section of the page. It should be noted that a URL with a fragment is not considered to be the same URL as the original. Custom Emoji Reaction --------------------- The client may specify a custom emoji ([NIP-30](30.md)) `:shortcode:` in the reaction content. The client should refer to the emoji tag and render the content as an emoji if shortcode is specified. ```jsonc { "kind": 7, "content": ":soapbox:", "tags": [ ["emoji", "soapbox", "https://gleasonator.com/emoji/Gleasonator/soapbox.png"] ], // other fields... } ``` The content can be set only one `:shortcode:`. And emoji tag should be one.