What is Placeholder?
Last updated
Last updated
Here we gonna talk about the placeholder and its uses in our bot
We have a big issue without placeholder, which is... dynamic behavior
Assume you want this behavior:
Easy, right? Alright. Let's try to make it: 1- 2- pick as when 3- as for , it will be only one step -> 4- let's pick a channel that will be the starter channel 5- as for the content.. that's the tricky part. What will the content be?
As you know, we want something that changes depending on the situation
Like if the user is Abdi
Bot should say: Hi @Abdi
If user became ButterFly
Bot should say: Hi @ButterFly
and so on
As you can see, the content changed from Abdi to ButterFly
For now, let's send Hi <member>
as reply for step #5
Here comes Placeholders in the picture
using the placeholder <member>
. It will depending on the User. The response will not stay the same.
You now understand why we need it. To explain further... It's simple actually. Imagine placeholders as cards that you can use and these cards are given to you by or For example, in page, you will find it saying that this Starter provides some placeholders, one of them is , and this placeholder refers to the User who triggered the start of the Sketch. BINGO! That's the one we want. Instead of a simple and standard response from the bot, the placeholder called member can actually specifically respond to the User! With placeholders, the possibilities are endless! You can make the bot do much more.
So in the message content and any input, you can use placeholder this way:
Oh wait, isn't the name member
? What is mention
?
In our example, when asks for the content, we will input:
Well, you are looking down on placeholder, because it's not as simple as that.
Each placeholder is of a specific type. Like member
that we used in the previous example is of type
and this type provides some useful information about the User and not just mentions
the User
Let's say you don't want to mention the User actually but just want to print the name of that User After checking page, you will find there's exactly a property called name
that does this so the message will be:
Almost all examples use placeholders Click To see examples