UNPKG

constatic

Version:

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

37 lines (36 loc) 1.02 kB
// src/shared/emojis/fetch.ts import { uiMessage, discordEmojis, sleep, log } from "#helpers"; import { menus } from "#menus"; import ora from "ora"; async function fetchDiscordEmojis({ cli, token, notCheckAmount = false }) { const loading = ora({ text: uiMessage({ "en-US": "Fetching emojis", "pt-BR": "Buscando emojis" }) }).start(); const result = await discordEmojis.get(token); loading.stop(); if (!result.success) { log.error(uiMessage({ "en-US": `An error occurred while fetching ${token.name}'s emojis`, "pt-BR": `Ocorreu um erro ao buscar os emojis de ${token.name}` })); await sleep(1000); menus.discord.emojis.main(cli, token); return null; } if (!notCheckAmount && !result.data.length) { log.fail(uiMessage({ "en-US": "No emojis to list", "pt-BR": "Nenhum emoji para listar" })); await sleep(1000); menus.discord.emojis.main(cli, token); return null; } return result.data; } export { fetchDiscordEmojis };