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 🙏

© 2024 – Pkg Stats / Ryan Hefner

simplify-cord

v1.0.6

Published

SimplifyCord is an unofficial extension of the 'discord.js' library. Our extension aims to simplify the development of Discord bots, promoting cleaner code and easier maintenance.

Downloads

1,138

Readme

SimplifyCord

Uma estrutura simplificada para criar bots Discord usando TypeScript, focando em uma experiência de desenvolvimento mais limpa e intuitiva.

🚀 Características

  • ✨ Sistema de comandos simplificado
  • 🎮 Gerenciamento fácil de interações
  • 🛠️ Componentes pré-construídos (Embeds, Modais, Rows)
  • 📦 Importação automática de comandos e eventos
  • 🔧 Configuração simplificada

📋 Pré-requisitos

  • Node.js (versão 16.x ou superior)
  • TypeScript
  • Discord.js

🔧 Instalação

  1. Clone o repositório:
git clone [seu-repositorio]
  1. Instale as dependências:
npm install
  1. Configure seu bot no arquivo src/index.ts:
new bootstrapApp({ 
    // Importação automática de arquivos
    autoImport: ["src/commands", "src/events"],
    
    // Token do bot
    token: "TOKEN_AQUI",
    
    // Ativa logs detalhados
    loadLogs: true,
    
    // Configuração de comandos
    commands: {
        // Registra comandos apenas em servidores específicos
        guilds: ["ID_DO_SERVIDOR_1", "ID_DO_SERVIDOR_2", "ID_DO_SERVIDOR_3"],
        
        // Ou registra globalmente (não especifique guilds)
    }
})

📚 Guia de Uso

🤖 Slash Commands

Crie comandos slash com facilidade:

import { SlashCommand } from "simplify-cord"; 
import { ApplicationCommandType } from "discord.js";

new SlashCommand({
    name: "ping",
    description: "Pong",
    type: ApplicationCommandType.ChatInput,
    run: async (_client, interaction) => {
        await interaction.reply({
            content: "Pong!",
            ephemeral: true
        });
    }
})

🎛️ Componentes

Criando Botões

import { CreateRow } from "simplify-cord";
import { ButtonBuilder } from "discord.js";

const buttons = CreateRow([
    new ButtonBuilder({
        customId: `test-button/accept`,
        label: "Aceitar",
        style: 1
    }),
    new ButtonBuilder({
        customId: `test-button/decline`,
        label: "Recusar",
        style: 4
    })
])

Criando Select-Menus

import { CreateRow } from "simplify-cord";
import { StringSelectMenuBuilder } from "discord.js";

const buttons = CreateRow([
    new StringSelectMenuBuilder({
        customId: "select-menu",
        placeholder: "Selecione uma opção",
        options: [
            {
                label: "Opção 1",
                value: "option-1"
            },
            {
                label: "Opção 2",
                value: "option-2"
            }
        ]
    })
])

Criando Modais

import { CreateModal } from "simplify-cord";
import { TextInputStyle } from "discord.js";

const modal = CreateModal({
    title: "Título do Modal",
    customId: "modal-id",
    inputs: [
        {
            label: "Campo de texto",
            customId: "input-id",
            style: TextInputStyle.Short
        }
    ]
})

Criando Embeds

import { CreateEmbed } from "simplify-cord";

const embed = CreateEmbed({
    title: "Título do Embed",
    description: "Descrição do embed",
    color: "#FFFFFF",
    footer: { text: "Rodapé do embed" }
})

🎯 Sistema de Interações

Manipulador de Interações Básico

import { InteractionHandler, InteractionType } from "simplify-cord";
import { InteractionType } from "simplify-cord";

new InteractionHandler({
    customId: "test-button",
    type: InteractionType.Button // Qual tipo de interação,
    run: async (_client, interaction) => {
        await interaction.reply({
            content: "Botão clicado!",
            ephemeral: true
        });
    }
})

Sistema de Parâmetros em Interações

// Botão com parâmetros
new ButtonBuilder({
    customId: `button/:userId/:action`,
    label: "Botão com Parâmetros"
})

// Manipulador com parâmetros
new InteractionHandler({
    customId: "button/:userId/:action",
    type: InteractionType.Button,
    run: async (_client, interaction, { userId, action }) => {
        await interaction.reply({
            content: `Usuário: ${userId}, Ação: ${action}`,
            ephemeral: true
        });
    }
})

📡 Eventos

Crie listeners para eventos do Discord:

import { Event } from "simplifycord";

new Event({
    name: "Ready Event",
    event: "ready",
    async run() {
        console.log(`Bot online como ${client.user.tag}!`);
    }
})

🤝 Contribuindo

Contribuições são sempre bem-vindas! Sinta-se à vontade para:

  1. Reportar bugs
  2. Sugerir novas features
  3. Criar pull requests

📝 Licença

Este projeto está sob a licença ISC - veja o arquivo LICENSE para mais detalhes.

✨ Autor