aboutsummaryrefslogtreecommitdiffstats
path: root/src/dm.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-15 09:27:45 -0700
committerAdam Soltys <[email protected]>2026-09-15 09:27:45 -0700
commitc90d0f3c600802b5b4b43959df5fd2d02f78012c (patch)
tree0bb36a804eda41415e2d3e871bc6475836f8f99e /src/dm.js
parentfeadbb008de9b2fe2332a7f0e190955ae545f07d (diff)
downloadcoinosv3-c90d0f3c600802b5b4b43959df5fd2d02f78012c.tar.gz
coinosv3-c90d0f3c600802b5b4b43959df5fd2d02f78012c.zip
Custom emoji in chat: :shortcodes: render as pictures, packs sync with Vector.
A message from Vector says :pika_wave: and carries a NIP-30 ["emoji", code, url] tag for it; coinos showed the bare shortcode. Now the bubble shows the picture (in rooms, DMs, the feed and the public /chat page), a bubble that is only one to three of them shows them big, and a :code: reaction chip is a picture too. Sending: every :code: you type that resolves travels with its tag, so the other side renders it whether or not they hold the pack. Shortcodes come from packs you hold (NIP-51 kind 30030 sets) and from what you've seen in chat, so anyone can answer a :pika_wave: with one. The composer autocompletes on ":pi" (Tab/Enter takes the first), the reaction picker lists custom emoji first, and Vector's pack share link renders with an Add button; a pasted naddr works too. Packs live on your kind 10030 list — the one Vector reads and writes — so a pack added in either app appears in both. tools/emoji-test.js drives the real coinos room headlessly and checks all of the above. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01JuwQqNWtDJcxPWtEm9134z
Diffstat (limited to 'src/dm.js')
-rw-r--r--src/dm.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dm.js b/src/dm.js
index 1e568a7..c610aa3 100644
--- a/src/dm.js
+++ b/src/dm.js
@@ -72,12 +72,13 @@ export function makeDMRumor(senderPk, peerPk, text, extraTags = []) {
// A reaction to a DM: a kind 7 rumor riding the same gift-wrap envelope
// (the shape 0xchat and friends use), e-tagging the reacted message.
-export function makeDMReaction(senderPk, peerPk, targetId, emoji) {
+// extraTags: a NIP-30 ["emoji", code, url] when the reaction is a :code:
+export function makeDMReaction(senderPk, peerPk, targetId, emoji, extraTags = []) {
const rumor = {
kind: 7,
pubkey: senderPk,
content: emoji,
- tags: [['p', peerPk], ['e', targetId]],
+ tags: [['p', peerPk], ['e', targetId], ...extraTags],
created_at: now(),
};
rumor.id = getEventHash(rumor);