> For the complete documentation index, see [llms.txt](https://docs.discordbotfactory.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.discordbotfactory.com/getting-started/commands.md).

# Creating Commands

Build your first prefix command by replying with \`Pong!\` when a user sends \`!ping\`.

Create your first command by building a simple `!ping` flow.

You’ll add a trigger, connect a reply action, then test the result in Discord.

{% hint style="info" %}
Complete [Quickstart](https://app.discordbotfactory.com/documentation/getting-started/quickstart) first if your bot is not set up yet.
{% endhint %}

Everything in the flow editor starts with a trigger node. When the trigger condition is met, connected actions run in sequence.

{% stepper %}
{% step %}

#### <i class="fa-flag">:flag:</i> Add a command trigger <a href="#add-a-command-trigger" id="add-a-command-trigger"></a>

Start by adding a **Prefix command** node to the canvas.

You can add nodes in two ways:

1. Use the node companion:

<div data-with-frame="true"><figure><img src="https://2205442932-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp603l6izRqmZfqN60GqQ%2Fuploads%2FLidYueYARjbPj9dZMsP0%2Fezgif-5278ab3ec8ae46d5.gif?alt=media&amp;token=949b4b17-291a-4048-8cba-09bc70216a43" alt=""><figcaption><p>Drag nodes onto the canvas to add them to the flow</p></figcaption></figure></div>

1. Right-click on the canvas with the node companion closed to open the Node Selector:

<div data-with-frame="true"><figure><img src="https://2205442932-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp603l6izRqmZfqN60GqQ%2Fuploads%2FvLJ0FZYHxTutJSrZW5HB%2Fezgif-7c09f8d5c49178d7.gif?alt=media&amp;token=6f351b74-40a3-4525-82fc-284a0c8608d1" alt=""><figcaption><p>Click nodes to add them at your cursor</p></figcaption></figure></div>
{% endstep %}

{% step %}

### <i class="fa-pen">:pen:</i> Configure the command

Double-click the new node to open the Node Properties menu.

Type <kbd>ping</kbd> into the **Command** field, then click **Save**.

{% hint style="info" %}
All commands are case-insensitive
{% endhint %}

<div data-with-frame="true"><figure><img src="https://2205442932-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp603l6izRqmZfqN60GqQ%2Fuploads%2FVAuL8MgC2I3MYJDKiYMu%2Fezgif-6f5eef9c6ca9c198.gif?alt=media&amp;token=80a9be65-b4a1-4b81-b7ca-42bc58674e5a" alt="Editing node properties"><figcaption><p>Editing the node properties</p></figcaption></figure></div>
{% endstep %}

{% step %}

### <i class="fa-memo">:memo:</i> Add a reply action

Open the node companion or Node Selector again.

Search for **Send a reply**, then add it to the canvas.

Next, connect the nodes. Click and drag from the **Output point** on the **Command** node to the **Trigger point** on the **Reply** node.

<div data-with-frame="true"><figure><img src="https://2205442932-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp603l6izRqmZfqN60GqQ%2Fuploads%2FqGo8f5FwfVRGMZoU4mqv%2Fezgif-5735f6313dbcf9d4.gif?alt=media&amp;token=a748f6a4-7d7f-47eb-9b27-72df495574de" alt=""><figcaption><p>Adding an action &#x26; Creating connections</p></figcaption></figure></div>
{% endstep %}

{% step %}

### <i class="fa-pen">:pen:</i> Write the response

Open the Node Properties menu for the **Reply** node. Set **Reply Text** to <kbd>Pong!</kbd>.

You don’t need to set the **Message ID**. Leaving it empty sends the reply to the message that triggered the command.

<div data-with-frame="true"><figure><img src="https://2205442932-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp603l6izRqmZfqN60GqQ%2Fuploads%2Fw2ajcxjDquee9SkQlj8q%2Fezgif-6537de89f519d270.gif?alt=media&amp;token=a5c861b0-19d3-4f0f-a4c6-78daacab5f74" alt=""><figcaption><p>Editing the message content</p></figcaption></figure></div>
{% endstep %}

{% step %}

### <i class="fa-play">:play:</i> Run and Test

Run your bot from the top-right corner.

Then open Discord and send `!ping` in a server where your bot is available.

If everything is set up correctly, the bot replies with `Pong!`.

<div data-with-frame="true"><figure><img src="https://2205442932-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp603l6izRqmZfqN60GqQ%2Fuploads%2F2FIBQEfq4MbEJNmvQ2xM%2Fezgif-614b8e1226b15cdd.gif?alt=media&amp;token=ff301385-d89f-4679-a57e-813557b31822" alt=""><figcaption><p>Running the bot</p></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="https://2205442932-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp603l6izRqmZfqN60GqQ%2Fuploads%2FY1Tf4iaAjuRTo4SJd8e8%2Fezgif-4fc593767961c255.gif?alt=media&amp;token=4607f687-554e-4cdf-89b1-9fc5aa939156" alt="" width="563"><figcaption><p>Testing in Discord</p></figcaption></figure></div>
{% endstep %}
{% endstepper %}

### Next steps <a href="#next-steps" id="next-steps"></a>

Once this works, try changing the reply text or adding more actions after the command trigger.

You can also build more advanced flows by combining triggers, conditions, and actions.
