constatic
Version:
Constatic is a CLI for creating and managing modern TypeScript projects, providing an organized structure and features that streamline development.
47 lines (46 loc) • 1.2 kB
JavaScript
// src/commands/emojis/list.ts
import { actions } from "#actions/index.js";
import { l } from "#helpers";
import { fetchDiscordTokenData } from "#shared/tokens.js";
import { defineCommand } from "citty";
function list_default(cli) {
return defineCommand({
meta: {
name: "list",
description: l({
"pt-BR": "Listar todos os emojis da aplicação",
"en-US": "List all emojis in the app"
})
},
args: {
token: {
type: "string",
description: l({
"pt-BR": "Nome do token salvo ou o token completo",
"en-US": "Saved token name or full token"
}),
alias: "tk",
required: true
}
},
async run({ args }) {
const data = {
token: args.token ?? args.tk,
type: args.type ?? args.t
};
let token = cli.config.getToken(data.token);
if (!token) {
const result = await fetchDiscordTokenData(data.token);
if (!result.success) {
console.error(result.error);
process.exit(1);
}
token = result.data;
}
await actions.emojis.list(cli, { token });
}
});
}
export {
list_default as default
};