Create a delay function that would allow you to set a delay(5s-10s) before the bot sends the next message.
l
little-scientist-91622
08/04/2023, 4:09 PM
I double the delay request. Is it possible to implement this in a code block?
b
broad-librarian-27137
08/05/2023, 9:36 PM
Tried this some time ago and at least I could not make a simple JS sleep work. Perhaps someone else has nailed this one down?
l
little-scientist-91622
08/07/2023, 6:49 AM
this code worked for me
I entered this in the AI code generator: await delay 5000ms
The code generated was:
const delay = async (ms) => {
await new Promise(resolve => setTimeout(resolve, ms))
}
await delay(5000)