![NPM](https://nodei.co/npm/rcommands.png)
RCommands
A powerfull command handler for discord.js bots
Navigation
Installation
NPM
npm install rcommands
Setup
After you successfully installed RCommands, you need to implement it to your bot.
To do so:
const { Client } = require("discord.js")
const RCommands = require("rcommands")
const client = new Client()
const db = {
dbOptions: {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
keepAlive: true,
},
mongoPath: "mongodb://..."
}
client.on("ready", () => {
new RCommands(client, {
cmdsDir: "commands",
db,
disabledDefaultCommands: [
]
})
.setDefaultPrefix("!")
})
client.login("your discord app token")
Creating Commands
Now its time to create a simple ping command
module.exports = {
name: "ping",
aliases: ["p"],
execute: (client, message, args, rClient) => {
message.channel.send(`${client.ws.ping}ms!`)
}
}