Tutorial - Ping Command

Ping Command

This tutorial will teach you how to make a simple ping command. The ping command responds with the current latency between your bot and Discord.

Also available as a video tutorial (YouTube)

This tutorial is also available as a video tutorial if you prefer to watch:

How to create a flow

To create your first flow, head to the Components page (by clicking on “Components” in the sidebar).

image

Once you’ve opened the components sidebar, click the “plus” icon to create a new component.

image

We’re creating a flow, so don’t change the selection - just type in a name (like “Ping Command”, then click “Create”).

Step 1 - Set Slash Command Trigger

Flow triggers decide what action will start your flow. In this case, because we’re making a ping command, we want to trigger our flow with a slash command.

Pick Slash Command from the trigger list.

image

Step 2 - Set Command Name and Description

Set an appropriate command name and description.

We’re using ping as the command name and Check the latency of the bot. as the description, but you can set it to anything you want.

You should click the Sync Command button once you’re done to sync the command with Discord. We don’t need to change any other options for this command.

Step 3 - Add API Ping Block

The Discord API Ping block gets the current latency of Inventor’s connection to Discord.

To add this block to your flow, go to the Add Block menu and select Discord API Ping.

image

Step 4 - Add Interaction Response Block

This flow has a slash command trigger. Slash commands use Discord’s interactions system. Any triggers using Discord’s interaction system must have an interaction response block somewhere in the flow, or Discord will show an error.

In this case, we can just use the Text Reply to Interaction block, which will send a basic text reply to the user who ran the command. We’ll also use this to send back the latency value that we got from the API Ping block.

image

Step 5 - Insert Latency Variable into Message Content

Once you’ve added the Text Reply to Interaction block, we need to add the latency from the Discord API Ping block. This is where Variables come in.

Inventor blocks take inputs and give outputs. Every output can be inserted into the next block(s) using the Insert Variable menu.

In this case, we want to insert the latency value from the Discord API Ping block into the Text Reply to Interaction block.

To do this, click on Insert Variable under the Message Content field, then click Discord API Ping, then click Latency (Milliseconds).

image

Step 6 - Finishing Touches

Once the variable is inserted, you can type normally around it. When the flow is run, the variable will be replaced with the correct value.

At this point, you can add Pong! and a ms label to the message, as shown above.

image

Step 7 - You’re Done!

Go over to Discord to test it out. It should pop up in the slash command menu.

If it isn’t showing up, click on the Slash Command trigger at the top of the flow, and click Sync Command. It can take up to 5 minutes, but restarting your Discord client should force a sync.

If you’re confused or have any issues, make a post in Support. We’re happy to help!

image

Next Steps

If you’re looking for something else to do, check out these other tutorials:

2 Likes