I try to get delay between two messages from bot side.
await turn_context.send_activity(f"text1")
sleep(2)
await turn_context.send_activity(f"text2")
I tried different options but most works like after my respond to bot first runs sleep command and only after I receive text1 & text2 without delay.
How it could be solved? Thanks.
CodePudding user response:
I have used the below sample code to print the message delay by 4 seconds by using the await asyncio.sleep(4)
function with python version 3.7.*
sample code:
import asyncio
async def main():
print('message1 ...')
await asyncio.sleep(2)
print('... message2!')
# Python 3.7
asyncio.run(main())
Output screen for the sample code in VS code which delays by 4 seconds to print the message2 after printing the message1: