diff options
| author | Alex Gleason <alex@alexgleason.me> | 2023-04-29 13:16:58 -0500 |
|---|---|---|
| committer | Alex Gleason <alex@alexgleason.me> | 2023-04-29 13:16:58 -0500 |
| commit | e91ce3409e1ce8267fc07a21784d2538621267c3 (patch) | |
| tree | c32342849f3e4bb3a213b531069e1b64c5ac41a6 /30.md | |
| parent | 346036208ccca6f31313f1e909ff17ea3563fb46 (diff) | |
NIP-30: Custom Emoji
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. | ||
| 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 | ``` \ No newline at end of file | ||