discord-bot-handler
v2.0.0
Published
A simple handler code with discord.js.
Downloads
2
Readme
discord-bot-handler Package!
It's important
The package is original package please don't try fake package;
import
npm i discord-bot-handler
Usage
const { CommandsBuilder } = require("discord-bot-handler");
const app = new CommandsBuilder({
client: client,
eventsFolder: "./events",
commandsFolder: "./commands",
});
Examples
const { Collection } = require('discord.js');
client.commands = new Collection();
app.loadEvents();
app.loadCommands();();
Events Files
module.exports = {
name: "<events name>",
execute(client) {
//Code
},
};
Events Examples
const prefix = "!";
module.exports = {
name: 'messageCreate',
execute(message, client) {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
if (!client.commands.has(command)) return;
try {
client.commands.get(command).execute(client, message, args);
} catch (error) {
console.error(error);
message.reply('there was an error trying to execute that command!');
}
},
}
Command Files
module.exports = {
name: 'ping',
async execute(message, args, client) {
message.channel.send("pong!")
}
}
Examples For All
My Server: Robux Factory
Version
2.0.0
Soon
SlashCommandBuilder
Developer
Slayver#0680