question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

delay text output

See original GitHub issue

Is your feature request related to a problem? Please describe.

When trying to fake the interaction with a real human, the user expects that the other end needs some time to write the response. The send response settings should allow a non-zero delay in the answer.

Describe the solution you’d like

Either allow new Activity { Type = ActivityTypes.Typing } and new Activity { Type = "delay", Value= xxx } as separate dialog elements, or add a parameter in the send an activity UI to include this

Additional context

The framework allows the use of a typing indicator https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-howto-send-messages?view=azure-bot-service-4.0&tabs=csharp

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:21 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
reinolduscommented, Oct 14, 2020

I switched to writing the bot in code entirely in the meantime.

What I am doing in my “code bot” is the following:

async def send_message(context, message: Dict[str, str]):
    if isinstance(context, WaterfallStepContext):
        context = context.context
    text = message['text']
    await context.send_activity(MessageFactory.text(text))
    sleep_time = (len(text.split(" ")) / 5)
    await asyncio.sleep(sleep_time)

In conjunction with: ADAPTER.use(ShowTypingMiddleware(delay=0.5, period=2.0))

So after each message has been sent, the bot waits len(text.split(" ")) / 5 seconds. The reasoning behind that is: This time frame is approximately the time an average reader needs to read the message just sent (https://capitalizemytitle.com/reading-time/1000-words/). In my tests that worked pretty well, because you do not want to wait for the bot to type, you just don’t want to be flooded with messages. So this is pretty much what @EricDahlvang described.

With all my new experience with implementing the bot in code, I would have loved to see these features in the composer:

  • Have a general option that does what @EricDahlvang described.
  • Have the option to delay each activity individually, because if you “quiz” a user about something, it feels more natural if the next question is delayed by a second or something (just my UX-experience)
  • It would probably be helpful if one could set all these options by message type, so you can globally set a delay of e.g. 1 second for every “Prompt”-type.
  • It is vital that all of these delays can be disabled easily so you can test it quickly without any waiting time.

I hope that clears up what I was looking for.

Thank you for your support!

1reaction
cwhittencommented, Aug 24, 2020

@reinoldus I will re-open and transfer to https://github.com/microsoft/botbuilder-dotnet for continued discussion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

making text appear delayed - java
The first error message is telling you that you can't put a public static void main there - you probably already have one...
Read more >
Python sleep(): How to Add Time Delays to Your Code
In this code, you create a worker called output() that takes in the number of seconds to sleep and the text to print...
Read more >
Linux Command > output.txt with delay
Try using the wait command. Like this: top -bn 1 > output.txt & wait. It's supposed to wait until that process is complete...
Read more >
How to add time delay in Python?
1.Set the value of delay in seconds. 2.Get the current time using time.monotonic() and assign it to start_time. 3.Enter ...
Read more >
How to Add Delay in Java For Few Seconds
The easiest way to delay a java program is by using Thread. sleep() method. The sleep() method is present in the Thread class....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found