Trying to show typing indicator

i am trying to show typing indicator in inbuilt action wait.js when wait.js executes nothing shows i want to show typing indicator till next thing is delayed to execute

@KristlyDsena The wait only delays further answers, the ideal way would be to send a typing event, then use the wait action, eg something like this

bp.events.replyToEvent(event, { type: 'typing', value: true })

sorry @allardy i don’t understand how to use it exactly.

You can check an example here:

Can you post the code you used to show typing indicators with the wait.js? I think I am trying to do the same thing as you, but am having zero luck. Thanks!

Hi @JoeyG

Here’s a working example to show the bot typing for the duration of the delay. I’ve edited the wait builtin action:

/**
   * Wait for a bit.
   *
   * @title Wait/Delay
   * @category Utility
   * @author Botpress, Inc.
   * @param {number} delay=1000 - The number of milliseconds to wait
   */
  const wait = async delay => {
    await bp.events.replyToEvent(event, [{ type: 'typing', value: delay }])
    return new Promise(resolve => setTimeout(() => resolve(), delay));
  };

  return wait(args.delay || 1000);

Hello allardy,

Can i use this script to edit the speed at which the bot replies to questions asked?