Skip to content

Commit

Permalink
Update app.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Ankit404butfound authored Jan 14, 2021
1 parent a8e3701 commit 540a334
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import wikipedia
import sqlite3
import pyjokes
import requests

now = datetime.now().strftime("%H:%M")
user_commands = []
Expand Down Expand Up @@ -217,6 +218,13 @@ def get_bot_response():
if "joke" in lst:
return pyjokes.get_joke()

fact_cond = ["facts", "fact","intresting thing","surprise me"]
if any(cond in userText for cond in fact_cond):
data = requests.get("https://www.generatormix.com/random-facts-generator").content
soup = BeautifulSoup(data)
fact = soup.find("blockquote",attrs = {'class':"text-left"})
return (fact.text)


else:
try:
Expand All @@ -228,4 +236,4 @@ def get_bot_response():
return "Sorry. I do not have the answer to your query, so I'm searching the web for the answer ."

if __name__ == "__main__":
app.run()
app.run()

0 comments on commit 540a334

Please sign in to comment.