import {getEmojis} from './mod.ts'; import {getTwemoji} from '../Twitter絵文字を全て取得する/mod.js'; const customEmojis = await getEmojis(); const pages = customEmojis.map(({ name, src, alias, }) =>{ const href = src ?? customEmojis.find(emoji => emoji.name === alias)?.src; return { title: name, lines: [ name, ...(href ? [`[${href}]`] : []), '', ...(alias ? [`[${alias}]`] : []), '#custom', ], }; }); const defaultEmojiPages = (await getTwemoji()).map(({ emoji, shortcode, url, }) =>{ return { title: shortcode.slice(1, -1), lines: [ shortcode.slice(1, -1), `[${url}]`, '', '#default', ], }; }); await Deno.writeTextFile('emojis.json', JSON.stringify({pages: [...defaultEmojiPages, ...pages]}));