def create_event(summary, description, date): service = get_calendar_service() d = datetime.now().date() print(d.year) print(d.month) print(d.day) start = date.isoformat() end = (date + timedelta(hours=1)).isoformat() event_result = service.events().insert(calendarId='primary', body={ "summary": f'{summary}', "description": f'{description}', "start": { "dateTime": start, "timeZone": 'Asia/Kolkata' }, "end": { "dateTime": end, "timeZone": 'Asia/Kolkata' }, }).execute() print("created event") print("id: ", event_result['id']) print("summary: ", event_result['summary']) print("starts at: ", event_result['start']['dateTime']) print("ends at: ", event_result['end']['dateTime']) talk('event created successfully')
def weather_report(city_name): try: api_key = config.weather_api base_url = "https://api.openweathermap.org/data/2.5/weather?" city_name = city_name complete_url = base_url + "appid=" + api_key + "&q=" + city_name print(complete_url) response = requests.get(complete_url) x = response.json() print(x["cod"]) if x["cod"] != "404": y = x["main"] current_temperature = y["temp"] celcius = current_temperature - 273 current_humidiy = y["humidity"] z = x["weather"] weather_description = z[0]["description"] talk(" Temperature is " + str(round(celcius)) + 'degree celcius' + "\n humidity is " + str(current_humidiy) + 'percentage' + "\n description " + str(weather_description)) print(" Temperature is = " + str(round(celcius)) + "\n humidity (in percentage) = " + str(current_humidiy) + "\n description = " + str(weather_description)) if x["cod"] == "404": url = f'http://api.openweathermap.org/data/2.5/weather?lat={location()[0]}&lon={location()[1]}&appid={config.weather_api}' print(url) response = requests.get(url) x = response.json() y = x["main"] current_temperature = y["temp"] celcius = current_temperature - 273 current_humidiy = y["humidity"] z = x["weather"] weather_description = z[0]["description"] talk(" Temperature is " + str(round(celcius)) + 'degree celcius' + "\n humidity is " + str(current_humidiy) + 'percentage' + "\n description " + str(weather_description)) print(" Temperature is = " + str(round(celcius)) + "\n humidity (in percentage) = " + str(current_humidiy) + "\n description = " + str(weather_description)) except Exception as e: print(e) url = f'api.openweathermap.org/data/2.5/weather?lat={location()[0]}&lon={location()[1]}&appid={config.weather_api}'
def news_report(): try: results = [] url = f'https://newsapi.org/v2/top-headlines?sources=google-news-in&apiKey={config.news_api}' response = requests.get(url) x = response.json() articles = x["articles"] for titles in articles: results.append(titles["title"]) talk("Here are some top head lines I have found for you ") for i in range(len(results)): if i >= 3: continue print(i + 1, results[i]) news = i + 1, results[i] talk(news) except Exception as e: print(e)
def create_alarm(command): if ' every day ' in command: command = command.replace(' every day ', '') every_day = True elif ' every day' in command: command = command.replace(' every day', '') every_day = True else: every_day = False if ' at ' in command: command = command.split(' at ') alarm_time = command[1] if 'pm' in alarm_time: ampm = 'pm' alarm_time = alarm_time.replace('pm', '') else: ampm = 'am' alarm_time = alarm_time.replace('am', '') elif 'at ' in command: command = command.split('at ') alarm_time = command[1] if 'pm' in alarm_time: ampm = 'pm' alarm_time = alarm_time.replace('pm', '') else: ampm = 'am' alarm_time = alarm_time.replace('am', '') else: talk('At what time?') alarm_time = input('At what time? ') if 'pm' in alarm_time: ampm = 'pm' alarm_time = alarm_time.replace('pm', '') else: ampm = 'am' alarm_time = alarm_time.replace('am', '') alarm_time = alarm_time.split(':') alarm_hours = int(alarm_time[0]) alarm_minutes = int(alarm_time[1]) set_alarm(alarm_hours, alarm_minutes, every_day, ampm)
def list_events(): service = get_calendar_service() # Call the Calendar API now = datetime.utcnow().isoformat() + 'Z' # 'Z' indicates UTC time print('Getting List of events') talk('getting the list of events') events_result = service.events().list(calendarId='primary', timeMin=now, maxResults=3, singleEvents=True, orderBy='startTime').execute() events = events_result.get('items', []) if not events: print('No upcoming events found.') for event in events: start = event['start'].get('dateTime', event['start'].get('date')) print(event['summary']) talk(event['summary'])
def alarm_func(): from SKGEzhil_Voice_Assistant.script import current_time print('ringing') systime = f'{current_time.hours()}:{current_time.minutes()}' print(f'{current_time.hours()}:{current_time.minutes()}') print(f'Here is your remainder {exact_reminder}') from SKGEzhil_Voice_Assistant.script.speech_engine import talk print(exact_reminder) talk(f'Here is your remainder. {exact_reminder}') print(id(sqlite_cursor)) try: lock.acquire(True) sqlite_cursor.execute( f"UPDATE remainders SET activestatus = 'off' WHERE time = " f"'{current_time.hours()}:{current_time.minutes()}'") sqlite_connection.commit() finally: lock.release()
def create_reminder(command): if ' in ' in command: command = command.split(' in ') elif ' after ' in command: command = command.split(' after ') elif ' for ' in command: command = command.split(' for ') subject = command[0] timing = command[1] if 'to' in subject: subject = subject.split('to') remainder = subject[1] else: # speech_engine.talk('what is the remainder for?') remainder = input('what in the remainder for? ') # remainder = take_command() remind(remainder, timing) print(f'Remainder set for {timing}') speech_engine.talk(f'Remainder set for {timing}') reminder_alarm()
def google_search(received_command): custom_search_api = config.custom_search_api custom_search_id = config.custom_search_id query = received_command.replace('google ', '') page = 1 start = 1 url = f"https://www.googleapis.com/customsearch/v1?key=" \ f"{custom_search_api}&cx={custom_search_id}&q={query}&start={start}" data = requests.get(url).json() print(data) search_items = data.get("items") for i, search_item in enumerate(search_items, start=1): title = search_item.get("title") snippet = search_item.get("snippet") html_snippet = search_item.get("htmlSnippet") link = search_item.get("link") print("=" * 10, f"Result #{i + start - 1}", "=" * 10) print("Title:", title) print("Description:", snippet) print("URL:", link, "\n") talk(snippet) break
def cricket_score(): url = "https://www.cricbuzz.com/cricket-match/live-scores" r = requests.get(url) soup = BeautifulSoup(r.content, 'html5lib') table = soup.find('div', attrs={'id': 'page-wrapper'}) team = table.find('a', attrs={'class': 'text-hvr-underline text-bold'}) try: print((team.text.replace(',', '')).replace('vs', 'versus')) talk((team.text.replace(',', '')).replace('vs', 'versus')) team_1 = ((team.text.replace(',', '')).split('vs'))[0] team_2 = ((team.text.replace(',', '')).split('vs'))[1] print('Team 1: ' + team_1) print('Team 2:' + team_2) bat_team_select = table.find('div', attrs={'class': 'cb-text-live'}) absolute_team_1 = team_1.replace(' ', '') absolute_team_2 = team_2.replace(' ', '') bat_area = table.find('div', attrs={'class': 'cb-hmscg-bat-txt'}) bat_team = bat_area.find('div', attrs={'class': 'cb-ovr-flo cb-hmscg-tm-nm'}) if absolute_team_1[0] == bat_team.text[0]: print(team_1 + ' is batting') batting_team = team_1 elif 'RSA' in bat_team.text: print('South Africa is batting') batting_team = 'south africa' else: print(team_2 + ' is batting') batting_team = team_2 talk(batting_team + ' is batting now') for score_1 in table.findAll('div', attrs={'class': 'cb-hmscg-bat-txt'}): score = score_1.find( 'div', attrs={'style': 'display:inline-block; width:140px'}) real_score = score.text.replace('-', ' for ') print(real_score) if '(' not in real_score: talk(real_score + 'wickets') else: talk(real_score) break except Exception as e: print(e) print('No live matches now')
def calendar_commands(): global date_given, date_given, date_given, date_given, date_given, date_given from SKGEzhil_Voice_Assistant.script import google_calendar from datetime import datetime speech_engine.talk('What is the event') event = input('What is the event : ') speech_engine.talk('when is the event') time = input('when is the event : ') if 'tomorrow' in time: time_in_bool = True is_pm = False d = datetime.now().date() timetext = time.replace('tomorrow', '') if 'at' in timetext: timetext = timetext.replace('at', '') if 'am' in timetext: timetext = timetext.replace('am', '') elif 'pm' in timetext: timetext = timetext.replace('pm', '') is_pm = True else: time_in_bool = False speech_engine.talk('At what time : ') time_in = input('At what time : ') is_pm = False if 'at' in time_in: time_in = time_in.replace('at', '') if 'am' in time_in: time_in = time_in.replace('am', '') if 'pm' in time_in: time_in = time_in.replace('pm', '') is_pm = True print(time_in) if ' ' in time_in: time_in = time_in.replace(' ', '') print(time_in) exact_time = time_in.split(':') print(exact_time) print(exact_time[0]) print(exact_time[1]) minutes = int(exact_time[1]) hours = int(exact_time[0]) if is_pm: print('pm') hours = 12 + hours print(hours) google_calendar.create_event( event, ' ', datetime(d.year, d.month, d.day + 1, hours, minutes)) if time_in_bool: print(timetext) if ' ' in timetext: timetext = timetext.replace(' ', '') print(timetext) exact_time = timetext.split(':') print(exact_time) print(exact_time[0]) print(exact_time[1]) minutes = int(exact_time[1]) hours = int(exact_time[0]) if is_pm: print('pm') hours = 12 + hours print(hours) google_calendar.create_event( event, ' ', datetime(d.year, d.month, d.day + 1, hours, minutes)) elif 'monday' in time: monday_face = 1 d = datetime.now().date() day = datetime.now().weekday() day = day + 1 if monday_face < day: date_given = (7 - day) + monday_face elif monday_face > day: date_given = monday_face - day date_given = d.day + date_given print(date_given) year = month_year_change(date_given)[2] month = month_year_change(date_given)[1] date_given = month_year_change(date_given)[0] time_in_bool = True is_pm = False d = datetime.now().date() timetext = time.replace('monday', '') if 'at' in timetext: timetext = timetext.replace('at', '') if 'am' in timetext: timetext = timetext.replace('am', '') elif 'pm' in timetext: timetext = timetext.replace('pm', '') is_pm = True else: time_in_bool = False speech_engine.talk('At what time : ') time_in = input('At what time : ') is_pm = False if 'at' in time_in: time_in = time_in.replace('at', '') if 'am' in time_in: time_in = time_in.replace('am', '') if 'pm' in time_in: time_in = time_in.replace('pm', '') is_pm = True print(time_in) if ' ' in time_in: time_in = time_in.replace(' ', '') print(time_in) exact_time = time_in.split(':') print(exact_time) print(exact_time[0]) print(exact_time[1]) minutes = int(exact_time[1]) hours = int(exact_time[0]) if is_pm: print('pm') hours = 12 + hours print(hours) google_calendar.create_event( event, ' ', datetime(2021, 3, date_given, hours, minutes)) if time_in_bool: print(timetext) if ' ' in timetext: timetext = timetext.replace(' ', '') print(timetext) exact_time = timetext.split(':') print(exact_time) print(exact_time[0]) print(exact_time[1]) minutes = int(exact_time[1]) hours = int(exact_time[0]) if is_pm: print('pm') hours = 12 + hours print(hours) google_calendar.create_event( event, ' ', datetime(year, month, date_given, hours, minutes)) elif 'tuesday' in time: tuesday_face = 2 d = datetime.now().date() day = datetime.now().weekday() day = day + 1 if tuesday_face < day: date_given = (7 - day) + tuesday_face elif tuesday_face > day: date_given = tuesday_face - day date_given = d.day + date_given print(date_given) year = month_year_change(date_given)[2] month = month_year_change(date_given)[1] date_given = month_year_change(date_given)[0] time_in_bool = True is_pm = False d = datetime.now().date() timetext = time.replace('tuesday', '') if 'at' in timetext: timetext = timetext.replace('at', '') if 'am' in timetext: timetext = timetext.replace('am', '') elif 'pm' in timetext: timetext = timetext.replace('pm', '') is_pm = True else: time_in_bool = False speech_engine.talk('At what time : ') time_in = input('At what time : ') is_pm = False if 'at' in time_in: time_in = time_in.replace('at', '') if 'am' in time_in: time_in = time_in.replace('am', '') if 'pm' in time_in: time_in = time_in.replace('pm', '') is_pm = True print(time_in) if ' ' in time_in: time_in = time_in.replace(' ', '') print(time_in) exact_time = time_in.split(':') print(exact_time) print(exact_time[0]) print(exact_time[1]) minutes = int(exact_time[1]) hours = int(exact_time[0]) if is_pm: print('pm') hours = 12 + hours print(hours) google_calendar.create_event( event, ' ', datetime(2021, 3, date_given, hours, minutes)) if time_in_bool: print(timetext) if ' ' in timetext: timetext = timetext.replace(' ', '') print(timetext) exact_time = timetext.split(':') print(exact_time) print(exact_time[0]) print(exact_time[1]) minutes = int(exact_time[1]) hours = int(exact_time[0]) if is_pm: print('pm') hours = 12 + hours print(hours) google_calendar.create_event( event, ' ', datetime(2021, 3, date_given, hours, minutes)) elif 'wednesday' in time: wednesday_face = 3 d = datetime.now().date() day = datetime.now().weekday() day = day + 1 if wednesday_face < day: date_given = (7 - day) + wednesday_face elif wednesday_face > day: date_given = wednesday_face - day date_given = d.day + date_given print(date_given) year = month_year_change(date_given)[2] month = month_year_change(date_given)[1] date_given = month_year_change(date_given)[0] time_in_bool = True is_pm = False d = datetime.now().date() timetext = time.replace('wednesday', '') if 'at' in timetext: timetext = timetext.replace('at', '') if 'am' in timetext: timetext = timetext.replace('am', '') elif 'pm' in timetext: timetext = timetext.replace('pm', '') is_pm = True else: time_in_bool = False speech_engine.talk('At what time : ') time_in = input('At what time : ') is_pm = False if 'at' in time_in: time_in = time_in.replace('at', '') if 'am' in time_in: time_in = time_in.replace('am', '') if 'pm' in time_in: time_in = time_in.replace('pm', '') is_pm = True print(time_in) if ' ' in time_in: time_in = time_in.replace(' ', '') print(time_in) exact_time = time_in.split(':') print(exact_time) print(exact_time[0]) print(exact_time[1]) minutes = int(exact_time[1]) hours = int(exact_time[0]) if is_pm: print('pm') hours = 12 + hours print(hours) google_calendar.create_event( event, ' ', datetime(2021, 3, date_given, hours, minutes)) if time_in_bool: print(timetext) if ' ' in timetext: timetext = timetext.replace(' ', '') print(timetext) exact_time = timetext.split(':') print(exact_time) print(exact_time[0]) print(exact_time[1]) minutes = int(exact_time[1]) hours = int(exact_time[0]) if is_pm: print('pm') hours = 12 + hours print(hours) google_calendar.create_event( event, ' ', datetime(2021, 3, date_given, hours, minutes)) elif 'thursday' in time: thursday_face = 4 d = datetime.now().date() month = d.month year = d.year day = datetime.now().weekday() day = day + 1 date_given = 0 if thursday_face < day: date_given = (7 - day) + thursday_face elif thursday_face > day: date_given = thursday_face - day date_given = d.day + date_given print(date_given) year = month_year_change(date_given)[2] month = month_year_change(date_given)[1] date_given = month_year_change(date_given)[0] time_in_bool = True is_pm = False d = datetime.now().date() timetext = time.replace('thursday', '') if 'at' in timetext: timetext = timetext.replace('at', '') if 'am' in timetext: timetext = timetext.replace('am', '') elif 'pm' in timetext: timetext = timetext.replace('pm', '') is_pm = True else: time_in_bool = False speech_engine.talk('At what time : ') time_in = input('At what time : ') is_pm = False if 'at' in time_in: time_in = time_in.replace('at', '') if 'am' in time_in: time_in = time_in.replace('am', '') if 'pm' in time_in: time_in = time_in.replace('pm', '') is_pm = True print(time_in) if ' ' in time_in: time_in = time_in.replace(' ', '') print(time_in) exact_time = time_in.split(':') print(exact_time) print(exact_time[0]) print(exact_time[1]) minutes = int(exact_time[1]) hours = int(exact_time[0]) if is_pm: print('pm') hours = 12 + hours print(hours) google_calendar.create_event( event, ' ', datetime(year, month, date_given, hours, minutes)) if time_in_bool: print(timetext) if ' ' in timetext: timetext = timetext.replace(' ', '') print(timetext) exact_time = timetext.split(':') print(exact_time) print(exact_time[0]) print(exact_time[1]) minutes = int(exact_time[1]) hours = int(exact_time[0]) if is_pm: print('pm') hours = 12 + hours print(hours) google_calendar.create_event( event, ' ', datetime(year, month, date_given, hours, minutes)) elif 'friday' in time: friday_face = 5 d = datetime.now().date() month = d.month year = d.year day = datetime.now().weekday() day = day + 1 if friday_face < day: date_given = (7 - day) + friday_face elif friday_face > day: date_given = friday_face - day date_given = d.day + date_given print(date_given) year = month_year_change(date_given)[2] month = month_year_change(date_given)[1] date_given = month_year_change(date_given)[0] time_in_bool = True is_pm = False d = datetime.now().date() timetext = time.replace('friday', '') if 'at' in timetext: timetext = timetext.replace('at', '') if 'am' in timetext: timetext = timetext.replace('am', '') elif 'pm' in timetext: timetext = timetext.replace('pm', '') is_pm = True else: time_in_bool = False speech_engine.talk('At what time : ') time_in = input('At what time : ') is_pm = False if 'at' in time_in: time_in = time_in.replace('at', '') if 'am' in time_in: time_in = time_in.replace('am', '') if 'pm' in time_in: time_in = time_in.replace('pm', '') is_pm = True print(time_in) if ' ' in time_in: time_in = time_in.replace(' ', '') print(time_in) exact_time = time_in.split(':') print(exact_time) print(exact_time[0]) print(exact_time[1]) minutes = int(exact_time[1]) hours = int(exact_time[0]) if is_pm: print('pm') hours = 12 + hours print(hours) google_calendar.create_event( event, ' ', datetime(year, month, date_given, hours, minutes)) if time_in_bool: print(timetext) if ' ' in timetext: timetext = timetext.replace(' ', '') print(timetext) exact_time = timetext.split(':') print(exact_time) print(exact_time[0]) print(exact_time[1]) minutes = int(exact_time[1]) hours = int(exact_time[0]) if is_pm: print('pm') hours = 12 + hours print(hours) google_calendar.create_event( event, ' ', datetime(year, month, date_given, hours, minutes)) elif 'saturday' in time: saturday_face = 6 d = datetime.now().date() month = d.month year = d.year day = datetime.now().weekday() day = day + 1 if saturday_face < day: date_given = (7 - day) + saturday_face elif saturday_face > day: date_given = saturday_face - day date_given = d.day + date_given print(date_given) year = month_year_change(date_given)[2] month = month_year_change(date_given)[1] date_given = month_year_change(date_given)[0] time_in_bool = True is_pm = False d = datetime.now().date() timetext = time.replace('saturday', '') if 'at' in timetext: timetext = timetext.replace('at', '') if 'am' in timetext: timetext = timetext.replace('am', '') elif 'pm' in timetext: timetext = timetext.replace('pm', '') is_pm = True else: time_in_bool = False speech_engine.talk('At what time : ') time_in = input('At what time : ') is_pm = False if 'at' in time_in: time_in = time_in.replace('at', '') if 'am' in time_in: time_in = time_in.replace('am', '') if 'pm' in time_in: time_in = time_in.replace('pm', '') is_pm = True print(time_in) if ' ' in time_in: time_in = time_in.replace(' ', '') print(time_in) exact_time = time_in.split(':') print(exact_time) print(exact_time[0]) print(exact_time[1]) minutes = int(exact_time[1]) hours = int(exact_time[0]) if is_pm: print('pm') hours = 12 + hours print(hours) google_calendar.create_event( event, ' ', datetime(year, month, date_given, hours, minutes)) if time_in_bool: print(timetext) if ' ' in timetext: timetext = timetext.replace(' ', '') print(timetext) exact_time = timetext.split(':') print(exact_time) print(exact_time[0]) print(exact_time[1]) minutes = int(exact_time[1]) hours = int(exact_time[0]) if is_pm: print('pm') hours = 12 + hours print(hours) google_calendar.create_event( event, ' ', datetime(year, month, date_given, hours, minutes)) elif 'sunday' in time: sunday_face = 7 d = datetime.now().date() month = d.month year = d.year day = datetime.now().weekday() day = day + 1 if sunday_face < day: date_given = (7 - day) + sunday_face elif sunday_face > day: date_given = sunday_face - day date_given = d.day + date_given print(date_given) year = month_year_change(date_given)[2] month = month_year_change(date_given)[1] date_given = month_year_change(date_given)[0] time_in_bool = True is_pm = False d = datetime.now().date() timetext = time.replace('sunday', '') if 'at' in timetext: timetext = timetext.replace('at', '') if 'am' in timetext: timetext = timetext.replace('am', '') elif 'pm' in timetext: timetext = timetext.replace('pm', '') is_pm = True else: time_in_bool = False speech_engine.talk('At what time : ') time_in = input('At what time : ') is_pm = False if 'at' in time_in: time_in = time_in.replace('at', '') if 'am' in time_in: time_in = time_in.replace('am', '') if 'pm' in time_in: time_in = time_in.replace('pm', '') is_pm = True print(time_in) if ' ' in time_in: time_in = time_in.replace(' ', '') print(time_in) exact_time = time_in.split(':') print(exact_time) print(exact_time[0]) print(exact_time[1]) minutes = int(exact_time[1]) hours = int(exact_time[0]) if is_pm: print('pm') hours = 12 + hours print(hours) google_calendar.create_event( event, ' ', datetime(year, month, date_given, hours, minutes)) if time_in_bool: print(timetext) if ' ' in timetext: timetext = timetext.replace(' ', '') print(timetext) exact_time = timetext.split(':') print(exact_time) print(exact_time[0]) print(exact_time[1]) minutes = int(exact_time[1]) hours = int(exact_time[0]) if is_pm: print('pm') hours = 12 + hours print(hours) google_calendar.create_event( event, ' ', datetime(year, month, date_given, hours, minutes))
def run_assistant(): # received_command = take_command() received_command = input("enter u'r commands here: ") print(received_command) if 'command not received' in received_command: no_command_received = True else: no_command_received = False while no_command_received: print('no command received') received_command = take_command() if 'play' in received_command: import pywhatkit song = received_command.replace('play', '') talk('playing ' + song + 'song') pywhatkit.playonyt(song) elif 'who created you' in received_command: talk('I was created by yeskejji yelil') elif 'your name' in received_command: talk('My name is yeskejji yelil') elif 'time' in received_command: import datetime time = datetime.datetime.now().strftime('%I:%M %p') talk('The time is now' + time) print(time) elif 'who is' in received_command: try: person = received_command.replace('who is', '') info = wikipedia.summary(person, 1) print(info) talk(info) except Exception as e: print(e) print("Not found in wikipedia") try: app_id = "HK8VGY-K22567Q59V" question = received_command.replace('ask', '') client = wolframalpha.Client('R2K75H-7ELALHR35X') res = client.query(question) answer = next(res.results).text print(answer) talk(answer) except Exception as e: print(e) print('I cant understand what u are speaking') google_search(received_command) elif 'joke' in received_command: joke = pyjokes.get_joke() talk(joke) print(joke) elif 'weather' in received_command: print('ok') city_name = last_word(received_command) from SKGEzhil_Voice_Assistant.script import weather weather.weather_report(city_name) print('weatherrr') elif 'event' in received_command: if 'what' in received_command: google_calendar.list_events() else: from SKGEzhil_Voice_Assistant.script import calendar_commands calendar_commands.calendar_commands() elif 'news' in received_command: from SKGEzhil_Voice_Assistant.script import news news.news_report() elif 'mail' in received_command: from SKGEzhil_Voice_Assistant.script import mail mail.read_mail() elif 'inbox' in received_command: from SKGEzhil_Voice_Assistant.script import mail mail.read_mail() elif 'google' in received_command: google_search(received_command) elif 'mean' in received_command: from PyDictionary import PyDictionary dictionary = PyDictionary() meaning = dictionary.meaning(last_word(received_command)) print(meaning) y = meaning["Noun"] for i in y: print(i) talk(i) break elif 'score' in received_command: from SKGEzhil_Voice_Assistant.script import cricket cricket.cricket_score() elif 'remember that' in received_command: from SKGEzhil_Voice_Assistant.script import remember received_command = received_command.replace('remember that', '') remember.remember(received_command) elif 'kept' in received_command: if 'remember' not in received_command: from SKGEzhil_Voice_Assistant.script import remember key_word = last_word(received_command) remember.retrieve(key_word) else: from SKGEzhil_Voice_Assistant.script import remember received_command = received_command.replace('remember that', '') remember.remember(received_command) elif 'alarm' in received_command: from SKGEzhil_Voice_Assistant.script import alarm alarm.create_alarm(received_command) elif 'wake' in received_command: from SKGEzhil_Voice_Assistant.script import alarm alarm.create_alarm(received_command) elif 'remind' in received_command: from SKGEzhil_Voice_Assistant.script import reminder reminder.create_reminder(received_command) else: try: question = received_command.replace('ask', '') client = wolframalpha.Client(config.wolframalpha_api) res = client.query(question) answer = next(res.results).text print(answer) talk(answer) except Exception as e: print(e) print('I cant understand what u are speaking') google_search(received_command) logs(received_command)