Ping Command

This tutorial is available in both written and video form:

Video Tutorial

https://www.youtube.com/watch?v=MQ%5FfkbbXUTE

(ping command starts at 0:54)


Written Tutorial

Create Flow

Create a new flow.

This flow will be triggered by a slash command and will send a message with the bot’s ping.

Setup and Sync Command

Enter a name for the command. We’ll call it ping. After naming it, click Sync Command to make sure the command is linked to your Discord bot.

Add Discord API Ping Block

Switch to the Add Block page and add a Discord API Ping block. This block will fetch the bot’s current ping (latency).

Add Text Reply to Interaction Block

Next, add a Text Reply to Interaction block after the API Ping block. This will be the block that sends the message back to the user when they trigger the command.

Fill in Message Content

In the Message Content field, write:

“The bot’s ping is”

This will be the start of your message to the user.

Insert the Bot’s Ping

Now, click on Insert Variable in the message content.

Select Discord API Ping and choose Latency. This will insert the bot’s ping into the message.

Complete the Message

After the ping variable, type “ms” to indicate the value is in milliseconds.

Final Flow

Your flow will now look like this:

Slash Command

  • Discord API Ping
  • Text Reply to Interaction

Test Your Command

Go into a Discord server with your bot and run the /ping command. The bot should respond with a message like:

The bot’s ping is 94ms

If the command doesn’t show up, make sure you synced it from the trigger page.

Now your bot will respond with its ping whenever the /ping command is used!