https://discord.gg/botpress logo
#🤝help
Bot response time?
# 🤝help
c

creamy-airplane-93471

07/25/2023, 8:52 AM
I have lots of text fields, so i dont want user to get overwhelmed, so how i can make the bot respond slowly taking time after each text is sent? giving it a little humanly feeling for taking his time to text.
@witty-football-93730 can u help?
a

acceptable-kangaroo-64719

07/25/2023, 10:53 AM
Hey Sorrento, pop this in an execute code card wherever you want the bot to wait
Copy code
js
async function waitNSeconds(n) {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve()
    }, n)
  })
}

// Usage
console.log('Start waiting...')
await waitNSeconds(10000) // 10000 milliseconds = 10 seconds
This will wait 10 seconds. You can change the duration by modifying the last line. 10,000 = 10 seconds; 5,000 = 5 sec, etc
m

mysterious-action-40978

08/25/2023, 1:10 PM
their appears to be an error on resolve()
nevermind, all works