1.0.6 • Published 7 months ago

simplify-cord v1.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

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

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago

1.2.2

7 months ago

1.2.1

7 months ago

1.2.0

7 months ago

1.1.9

7 months ago

1.1.8

7 months ago

1.1.7

7 months ago

1.1.6

7 months ago

1.1.5

7 months ago

1.1.4

7 months ago

1.1.3

7 months ago

1.1.2

7 months ago

1.1.1

7 months ago

1.1.0

7 months ago