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

jh-shorten.js

v1.1.3

Published

Acorta la creación de tu bot de Discord usando el lenguaje de programación JavaScript y la librería jh-shorten.js

Downloads

291

Readme

¿Quieres acortar la creación de tu bot? Pues usa jh-shorten.js para acortarla usando el lenguaje de programación JavaScript.

📜 Instalación:

Instala la dependencia con el comando "npm i jh-shorten.js".

🔩 Creación de nuestro cliente:

Podemos empezar creando un archivo llamado index.js, para empezar con nuestro código. En consola colocarás npm i discord.js para instalar la dependencia discord.js que será necesaría. (debes tener ya instala la dependencia jh-shorten.js)

Procedemos a crear nuestra primera aplicación:

// Importamos `Client` de nuestra librería.
const { Client } = require("jh-shorten.js");

// Definimos la aplicación.
const client = new Client(true);

// Cremos nuestro primer evento que indicará cuando el bot este en línea.
client.on(`ready`, async(client) => {
    console.log(`Cliente en línea!`)
});

// Logueo/Inicio de la aplicación.
client.login("Token");

Con eso ya sería suficiente

✨ Carga de eventos:

Para cargar nuestros eventos, ahora debemos crear una carpeta en nuestro directorio llamada events, donde estarán los eventos.

Una vez creada, debemos cargar los evento de alguna manera, ¿no? Aquí es donde entra nuestra librería:

Podemos agregar esta línea de código a nuestro index.js:

// Cargamos los eventos.
client.loadEvents("./events", "Se han cargado los eventos.");

Nos debe quedar de esta forma:

// Importamos `Client` de nuestra librería.
const { Client } = require("jh-shorten.js");

// Definimos la aplicación.
const client = new Client(true);

// Cargamos los eventos.
client.loadEvents("./events", "Se han cargado los eventos.");

// Logueo/Inicio de la aplicación.
client.login("Token");

Ahora, dentro de nuestra carpeta events haremos el primer evento: ready, así que dentro de la carpeta creamos un archivo llamado ready.js, donde podemos poner el siguiente código:

module.exports = {
    name: `ready`,

    execute: async(client) => {
        console.log(`Bot en línea!`)
    }
};

Y listo, solo sería iniciar tu bot y debería salir algo cómo: Bot en línea en la consola.

👑 Creador:

JhMix

🛡️ Soporte:

Para recibir ayuda, puedes escribirme a mi MD a travez de Discord, envía solicitud al siguiente usuario: jhuwuu y explica tu problema una vez te acepte solicitud.