1.3.5 • Published 3 years ago
discordhandler v1.3.5
How To Use ?
to start installed the discordhandler package
npm i discordhandler
after create a file and paste this
// require the modules
const DiscordHandler = require('discordhandler');
// initialized the bot
const client = new DiscordHandler("PREFIX_BOT", false); // category True Or False
// run the bot
client.run("TOKEN_BOT")
// this function is started at the start of the bot
client.ready(function() {
console.log(`connected in ${client.getNameBot()}`)
})
// loads commands
client.loadCommands('./DIR_NAME')
after create the folder for the handler then create a file: example.js
And Past This
module.exports.run = (client, message, args, DiscordHandler) => {
// then the commands work with discord.js
message.channel.send("tested !" + DiscordHandler.getAuthor())
}
module.exports.help = {
name : 'NAME_COMMAND'
}
Load Events
after, paste this in the index file
const DiscordHandler = require('discordhandler');
// initialized the bot
const client = new DiscordHandler("PREFIX_BOT", false); // category True Or False
// run the bot
client.run("TOKEN_BOT")
// this function is started at the start of the bot
client.ready(function() {
console.log(`connected in ${client.getNameBot()}`)
})
// loads commands
client.loadCommands('./DIR_NAME/')
// loads events
client.loadEvents('./DIR_NAME/')
and create file in dir events, ex : ready.js
module.exports = (client) => {
// code (discord.js code)
console.log("the bot is connected !")
}
-Features-
- LoadsEvents
- setName() function.