UNPKG

constatic

Version:

Constatic is a CLI for creating and managing modern TypeScript projects, providing an organized structure and features that streamline development.

30 lines (29 loc) 919 B
// src/actions/emojis/list.ts import { cliTableChars, uiMessage } from "#helpers"; import { fetchDiscordEmojis } from "#shared/emojis/fetch.js"; import ck from "chalk"; import Table from "cli-table3"; async function listEmojisAction(cli, data) { const emojis = await fetchDiscordEmojis({ cli, token: data.token }); if (!emojis) return; const cc = { name: uiMessage({ "en-US": "Name", "pt-BR": "Nome" }, ck.white), id: uiMessage({ "en-US": "ID", "pt-BR": "ID" }, ck.white), type: uiMessage({ "en-US": "Type", "pt-BR": "Tipo" }, ck.white) }; const table = new Table({ head: [cc.name, cc.id, cc.type], style: { compact: true }, chars: cliTableChars }); emojis.forEach((emoji) => table.push([ ck.yellow(emoji.name), ck.green(emoji.id), emoji.animated ? ck.magenta("animated") : ck.cyan("static") ])); console.log(table.toString()); } export { listEmojisAction };