Hi all,
I am trying to add a delay between the message and the opening the link, but I am not able to do so using the Time.sleep() function in python.
How can I add a delay b/w the message and the (webbrowser.open(url))opening the link in new tab.
what is happening–> The url opens in the new tab then the message gets delevered in the bot what I want to do–> get the message and after 5 sec open the url.
Thanks in Advance… Please help me to sort this out
class ActionLink(Action):
def name(self) -> Text:
return "action_link"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
entities = tracker.latest_message['entities']
print(entities)
Intent = tracker.latest_message['intent']['name']
print(Intent)
for e in entities:
if e['entity'] == 'Solution_type_datascience' :
url = "http://forum.rasa.com/"
dispatcher.utter_message(text="Taking you to the data science page. The page will open in the new tab. Happy to help. 😄 ")
dispatcher.utter_message(text="Taking you to the data science source page")
webbrowser.open(url)
if e['entity'] == 'Solution_type_conversational_ai' :
url = "http://forum.rasa.com/"
dispatcher.utter_message(text="Taking you to the conversation ai page. The page will open in the new tab. Happy to help. 😄 ")
time.sleep(5)
webbrowser.open(url)
return []