1.3.5 • Published 3 years ago

rcommands v1.3.5

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

NPM

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://..." // your mongodb connection uri
}

client.on("ready", async () => {
    const rcommands = await new RCommands(client, { // initialize a new RCommands instance
        cmdsDir: `${__dirname}/commands`, // your commands folder
        db
    })
    .setDefaultPrefix("!")

    rcommands.cmder(rcommands)
})

client.login("your discord app token")

Creating Modules

It is time to create our first command module!

Create a folder into the "commands" directory named "test" then, create a file named module.js inside it, then add the following contents to it.

module.exports = {
    key: "test",
    name: "Test",
    description: "Testing commands"
}

Creating Commands

Now its time to create a simple ping command

// file name: ping.js
// folder: ./commands/test

module.exports = {
    name: "ping", // the command name
    module: "test" // the command module
    aliases: ["p"], // optional
    execute: (client, message, args, rClient) => {
        message.channel.send(`${client.ws.ping}ms!`)
    }
}
1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago