A simple discord command handler.
npm install @toadless/command-handlerjs
const Discord = require('discord.js')
const client = new Discord.Client()
client.login('TOKEN')
const Command = require('@toadless/command-handler')
client.on('ready', () => {
console.log('ready...')
new Command(client, './commands', '!')
})
`
Command File
`js
module.exports.run = async (bot, message, args) => {
//Do stuff
}
module.exports.help = {
name: 'COMMAND-NAME' //Command Name
}
`
Make sure that your command file is the same name as the command.
Also make sure that your commands are in a folder called commands.You can also listen for a prefix checked event:
`js
client.on('cmd-message', msg => {})
``