Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
from what import sentence_what #1-22 Bartosz
from why import sentence_why
from weather import weather_ask
from Setup import setup_time
from Setup import reset
from Setup import load_setting
from who import sentence_who
from greetings import respond
from play import uGoogle, play
from chatmaths import entre
from changes import changes
from thanks import thanks
from help import helps
from facebook import facebook
from youtube import youtube
from how import sentence_how
from whatsapp import whatsapp
from calculator import calculator
from map import destin
from translation import translate
from send_email import *
from time import calendar_reminder
import subprocess #Necessary to execute a program from the computer #24-25 Andre
import os #provides a portable way of using operating system functionalities
global name #27-28 Artur
global city
'''This function searches, if the input calls any function or printings ''' #30-34 Bartosz
def check(sentence): #putting the appropriate input, calls the particular function from other files.
try:
if "why" in sentence:
sentence_why(sentence)
elif "weather in" in sentence or "weather for" in sentence or "weather today" in sentence: #35-43 Artur
if "weather today" not in sentence: # Taking the value of city (which user gave on the beginning) and using it into a weather_ask function. In practice showing the weather for the current location.
temporary, Lcity = sentence.split('weather')
Lcity = Lcity.replace('in ', '')
Lcity = Lcity.replace('for ', '')
weather_ask(Lcity)
else: # Taking the particular city name which user will pass through the program and give the weather information about that place.
sentence = city
weather_ask(sentence)
elif "exit" in sentence or 'bye' in sentence: #44-112 Bartosz
global running
running = False
elif "plus" in sentence or "minus" in sentence or "times" in sentence or "less" in sentence or "+" in sentence or "divided" in sentence or "*" in sentence or "/" in sentence or "-" in sentence:
entre(sentence)
elif "facebook" in sentence:
facebook(sentence)
elif "next" in sentence:
play("random")
elif "open" in sentence:
uGoogle(sentence)
elif "calendar" in sentence or "reminder" in sentence:
calendar_reminder(sentence)
elif "music" in sentence:
play(sentence)
elif "run" in sentence: #Runs a subprocess like cmd, notepad and opening control panel
sentence = sentence.replace("run ", "")
os.system(sentence)
subprocess.Popen(sentence)
elif "!setup" in sentence: # Deleting the file "settings.txt" and creating a new one with new data by calling function reset. In practice asking the user for all details one more time.
reset()
elif "send" in sentence or "email" in sentence:
create_email()
elif 'how' in sentence:
sentence_how(sentence)
elif "who" in sentence:
sentence_who(sentence)
elif "play" in sentence:
play(sentence)
elif "change" in sentence:
changes(sentence)
elif "hello" in sentence or "sup" in sentence or "hey" in sentence or "hi" in sentence:
respond(sentence)
elif "what" in sentence or "wiki" in sentence:
sentence_what(sentence)
elif "!help" in sentence:
print(helps)
elif "appmessage" in sentence:
whatsapp(sentence)
elif "calculator" in sentence:
calculator(sentence)
elif "direction" in sentence or "map" in sentence:
destin()
elif "translate" in sentence:
translate(sentence)
elif "funny" in sentence or "interesting" in sentence:
print("NO.")
elif 'fine' in sentence:
print("Nice to hear that :)")
elif "!help" in sentence:
print(helps)
elif 'thank' in sentence:
print("You're welcome")
elif 'no you' in sentence:
print('Yes, I am')
elif 'rude' in sentence or 'vulgar' in sentence:
print("But, It's the truth")
elif 'foreigners' in sentence:
print("Alan, Andre, Artur, Bartosz, Premo, Zeid")
elif "bartosz" in sentence or "andre" in sentence or "premo" in sentence or "zeid" in sentence or "alan" in sentence or "artur" in sentence:
print("I love him")
elif "you" in sentence:
thanks()
else:
print("I don't understand type !help to see available options")
except:
print("Operation not available..")
#113-119 Artur
reset() # Calling the function which deletes text file (data inside) after the program will end, so that a new data (name and city) can be created and stored next time while main code run.
running = True
setup_time() # Calling the function which checks if text file with data been created, if not create it and store the username and location (city).
name = load_setting(
0) # Taking a variable name from stored data and use it while the program is running by calling the user.
city = load_setting(
1) # Taking a variable city from stored data and use it while a user is asking for the weather for a particular location.
while running: #Chatbot conducts conversation by a loop #120-122 Bartosz
query = input("")
query = query.lower() #123-126 Artur
if "!setup" in query: # String "!setup" calling the function "reset" in the first place. All data since then been removed, therefore calling a load_setting function to could ask for and store new data (name and city).
check(query)
name = load_setting(0)
city = load_setting(1)
else: #Bartosz
check(query)