From a21ad4caec5d3e75b840e9181f82350b46c4c3c0 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 11 May 2023 23:39:10 -0500 Subject: [PATCH] Support custom emojis in usernames --- src/transmute.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/transmute.ts b/src/transmute.ts index dc0bc10..48ca110 100644 --- a/src/transmute.ts +++ b/src/transmute.ts @@ -32,6 +32,14 @@ async function toAccount(event: Event<0>, opts: ToAccountOpts = {}) { // } + const emojis = event.tags + .filter((tag) => tag[0] === 'emoji') + .map((tag) => ({ + shortcode: tag[1], + static_url: tag[2], + url: tag[2], + })); + return { id: pubkey, acct: parsed05?.handle || npub, @@ -40,7 +48,7 @@ async function toAccount(event: Event<0>, opts: ToAccountOpts = {}) { bot: false, created_at: event ? new Date(event.created_at * 1000).toISOString() : new Date().toISOString(), display_name: name, - emojis: [], + emojis, fields: [], follow_requests_count: 0, followers_count: 0,