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

@elephant.js/discord.js

v1.3.2

Published

Uma base sólida para criar bots confiáveis sem perder tipagem ou controle de eventos.

Downloads

936

Readme

🐘 @elephant.js/discord.js

npm version license

O Elephant.js/discord.js é um framework opinativo construído sobre o discord.js v14, projetado para oferecer uma experiência de desenvolvimento superior com foco em tipagem estrita, organização modular e componentes declarativos.


✨ Novidades da v1.3.2

  • 🧩 Subpacote de Componentes: Novo import @elephant.js/discord.js/components para criação de interfaces.
  • 📝 Criação Declarativa: Crie Embeds, Botões e Modais usando objetos simples { ... }.
  • 💡 IntelliSense de Elite: Documentação JSDoc completa em todas as propriedades para dicas em tempo real no VS Code.
  • 🌐 Internacionalização: Suporte nativo a name_localizations e description_localizations no createCommand.
  • 🛡️ ActionRow Inteligente: Nova estrutura de ActionRow que simplifica a organização de componentes.

📦 Instalação

pnpm add @elephant.js/discord.js discord.js

🏗️ Estrutura Recomendada

├── index.ts                # Ponto de entrada (Login)
├── discord.config.ts       # Configuração do Client e App
├── src/
│   └── discord/
│       ├── index.ts        # Setup de criadores e middlewares
│       ├── commands/       # Pasta de comandos
│       └── events/         # Pasta de eventos
└── package.json

🚀 Guia de Início Rápido

1. Configuração (discord.config.ts)

import { GatewayIntentBits, ActivityType } from "discord.js";
import { createClient, createApp } from "@elephant.js/discord.js";

export const bot = {
  TOKEN: "SEU_TOKEN",
  ID: "SEU_CLIENT_ID",
};

export const client = createClient({
  intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages],
});

export const { setupCreators } = createApp({
    token: bot.TOKEN,
    clientId: bot.ID,
    guildIds: []
}, {
    client,
    slash: {
        dir: "./src/discord/commands",
        ext: [".ts", ".js"],
    },
    presence: {
        status: "online",
        activities: [{ name: "Elephant.js v1.3.2", type: ActivityType.Playing }],
    },
    hooks: {
        onReady: (c) => console.log(`Bot online como ${c.user?.tag}`),
    },
});

2. Criadores e Middlewares (src/discord/index.ts)

import { setupCreators } from "../../discord.config";

export const { createCommand, createEvent } = setupCreators({
  commands: {
    defaultCommandOptions: { cooldown: 3 },
  },
  responders: {
    async middleware(interaction, block) {
      // Sua lógica global aqui
    },
  },
});

🧩 Componentes Declarativos (/components)

A v1.3.2 introduz uma forma muito mais limpa de criar interfaces usando objetos.

Embeds

import { Embed } from "@elephant.js/discord.js/components";

const embed = new Embed({
  title: "Título do Embed",
  description: "Descrição detalhada",
  color: "Blue",
  fields: [
    { name: "Campo 1", value: "Valor 1", inline: true }
  ],
  footer: { text: "Elephant.js" }
});

Botões e ActionRows

import { Button, ActionRow } from "@elephant.js/discord.js/components";

const row = new ActionRow({
  components: [
    new Button({
      style: "Success",
      customId: "confirm",
      label: "Confirmar",
      emoji: "✅"
    }),
    new Button({
      style: "Link",
      label: "Docs",
      url: "https://elephant.js.org"
    })
  ]
});

Modais e TextInputs

import { Modal, TextInput } from "@elephant.js/discord.js/components";

const modal = new Modal({
  customId: "form",
  title: "Meu Formulário",
  fields: [
    new TextInput({
      customId: "name",
      label: "Seu Nome",
      style: "Short",
      required: true
    })
  ]
});

💬 Comandos com Localização

import { createCommand } from "../index";
import { ApplicationCommandType } from "discord.js";

export default createCommand({
  name: "ping",
  description: "Replies with pong",
  type: ApplicationCommandType.ChatInput,
  name_localizations: {
    "pt-BR": "ping",
  },
  description_localizations: {
    "pt-BR": "Responde com pong",
  },
  async run(interaction) {
    await interaction.reply("Pong! 🏓");
  },
});

⚙️ Referência da API

createApp(botConfig, appOptions)

| Parâmetro | Descrição | | :--- | :--- | | botConfig.guildIds | Array de IDs para registro imediato em servidores (vazio = global). | | appOptions.hooks | Ciclo de vida: onReady, onShutdown. |

setupCreators(options)

| Opção | Descrição | | :--- | :--- | | responders.middleware | Função executada antes de qualquer comando. Use block() para cancelar. |


📄 Licença

MIT © ARC Studio, Inc.


Elephant.js — Tipado. Seguro. Simples. 🐘