1.0.1 • Published 1 year ago

bot-handlers v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

bot-handlers

instalación.

$ npm install bot-handlers

Estructura de los handlers.

Los handlers usan subcarpetas, por lo que tus comandos y eventos deben ir clasificados en subcarpetas.

Bot/

— Comandos/

— — Util/

— — — ping.js

— — — clear.js

— — Moderacion/

— — — ban.js

— — — kick.js

— Eventos/

— — Client/

— — — ready.js

— — Guild/

— — — guildMemberAdd.js

— — — guildMemberRemove.js

representación en imagen.

ejemplo index.js.

const Discord = require('discord.js');
const handlers = require('bot-handlers');

const client = new Discord.Client({
  intents: [
    Discord.GatewayIntentBits.Guilds,
    Discord.GatewayIntentBits.GuildMessages,
    Discord.GatewayIntentBits.MessageContent,
    Discord.GatewayIntentBits.GuildMembers
  ]
});

client.commands = new Discord.Collection();

handlers.commands(client.commands, 'commands');
handlers.events(client, 'events');

client.login('TOKEN AQUÍ');

Estructura para comandos.

module.exports = {
  name: "ping",
  alias: ['p'],
  async run (client, message, args) {
    message.reply("Pong!");
  }
}

Estructura para eventos.

module.exports = {
  name: 'ready',
  async run (client) {
    console.log(client.user.tag, 'esta list@!');
  }
}