# Creating a Commands

This is the basic structure of a command.

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

```javascript
const Discord = require("discord.js");
module.exports = {
  name: "ping",
  aliases: ["pong"],
  execute({ bot, message, args, hkandler }) {
    let pingEmbed = new Discord.MessageEmbed()
      .setColor("RANDOM")
      .setTitle("Pong!")
      .setDescription(`API Latency: ${bot.ws.ping}ms!`);
    message.channel.send(pingEmbed);
  },
};
```

{% endcode %}
{% endtab %}

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

```typescript
import { Client, Message } from "discord.js"
import { HKandler } from "hkutilities/dist/structures/hkandler"
export = {
  name: "ping",
  execute({ bot, message, args, hkandler }: {bot: Client, message: Message, args: string[], hkandler: HKandler}) {
    let pingEmbed = new MessageEmbed()
      .setColor("RANDOM")
      .setTitle("Pong!")
      .setDescription(`API Latency: ${bot.ws.ping}ms!`);
    message.channel.send(pingEmbed);
  },
}
```

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

{% hint style="info" %}
You can use execute, run, or callback in your command with the default message event
{% endhint %}

With the default message event, the following properties can be used:

* Aliases => other names that the command can be called with
* clientPerms => the permission(s) that the bot will need when running a command
* userPerms => the permission(s) that the user will need when running a command
* minArgs => the minimum amount of arguments
* maxArgs => the maximum amount of arguments
* ownerOnly => set it so only bot owners can use the command
* cooldown => number of seconds between each command use per user
