Hi, is there a way to capture the time it takes a ...
# 🤝help
b
I'm building a bot that will need to capture the time in minutes/seconds that it takes a user to respond to a bot's last statement or question. For example, if the bot asks the user "what is 1 + 1?" I need to capture the time it took from after the bot asks the math question to when the user submits an answer. Any help here is greatly appreciated, I'm curious whether this is a coding solution or if BP has built in capability to measure elapsed time. Thanks!
f
Hey, That's a very good question, can you tell me more about your use case?
I believe it is possible using the luxion library in an execute code card
something like: workflow.startTime = new DateTime() Then after the user responds: workflow.elapsedTime = (new DateTime() - workflow.startTime) /1000
I am not sure, I wrote this code here and didn't test it
b
Interesting, that's worth a try thanks for the input. I saw in the BP docs that you can enable showTimestamp after every comment, so that's one way to accomplish the necessary, but I agree an execute code card is the better route
f
@bored-eye-5625 how is it going?
b
@famous-jewelry-85388 well I got sidetracked by client demands and another pet project, so I haven't yet worked through this one. But once I do I'll post the results, I could see this being a useful little tool for a lot of use cases
f
Perfect!
I have marked this thread as solved. Please start a new thread in case you have new inquirie or questions 🙂
3 Views