npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

axislib

v1.1.0

Published

A lib Discord mais fácil e poderosa — por Axis

Readme

AxisLib v1.1.0

A lib Discord mais fácil, tipada e poderosa — feita por Axis.


Instalação

npm install axislib

Novidades na v1.1.0

  • Evento de menção (mentionReply) — resposta automática e 100% personalizável quando alguém menciona o bot
  • Código dividido em módulosclient/, structures/, managers/, utils/, types/
  • Totalmente tipado — todos os builders, options e contextos têm tipos explícitos
  • Todos os Components V2container, text, section, thumbnail, separator, gallery, file, row
  • Button como alias de v2Button para uso clássico
  • Row<T> genérico — funciona com qualquer componente

Uso básico

import { Client, v2, v2Button, MessageFlags } from "axislib";

const client = new Client({
  token: "SEU_TOKEN",
  prefix: "!",
  owners: ["SEU_ID"],

  // Resposta quando alguém menciona o bot — ative e customize como quiser
  mentionReply: {
    run: async ({ message, client }) => {
      await message.reply({
        flags: MessageFlags.IsComponentsV2,
        components: [
          v2.container([
            v2.text(`## Oi! Me use com \`/help\`.`),
            v2.row(v2Button.primary("help", "Ver comandos")),
          ], { color: 0x5865F2 }),
        ],
      });
    },
  },
});

client.slash({
  name: "ping",
  description: "Pong!",
  run: async (client, interaction) => {
    await interaction.reply({ content: `Pong! ${client.ws.ping}ms` });
  },
});

await client.start();

Estrutura do projeto

src/
├── client/
│   └── Client.ts           — Classe principal do bot
├── structures/
│   ├── SlashCommand.ts     — Estrutura de slash command
│   ├── PrefixCommand.ts    — Estrutura de prefix command
│   ├── Event.ts            — Estrutura de evento
│   └── Interaction.ts      — Estrutura de interaction handler
├── managers/
│   ├── Loader.ts           — Carrega arquivos de commands/eventos
│   └── Registry.ts         — Registra slash commands na API
├── utils/
│   ├── builders.ts         — Todos os builders (v2, v2Button, Embed, Modal...)
│   ├── time.ts             — Utilitários de data/hora
│   └── json.ts             — JsonDB simples
└── types/
    └── index.ts            — Todos os tipos e interfaces

Components V2

v2.container(components, options?)

O "card" principal. Aceita todos os outros components v2.

v2.container([...], { color: 0x5865F2, spoiler: false })

v2.text(content)

Texto com suporte a Markdown do Discord.

v2.text("## Título\nConteúdo aqui")

v2.section(components, accessory?)

Texto à esquerda + thumbnail ou botão à direita.

v2.section([v2.text("Olá!")], v2.thumbnail("https://..."))

v2.thumbnail(url, description?)

Imagem pequena para usar como acessório de seção.

v2.thumbnail(member.displayAvatarURL(), "Avatar")

v2.separator(size?, divider?)

Linha separadora horizontal.

v2.separator("large")
v2.separator("small", false)  // sem linha visível

v2.gallery(images)

Galeria de até 10 imagens.

v2.gallery(["https://img1.png", "https://img2.png"])
v2.gallery([{ url: "https://...", description: "Alt", spoiler: false }])

v2.file(url, spoiler?)

Arquivo anexo dentro do container.

v2.file("attachment://banner.png")

v2.row(...buttons)

ActionRow de botões dentro de um container v2.

v2.row(v2Button.primary("ok", "OK"), v2Button.danger("no", "Cancelar"))

Botões

import { v2Button } from "axislib";

v2Button.primary("id",   "Label")
v2Button.secondary("id", "Label")
v2Button.success("id",   "Label")
v2Button.danger("id",    "Label")
v2Button.link("https://...", "Label")
v2Button.premium("sku-id")

// Com emoji e disabled:
v2Button.primary("id", "Label", { emoji: "✅", disabled: false })

Select Menus

import { StringSelect, UserSelect, RoleSelect, ChannelSelect, MentionableSelect, Row } from "axislib";

Row(StringSelect({
  customId: "sel",
  placeholder: "Escolha",
  options: [
    { label: "A", value: "a", emoji: "🅰️" },
    { label: "B", value: "b" },
  ],
}))

Row(UserSelect({ customId: "user-sel", placeholder: "Usuário" }))
Row(RoleSelect({ customId: "role-sel" }))
Row(ChannelSelect({ customId: "ch-sel", channelTypes: [ChannelType.GuildText] }))
Row(MentionableSelect({ customId: "mention-sel" }))

Modal

import { Modal } from "axislib";

await interaction.showModal(Modal({
  customId: "form",
  title: "Formulário",
  inputs: [
    { customId: "nome", label: "Nome", style: "Short", required: true },
    { customId: "bio",  label: "Bio",  style: "Paragraph", maxLength: 300 },
  ],
}));

Embed (clássico)

import { Embed } from "axislib";

Embed({
  title: "Título",
  description: "Texto",
  color: "#5865F2",
  fields: [{ name: "Campo", value: "Valor", inline: true }],
  footer: "Rodapé",
  thumbnail: "https://...",
  timestamp: true,
})

Evento de menção

const client = new Client({
  token: "...",
  mentionReply: {
    run: async ({ message, member, channel, client }) => {
      // Faça o que quiser aqui!
      await message.reply("Oi! 👋");
    },
  },
});

Se mentionReply não estiver definido no config, o evento é simplesmente ignorado — sem efeitos colaterais.


Carregamento por arquivo

// Slash command
export default new SlashCommand({
  name: "ping",
  description: "Pong!",
  run: async (client, interaction) => { ... },
});

// Prefix command
export default new PrefixCommand({
  name: "ping",
  aliases: ["p"],
  description: "Pong!",
  run: async ({ message }) => { ... },
});

// Evento
export default new EventHandler({
  event: "guildMemberAdd",
  run: async (client, member) => { ... },
});

// Interaction handler
export default new InteractionHandler({
  customId: "meu-botao",  // ou "prefixo:*" para wildcard
  run: async (client, interaction) => { ... },
});

Carregue os diretórios no seu index.ts:

await client
  .loadCommands("./dist/commands")
  .then(c => c.loadPrefixCommands("./dist/prefix"))
  .then(c => c.loadEvents("./dist/events"))
  .then(c => c.start());

Publicar atualização no npm — passo a passo

1. Fazer o build

npm run build

Isso compila src/ para dist/ (JS + tipos .d.ts).

2. Atualizar a versão no package.json

Edite o campo "version" manualmente, ou use:

npm version patch   # 1.1.0 → 1.1.1  (correção de bug)
npm version minor   # 1.1.0 → 1.2.0  (novidade sem quebrar)
npm version major   # 1.1.0 → 2.0.0  (quebra compatibilidade)

3. Login no npm (só na primeira vez)

npm login

4. Publicar

npm publish

Se o pacote for com escopo (ex: @axis/axislib), adicione --access public:

npm publish --access public

5. Verificar

npm view axislib version

Dica: inclua sempre o dist/ no .npmignore ao contrário — ou seja, não ignore o dist/, mas ignore src/, EXAMPLE.ts, etc. Crie um .npmignore:

src/
EXAMPLE.ts
tsconfig.json

Licença

MIT