https://discord.gg/botpress logo
#👀feature-requests
a way to delay messages
# 👀feature-requests
m

mysterious-cricket-72777

10/16/2023, 4:24 PM
Delay messages
c

crooked-van-25152

10/16/2023, 4:40 PM
Can you please explain why this feature would be important and if you would need this on a card basis?
m

mysterious-cricket-72777

10/16/2023, 6:10 PM
If you integrate a bot to insta and you want it to look like a human
Or Facebook
c

crooked-van-25152

10/16/2023, 6:22 PM
I see
s

silly-france-49174

10/16/2023, 6:51 PM
Copy code
async function waitNSeconds(n) {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve()
    }, n)
  })
}

// Usage
console.log('Start waiting...')
await waitNSeconds(5000) // 5000 = 5s adjust waiting time here
paste that into an execute code card
c

crooked-van-25152

10/16/2023, 7:00 PM
Thank you @silly-france-49174 ❤️ knowing how to code just makes life easier 😉
l

late-sunset-89256

10/17/2023, 3:11 PM
@silly-france-49174 @crooked-van-25152 knowing JS is cool but having to manually add this code block each time is quite tedious can we have a dedicated card for this ? Also this only adds a a "delay" -> a "typing" motion would be 10X better IMO
c

crooked-van-25152

10/17/2023, 3:20 PM
Yes, so that's why @mysterious-cricket-72777 added it to the feature request channel.
Just wanted to tag you in the meantime, if you feel like you really need this feature.
I'm not sure if and when this will be implemented.
Make sure to upvote this feature, so it gets attention 🙂
n

nice-salesclerk-98217

10/17/2023, 8:58 PM
Upping this, pump it
j

jolly-policeman-82775

11/03/2023, 4:40 AM
you can
with this CSS: async function waitNSeconds(n) { return new Promise((resolve) => { setTimeout(() => { resolve() }, n) }) } // Usage console.log('Start waiting...') await waitNSeconds(5000) // 5000 = 5s adjust waiting time here
so lets say you have 2 text nodes
and put this inbetween them in a execute card and then it will delay the next text
and thaks to my boy @wide-oyster-38514 for getting this code for everyone
c

crooked-van-25152

11/06/2023, 6:50 PM
@wide-oyster-38514 big shoutout to you for helping the community! ❤️
w

wide-oyster-38514

11/06/2023, 7:50 PM
Thanks Sabrina, I appreciate it a lot🙂
w

worried-window-19446

01/11/2024, 3:39 PM
Hi, guys, I did not understand what do you mean by CSS here, isn't is just a Javascript code? Is there a place where we can store the code, so that it can be reused?
w

wide-oyster-38514

01/11/2024, 3:49 PM
It is a Javascript code, you paste it into the execute code card👍
w

worried-window-19446

01/11/2024, 3:50 PM
@wide-oyster-38514 Thanks! But the code needs to be repeated in every execute code card, right?
w

wide-oyster-38514

01/11/2024, 3:50 PM
Yes unfortunately