> For the complete documentation index, see [llms.txt](https://tribui141108.gitbook.io/nocli-handler.js/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tribui141108.gitbook.io/nocli-handler.js/guides/commands/command-aliases.md).

# Command Aliases

Command Aliases are short forms to help run a command faster.

{% hint style="info" %}
Command Aliases can only be used for legacy commands. Unless you set the `slash` option in your command to `true`, command aliases will work for your command.
{% endhint %}

### Using `aliases` option

We will use the `ping` command as an example. Let's set aliases "p" and "pi" for this command:

{% tabs %}
{% tab title="JavaScript" %}
{% code title="ping.js" %}

```javascript
const { NoCliCommandType } = require("nocli-handler.js");

/**
 * @type {import("nocli-handler.js").ICommand}
 */
const Command = {
    aliases: ["p", "pi"], // <-- Set aliases
    type: NoCliCommandType.Both,
    description: "Checks client latency",
    callback: ({ client, message, args, text }) => {
        return `🏓 Pong! \`${client.ws.ping}ms\``;
    }
}

module.exports = Command;
```

{% endcode %}
{% endtab %}

{% tab title="TypeScript" %}
{% code title="ping.ts" %}

```typescript
import { ICommand, NoCliCommandType } from "nocli-handler.js";

export default {
    aliases: ["p", "pi"], // <-- Set aliases
    description: "Checks client latency",
    type: NoCliCommandType.Both,
    callback: ({ client, message, args, text }) => {
        return `🏓 Pong! \`${client.ws.ping}ms\``;
    }
} as ICommand;
```

{% endcode %}
{% endtab %}
{% endtabs %}

### End Result:

![](https://2061993693-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fxf3u6ixvplxDFSNlKMyF%2Fuploads%2F6f9iRIGstXu1wpUBfne3%2Fimage.png?alt=media\&token=9851a09f-9905-4567-bc3f-6668353117e5)
