jh-shorten.ts
v1.1.9
Published
Acorta la creación de tu bot de Discord usando el lenguaje de programación TypeScript y la librería jh-shorten.ts
Downloads
531
Readme
La mejor NPM para acortar la creación de tu bot de Discord usando discord.js.
Crea tu cliente de manera fácil y de manera aún más fácil registras sus comandos e interacciones con el lenguaje de programación TypeScript
.
Características.
✨ Creación fácil y rápida de eventos y comandos. 👑 Fácil de aprender. 🔑 Segura y para todo público.
¡Todos los ejemplos necesarios los tendrás aquí abajo!
💯 Instalación.
Instala la dependencia con: npm i jh-shorten.ts
⚒️ Usó
Uso de la NPM: Empezemos por crear nuestra primera aplicación:
import shorten from "jh-shorten.ts";
// Definimos el cliente.
const client = new shorten.Client(true); // Colocamos todos los intents o partials al cliente (pueden modificarlo al gusto)
// Registremos la aplicación.
client.login("Bot token")
Una vez ya hecho eso, solo seguiría registrar los comandos.
Puedes colocar client.
para ver todas las cosas que saldrán de client
, entre ellas estará loadGlobalCommands
,
este lo usaremos para registrar y cargar nuestros comandos slash.
Cargaremos los comandos usando loadGlobalCommands
de la siguiente manera:
client.loadGlobalCommands("./slash_commands", // Remplazar con la ubicación de la carpeta de vuestros comandos slash.
"Bot token", // Token de tu bot.
"Bot ID", // ID de tu bot.
"Se han cargado los comandos slash de la aplicación." //Esto es opcional.
)
De esa manera aprendemos como crear nuestra aplicación, ponerla online y registrar los comandos slash {/} de manera fácil.
¿Cómo se estructuraría un comando slash usando esta NPM/dependencia?
👔 Creación de SlashCommands
import { SlashCommands } from "jh-shorten.ts";
export default new SlashCommands()
.setName(`ejemplo`)
.setDescription(`ejemplo.`)
.addExecute(async(interaction) => {
interaction.reply(`Esto es un ejemplo.`)
})
🪄 ¡Carga evento de manera sencilla!
// Importamos `shorten` de `jh-shorten.ts`.
import shorten from "jh-shorten.ts";
// Creamos el cliente.
const client = new shorten.Client(true) // Colocamos todos los intents y partials (puedes modificarlo a tu gusto.)
// Cargamos los eventos.
client.loadEvents("./events")
// Registramos la aplicación.
client.login("Bot token")
🔩 ¡Carga los botones que quieras!
// Importamos `shorten` de `jh-shorten.ts`.
import shorten from "jh-shorten.ts";
// Creamos el cliente.
const client = new shorten.Client(true) // Colocamos todos los intents y partials (puedes modificarlo a tu gusto.)
// Cargamos las interacciones de los botones a la carpeta `buttons`.
client.buttonInteraction("./buttons");
// Iniciamos el cliente.
client.login("Bot token");
¿Cómo deben estar estructurados los botónes?
De primeras, el nombre del archivo debe ser el customId
que le hayas colocado al botón.
-ejemplo.ts
Luego, el botón se estructuraría de esta manera:
module.exports = async(interaction) => {
// Aquí colocamos el código de lo que pasará al interactuar con el botón.
};
🛡️ Ayuda
Si necesitas ayuda, puedes escribirme a mi MD en Discord, encuentrame cómo: jhuwuu
.
¡Te espero! (Recuerda enviar solicitud de amistad)
Creador.
JhMix
Licencia.
The MIT License (MIT) Copyright (c) 2024 JhMix
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.