diff options
| author | Pablo Fernandez <p@f7z.io> | 2023-06-08 22:32:17 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-08 22:32:17 +0200 |
| commit | 6baacf6fb1badf3ba2480a88519e357b3cbdaaac (patch) | |
| tree | b3d211bc3683b340d678c3574519f327e7b3858e /30.md | |
| parent | 964bc5b5ce946ab66aae945084549f26ffdef70f (diff) | |
| parent | 14a887d43b654f41de5d271e27ef69048f183fb4 (diff) | |
Merge branch 'master' into nip31
Diffstat (limited to '30.md')
| -rw-r--r-- | 30.md | 56 |
1 files changed, 56 insertions, 0 deletions
| @@ -0,0 +1,56 @@ | |||
| 1 | NIP-30 | ||
| 2 | ====== | ||
| 3 | |||
| 4 | Custom Emoji | ||
| 5 | ------------ | ||
| 6 | |||
| 7 | `draft` `optional` `author:alexgleason` | ||
| 8 | |||
| 9 | Custom emoji may be added to **kind 0** and **kind 1** events by including one or more `"emoji"` tags, in the form: | ||
| 10 | |||
| 11 | ``` | ||
| 12 | ["emoji", <shortcode>, <image-url>] | ||
| 13 | ``` | ||
| 14 | |||
| 15 | Where: | ||
| 16 | |||
| 17 | - `<shortcode>` is a name given for the emoji, which MUST be comprised of only alphanumeric characters and underscores. | ||
| 18 | - `<image-url>` is a URL to the corresponding image file of the emoji. | ||
| 19 | |||
| 20 | For each emoji tag, clients should parse emoji shortcodes (aka "emojify") like `:shortcode:` in the event to display custom emoji. | ||
| 21 | |||
| 22 | Clients may allow users to add custom emoji to an event by including `:shortcode:` identifier in the event, and adding the relevant `"emoji"` tags. | ||
| 23 | |||
| 24 | ### Kind 0 events | ||
| 25 | |||
| 26 | In kind 0 events, the `name` and `about` fields should be emojified. | ||
| 27 | |||
| 28 | ```json | ||
| 29 | { | ||
| 30 | "kind": 0, | ||
| 31 | "content": "{\"name\":\"Alex Gleason :soapbox:\"}", | ||
| 32 | "tags": [ | ||
| 33 | ["emoji", "soapbox", "https://gleasonator.com/emoji/Gleasonator/soapbox.png"] | ||
| 34 | ], | ||
| 35 | "pubkey": "79c2cae114ea28a981e7559b4fe7854a473521a8d22a66bbab9fa248eb820ff6", | ||
| 36 | "created_at": 1682790000 | ||
| 37 | } | ||
| 38 | ``` | ||
| 39 | |||
| 40 | ### Kind 1 events | ||
| 41 | |||
| 42 | In kind 1 events, the `content` should be emojified. | ||
| 43 | |||
| 44 | ```json | ||
| 45 | { | ||
| 46 | "kind": 1, | ||
| 47 | "content": "Hello :gleasonator: 😂 :ablobcatrainbow: :disputed: yolo", | ||
| 48 | "tags": [ | ||
| 49 | ["emoji", "ablobcatrainbow", "https://gleasonator.com/emoji/blobcat/ablobcatrainbow.png"], | ||
| 50 | ["emoji", "disputed", "https://gleasonator.com/emoji/Fun/disputed.png"], | ||
| 51 | ["emoji", "gleasonator", "https://gleasonator.com/emoji/Gleasonator/gleasonator.png"] | ||
| 52 | ], | ||
| 53 | "pubkey": "79c2cae114ea28a981e7559b4fe7854a473521a8d22a66bbab9fa248eb820ff6", | ||
| 54 | "created_at": 1682630000 | ||
| 55 | } | ||
| 56 | ``` | ||