# Your first command

> Make a /hello command that greets whoever runs it. Takes two minutes.

You will make `/hello`. When someone runs it, the bot replies:

> Hello @Alex, welcome to My Server!

## Before you start

1. [Add the bot](https://ccbot.app/invite) to your server.
2. Open the [dashboard](https://ccbot.app/dashboard) and pick your server.

You need the **Manage Server** permission in that server.

## 1. Create the command

On the dashboard, open **Create → Slash Command**.

Fill in **Basic details**:

| Field | Value |
|---|---|
| Command Name | `hello` |
| Description | `Say hello` |

The description shows under the command name in Discord's command menu. Keep it short.

> **Note:** Names use lowercase letters, numbers, `-` and `_`. No spaces. Discord rule.

## 2. Write the reply

Scroll to **Response**. In **Content / Reply Message**, type:

```text
Hello {user.mention}, welcome to {server.name}!
```

Text inside `{ }` is a **variable**. The bot fills it in when the command runs:

| Variable | Becomes |
|---|---|
| `{user.mention}` | A ping of the person who ran the command |
| `{user.display_name}` | Their name, without a ping |
| `{server.name}` | Your server's name |
| `{server.member_count}` | How many members the server has |
| `{channel.mention}` | The channel the command ran in |

## 3. Save

Press **Save**. The command is now on the dashboard.

Discord needs to learn about new commands. The dashboard does this for you. If you see **Sync required** at the top, press **Sync now**.

## 4. Try it

In your server, type `/hello` and press Enter.

> **Command not showing?:** Discord can take up to a minute. Press `Ctrl + R` to reload Discord. Still missing? Check the bot has the **Use Application Commands** permission in that channel.

## Make it better

### Only the user sees the reply

Under **Behavior**, turn on **Only the user sees the reply**. Good for help commands, so the chat stays clean.

### Add an option

Under **Arguments**, add a **Member** argument named `friend`. Then change the reply:

```text
{user.mention} says hello to {friend.mention}!
```

Every argument becomes a variable with the same name.

### Use an embed

Make an embed under **Embeds**, then pick it in **Reply Embed**. Variables work in embeds too.

### Add some code

Want a random pick? Open **Pre-hook** and add:

```python
greeting = random(["Hello", "Hi", "Hey", "Welcome"])
```

Then use it in the reply:

```text
{greeting} {user.mention}!
```

The pre-hook runs before the reply is sent. Anything you make there can go in the reply with `{ }`.
