# Ping Command

> How to build a basic /ping command that responds.

### Step 1 - Create Flow

Go to the components page and create a new flow.

![Screenshot](https://docs.inventorassets.com/e87173b6-915b-4887-8701-84178b6fbe9d.png)

Click **New Component**, type in the name of your component, make sure **Flow** is selected, then click **Create Component**.

> Custom blocks are a more advanced type of component you may want to use in the future, but for now you should create a basic flow.

### Step 2 - Select Trigger

You will be put on the trigger selection screen. Type `Slash Command` into the search bar, and pick it as your trigger.

![Screenshot](https://docs.inventorassets.com/bb7a2b30-2d4c-4124-a968-fb29a3ac93cd.png)

> Triggers are what cause your flow to run. You can pick anything from a message being sent to a reaction being added or a slash command being run.

### Step 3 - Configure Trigger

Configure the trigger by setting the command name and description. You can leave the rest of the fields blank/unchanged.

![Screenshot](https://docs.inventorassets.com/ec8fe526-beb4-4bf3-80ce-69c6e01574e2.png)

> Command Options allow the user running the command to provide additional data (e.g. the ID of a user to ban). For a basic ping command, it isn't neccesary, but command options are powerful for more complex flows.

### Step 4 - Add Blocks

Click Add Block, type `Discord API Ping` into the search box, and add the block to your flow.

![Screenshot](https://docs.inventorassets.com/d9e598ee-3ff7-4cc2-908a-587d879369fa.png)

Now, search for `Respond to Interaction with Text` and add that block to your flow.

![Screenshot](https://docs.inventorassets.com/6846708e-d779-4d5b-9250-4b8f98ee8684.png)

> This flow has a **Slash Command** interaction trigger, so you want to respond using a **Respond to Interaction** block.
>
> For flows without an interaction trigger, you will want to use a standard Send or Edit message block. See [What are Interactions?](/docs/resources/interactions) for more details.

### Step 5 - Configure Response

In the **Message Content** field, type `Pong!` then a space, then click **Insert Variable** below the field.

![image](https://docs.inventorassets.com/f6179adb-f354-4cc4-9a9b-f4e9bfec2f65.png)

Select **Discord API Ping**, then select **Latency (Milliseconds)**.

![image](https://docs.inventorassets.com/de428f21-df19-4da4-8048-ee5832f3f67e.png)

Type the letters `ms` after the variable.

![image](https://docs.inventorassets.com/e54a1a1f-26dc-4c6b-a1db-572d8eb0e065.png)

This will create a message that looks like: `Pong! 100ms` (if the output of the Discord API Ping block is `100`).

> You can use variables to pass data from one block to another. The Insert Variable menu makes it easy to insert the variables from one block into another.
>
> In inventor.bot, you should avoid guessing or assuming a variable format (e.g. $user or {user} will not work) and always use the Insert Variable button.

### Step 6 - Publish Flow

Publish your flow using the blue Publish button. You may need to click the green Save button (in the same location) before being able to publish.

![image](https://docs.inventorassets.com/ffcaed98-4a44-4872-9c67-5e5495022992.png)

> Changes you make to flows are automatically saved, but the latest version of a flow doesn't start running on your bot until you click Publish.
>
> Always remember to click Publish after making changes to flows if you want to see the changes on your bot.

### Step 7 - You're Done!

On Discord, you should now see a `/ping` command that responds with something like **Pong! 100ms**.

You may need to reload/restart your Discord client before the command shows up in the list.

You've now created your first flow, congrats!
