---
description: Get started with our easy-to-use command handler
---

# Dynamic Command Handling

### Starting Up

First, create a folder called "cmds". This will be your commands folder. Then, make a subfolder for each command module. For example, misc, music, economy. In each folder make a module.js file.

{% code title="module.js" %}
```javascript
module.exports = {
    key: "misc", // Module Key (LOWERCASE!)
    name: "Miscelaneous", // Module Name
    desc: "Misc commands" // Module Description
}
```
{% endcode %}

For each command, make a file in the folder. for example, ping.js

{% code title="ping.js" %}
```javascript
module.exports = {
    name: "ping", // Command Name
    module: "misc", // Must be a valid key to a module.
    execute: (client, message, args) => {
        // Your code here
        message.channel.send(`Pong! ${client.ws.ping}ms`)
    }
}
```
{% endcode %}

So on so forward.

### Incorporating it to our code

{% code title="index.js" %}
```javascript
// Imports
const { Client, commandHandler } = require("djsplus")

// Client
let client = new Client()

// Config
client.config.prefix = "?" // Command Prefix

// Command Handler
commandHandler(client, __dirname)

// Login
client.login("Your bot token")
```
{% endcode %}

