> For the complete documentation index, see [llms.txt](https://discord-cmds.js.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://discord-cmds.js.org/handler/command.md).

# command

## Making commands

* For making a command first make a folder `commands/`
* now in the folder, make a file! Example: ping.js
* now add this codes in it!

### Making commands!

```javascript
module.exports = {
    name: 'ping',
    description: 'Shows latency ping!',
    options: [],
    run: async({ interaction, client, args, reply, editReply }) => {
        let r = await reply({ content: "hi" + interaction.member }) //interaction will be slash interaction when user uses slash command but if users uses normal then interaction will me message!
    }
}
```

### Arguments in command!

```javascript
module.exports = {
    name: 'say',
    description: 'Shows latency ping!',
    options: [{
        name: 'input',
        type: 'STRING',
        description: 'The input to echo back',
        required: true,
    }],
    run: async({ interaction, client, args, reply, editReply }) => {
        let r = await reply({ content: "hi" + interaction.member }) //interaction will be slash interaction when user uses slash command but if users uses normal then interaction will me message!
        await editReply(r, { content: "hello"})
    }
}
```

### All types of arguments

```javascript
STRING
INTEGER
BOOLEAN
USER
CHANNEL
ROLE
MENTIONABLE
SUB_COMMAND_GROUP
SUB_COMMAND
```

### context menu

```javascript
module.exports = {
    name: 'ping',
    description: 'Shows latency ping!',
    options: [],
    type: "MESSAGE", //USER if you want it to stay as slash command remove type: "",
    run: async({ interaction, client, args, reply, editReply }) => {
        let r = await reply({ content: "hi" + interaction.member }) //interaction will be slash interaction when user uses slash command but if users uses normal then interaction will me message!
    }
}
```

### user Permissions

```javascript
module.exports = {
    name: 'say',
    description: 'Shows latency ping!',
    userRequiredPermissions: "ADMINISTRATOR", //["ADMINISTRATOR","MANAGE_GUILD"]
    options: [{
        name: 'input',
        type: 'STRING',
        description: 'The input to echo back',
        required: true,
    }],
    run: async({ interaction, client, args, reply, editReply }) => {
        let r = await reply({ content: "hi" + interaction.member }) //interaction will be slash interaction when user uses slash command but if users uses normal then interaction will me message!
        await editReply(r, { content: "hello"})
    }
}
```

### client Permissions

```javascript
module.exports = {
    name: 'say',
    description: 'Shows latency ping!',
    clientRequiredPermissions: "SEND_MESSAGES",
    options: [{
        name: 'input',
        type: 'STRING',
        description: 'The input to echo back',
        required: true,
    }],
    run: async({ interaction, client, args, reply, editReply }) => {
        let r = await reply({ content: "hi" + interaction.member }) //interaction will be slash interaction when user uses slash command but if users uses normal then interaction will me message!
        await editReply(r, { content: "hello"})
    }
}
```

### bot owner only

```javascript
module.exports = {
    name: 'say',
    description: 'Shows latency ping!',
    ownerOnly: true, //go to main file and where you have constructed discord-cmds.js add ownerID: ""
    options: [{
        name: 'input',
        type: 'STRING',
        description: 'The input to echo back',
        required: true,
    }],
    run: async({ interaction, client, args, reply, editReply }) => {
        let r = await reply({ content: "hi" + interaction.member }) //interaction will be slash interaction when user uses slash command but if users uses normal then interaction will me message!
        await editReply(r, { content: "hello"})
    }
}
```
