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.