12 Commits
v1.0 ... main

Author SHA1 Message Date
0634ffcd6d Updated Libraries & One Command requirements file 2022-02-05 17:11:13 +05:30
6e1d61f6a5 Beefing Up! v2.o Release Source Code 2021-03-13 09:44:14 +05:30
Puranjay Savar Mattas
0d419c95ac Readme & Index Update 2020-12-22 15:26:38 +05:30
Puranjay Savar Mattas
7a66fc5d2c GitHub Page index file 2020-12-22 12:01:38 +05:30
Puranjay Savar Mattas
e9f40a3a5d Set theme jekyll-theme-hacker 2020-12-22 11:50:21 +05:30
Puranjay Savar Mattas
f9295b342d Delete CNAME 2020-12-22 11:43:00 +05:30
Puranjay Savar Mattas
a6edfdb549 Create CNAME 2020-12-22 11:38:41 +05:30
Puranjay Savar Mattas
ad564d0bfc Set theme jekyll-theme-hacker 2020-12-22 11:36:16 +05:30
Puranjay Savar Mattas
624097808c Update issue templates 2020-12-21 18:21:24 +05:30
Puranjay Savar Mattas
0bec6a99bb Create CONTRIBUTING.md 2020-12-21 18:20:53 +05:30
Puranjay Savar Mattas
46e49c04db Merge pull request #3 from psavarmattas/add-code-of-conduct-1
Create CODE_OF_CONDUCT.md
2020-12-21 18:18:40 +05:30
Puranjay Savar Mattas
cb44cb0598 Create CODE_OF_CONDUCT.md 2020-12-21 18:18:02 +05:30
17 changed files with 436 additions and 92 deletions

38
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View File

@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

0
.gitignore vendored Normal file
View File

View File

@@ -1,3 +1,2 @@
{ {
"python.pythonPath": "C:\\Users\\puran.MANEESHA\\anaconda3\\envs\\alexa\\python.exe"
} }

76
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at puranjaysavarmattas@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

1
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1 @@
If you want to contribute to this project and have a fun time, then you can just fill out [this form](https://psmforums.wordpress.com/support/) to get in touch with us.

12
Dockerfile Normal file
View File

@@ -0,0 +1,12 @@
FROM python
WORKDIR /PSMBot-Virtual-Assistant
COPY /main.py .
COPY /weather.py .
COPY news.py .
COPY requirements.txt .
RUN pip install requirements.txt
CMD [ "python", "main.py" ]

Binary file not shown.

Binary file not shown.

1
_config.yml Normal file
View File

@@ -0,0 +1 @@
theme: jekyll-theme-hacker

90
index.md Normal file
View File

@@ -0,0 +1,90 @@
# **Create your own virtual assistant with just a few lines code (Using only PYTHON)**
_`Last Updated: March 13' 2020`_
Hello & Welcome to this git page. Here I just created my own
virtual assistant with just a few lines of code. It is not an
issue if you are a beginner, or an advanced coder this way of
building your own virtual assistant is very simple and quick.
The only major thing required from your side is the will to go
step by step with me and by the end of it you will have your own
virtual assistant up & running as a charm.
To learn more about how I did it you can watch my YouTube
video on this or [click here](https://www.youtube.com/channel/UCz6SDxk2KQqJAD6Ra_YPm6A).
## Pre-Requisites:
1. Python Interpreter (Like [PyCharm](https://www.jetbrains.com/pycharm/))
2. Python Environment (Like [Anaconda](https://www.anaconda.com/products/individual))
3. This [git repo](https://github.com/psavarmattas/PSMBot-Virtual-Assistant.git)
4. Bellow mentioned python packages:
-> [speechrecognition](https://pypi.org/project/SpeechRecognition/)
-> [pyttsx3](https://pypi.org/project/pyttsx3/)
-> [pywhatkit](https://pypi.org/project/pywhatkit/)
-> [wikipedia](https://pypi.org/project/wikipedia/)
-> [pyjokes](https://pypi.org/project/pyjokes/)
-> [wolframalpha](https://pypi.org/project/wolframalpha/)
5. Basic knowledge of how Python works & computers work
6. A will to explore
7. Get API keys for the following to test your assistant yourself or
just use the one I provide you with but it is better to use your API keys
so that you don't bottle neck you assistant.
When all the above pre-requisites are there and ready you can
start to work on your own virtual assistant. Please follow each
and every step in order & if you have any error just go to the issues
to see if you find any issue that matches your which is already
resolved before opening an issues.
## Steps:
### For Windows users:
1. Open PyCharm & create a new project with your virtual environment ready.
2. Open the terminal and paste the following in sequential order line by line(Execute it one by one):
`pip install speechRecognistion`
`pip install pyttsx3`
`pip install pywhatkit`
`pip install wikipedia`
`pip install pyjokes`
`pip install wolframalpha`
_Install this if necessary (Only when the code gives error)_
`pip install pyaudio`
3. Copy the code given in main.py (in this git) & you will have the code up & running on your pc.
_(Note: Creating two different files for weather & main you will have to import weather.py in the main.py file by using the `import weather` code in the main.py, therefore please make sure that the code for it is there or an error will be produced while running the weather command in the assistant.)_
4. If you want to learn how this code actually works the go [watch my YouTube video](https://www.youtube.com/channel/UCz6SDxk2KQqJAD6Ra_YPm6A) for a better understanding.
### For Linux/MacOs users:
1. Learn all the above commands on terminal.
2. Make sure to use pip3, because in linux pip refers for python2 and pip3 refers to python3.
3. Install this too - `pip3 install pyAudio`.
## Feature List (v2.0):
1. Play videos on YouTube.
2. Search Wikipedia with your queries.
3. Search google with your queries.
4. Listen to jokes.
5. Ask for the weather (Anywhere in the world).
6. It can solve complex math problems for you.
7. Ask it for today's date & time.
8. Say "thanks" or "thank you" and the assistant will appreciate you.

54
main.py
View File

@@ -1,4 +1,4 @@
# Copyright (c) 2020 PSMForums. All rights reserved. # Copyright (c) 2021 PSMForums. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
@@ -16,7 +16,10 @@ import pywhatkit
import datetime import datetime
import wikipedia import wikipedia
import pyjokes import pyjokes
import wolframalpha
import weather import weather
import requests, json
import pprint
listener = sr.Recognizer() listener = sr.Recognizer()
engine = pyttsx3.init() engine = pyttsx3.init()
@@ -61,11 +64,6 @@ if __name__ == "__main__":
elif 'time' in command: elif 'time' in command:
time = datetime.datetime.now().strftime('%I:%M %p') time = datetime.datetime.now().strftime('%I:%M %p')
talk('Current time is ' + time) talk('Current time is ' + time)
elif 'search on wikipedia' in command:
search = command.replace('search on wikipedia', '')
info = wikipedia.summary(search, 6)
print('Searching ' + info)
talk(info)
elif 'search on google' in command: elif 'search on google' in command:
searchg = command.replace('search on google', '') searchg = command.replace('search on google', '')
pywhatkit.search(searchg) pywhatkit.search(searchg)
@@ -77,23 +75,35 @@ if __name__ == "__main__":
elif 'joke' in command: elif 'joke' in command:
talk('Let me get you laughing...') talk('Let me get you laughing...')
talk(pyjokes.get_joke()) talk(pyjokes.get_joke())
elif 'weather' in command: elif "what is the weather in" in command:
command = command.replace('weather', '') command = command.split(" ")
if weather.response.status_code == 200: location = str(command[5])
talk('The Weather In:') url = weather.weather_url + "appid=" + weather.api_key + "&q=" + location
talk(weather.weather_city) js = requests.get(url).json()
print(weather.weather_city) if js["cod"] != "404":
talk(weather.weather_temperature) weather = js["main"]
print(weather.weather_temperature) temp = weather["temp"]
talk(weather.weather_humidity) hum = weather["humidity"]
print(weather.weather_humidity) desc = js["weather"][0]["description"]
talk(weather.weather_pressure) resp_string = "The temperature at " + location + " in Kelvin is " + str(temp) + " \nThe humidity is " + str(hum) + "\nand \nThe weather description is "+ str(desc)
print(weather.weather_pressure) print(resp_string)
talk(weather.weather_report) talk(resp_string)
print(weather.weather_report)
else: else:
talk(weather.weather_error) print("City Not Found")
print(weather.weather_error) talk("City Not Found")
elif 'calculate' in command:
app_id = "JWP25T-Y434EXL697" #Your API key here
client = wolframalpha.Client(app_id)
indx = command.lower().split().index('calculate')
query = command.split()[indx + 1:]
res = client.query(' '.join(query))
answer = next(res.results).text
print('The answer is ' + answer)
talk('The answer is:' + answer)
elif 'thank you' in command:
talk('Your welcome, Happy to help you')
elif 'thanks' in command:
talk('Your welcome, Happy to help you')
elif 'stop' in command: elif 'stop' in command:
break break
else: else:

55
news.py Normal file
View File

@@ -0,0 +1,55 @@
import pyttsx3
import requests
import json
import time
url = ('https://newsapi.org/v2/top-headlines?'
'country = in&'
'apiKey =')
url += 'e3adedf2b3c54560b27338ef2bac6af8' #Your API key here
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)
rate = engine.getProperty('rate')
engine.setProperty('rate', 150)
try:
response = requests.get(url)
except:
engine.talk("can't access link, please check your internet ")
news = json.loads(response.text)
for new in news['articles']:
# print(str(new['title']), "\n\n")
news_title = (str(new['title']))
# print(str(new['description']), "\n\n")
news_description = (str(new['description']))
time.sleep(2)
# from urllib.request import urlopen
# from bs4 import BeautifulSoup as soup
# def news():
# try:
# news_url = "https://news.google.com/news/rss"
# Client = urlopen(news_url)
# xml_page = Client.read()
# Client.close()
# soup_page = soup(xml_page, "xml")
# news_list = soup_page.findAll("item")
# li = []
# for news in news_list[:15]:
# li.append(str(news.title.text.encode('utf-8'))[1:])
# return li
# except Exception as e:
# print(e)
# return False

31
notes.txt Normal file
View File

@@ -0,0 +1,31 @@
# import news
# from googlemaps import GoogleMaps
# elif 'news' in command:
# talk(news.news_title)
# print(news.news_title + '\n')
# print('-----------------------------------------------------------------------------------------\n')
# talk(news.news_description)
# print(news.news_description + '\n')
# print('-----------------------------------------------------------------------------------------\n')
# print(command)
# news_res = command.news()
# talk(f"I have found {len(news_res)} news. You can read it. Let me tell you first 2 of them")
# talk(news_res[0])
# print(news_res[0])
# talk(news_res[1])
# print(news_res[1])
# print(news_res)
# elif 'open maps' in command:
# command = command.replace('open maps', '')
# gmaps = GoogleMaps(api_key)
# print('Opening Maps...')
# talk('Opening Maps')
# print('What do you want to find?')
# talk('What do you want to find')
# local = gmaps.local_search(destination)
weather api key = "a4212b9586f6bf848e1c47839ebfc5e9"
wolframalpha = "JWP25T-Y434EXL697"

View File

@@ -1,5 +1,6 @@
# **Create your own virtual assistant with just a few lines code (Using only PYTHON)** # **Create your own virtual assistant with just a few lines code (Using only PYTHON)**
_`Last Updated: February 05' 2022`_
Hello & Welcome to this git page. Here I just created my own Hello & Welcome to this git page. Here I just created my own
virtual assistant with just a few lines of code. It is not an virtual assistant with just a few lines of code. It is not an
@@ -11,13 +12,30 @@ step by step with me and by the end of it you will have your own
virtual assistant up & running as a charm. virtual assistant up & running as a charm.
To learn more about how I did it you can watch my YouTube To learn more about how I did it you can watch my YouTube
video on this or [click here](). video on this or [click here](https://www.youtube.com/channel/UCz6SDxk2KQqJAD6Ra_YPm6A).
## Pre-Requisites: ## Pre-Requisites:
1. Python Interpreter (Like [PyCharm](https://www.jetbrains.com/pycharm/)) 1. Python Interpreter (Like [PyCharm](https://www.jetbrains.com/pycharm/))
2. Python Environment (Like [Anaconda](https://www.anaconda.com/products/individual)) 2. Python Environment (Like [Anaconda](https://www.anaconda.com/products/individual))
3. Basic knowledge of how Python works & computers work 3. This [git repo](https://github.com/psavarmattas/PSMBot-Virtual-Assistant.git)
4. A will to explore 4. Bellow mentioned python packages:
-> [speechrecognition](https://pypi.org/project/SpeechRecognition/)
-> [pyttsx3](https://pypi.org/project/pyttsx3/)
-> [pywhatkit](https://pypi.org/project/pywhatkit/)
-> [pyjokes](https://pypi.org/project/pyjokes/)
-> [wolframalpha](https://pypi.org/project/wolframalpha/)
5. Basic knowledge of how Python works & computers work
6. A will to explore
7. Get API keys for the following to test your assistant yourself or
just use the one I provide you with but it is better to use your API keys
so that you don't bottle neck you assistant.
When all the above pre-requisites are there and ready you can When all the above pre-requisites are there and ready you can
start to work on your own virtual assistant. Please follow each start to work on your own virtual assistant. Please follow each
@@ -28,37 +46,34 @@ resolved before opening an issues.
## Steps: ## Steps:
### For Windows users: ### For Windows users:
1. Open PyCharm & create a new project with your virtual environment ready. 1. Open PyCharm & create a new project with your virtual environment ready.
2. Open the terminal and paste the following in sequential order line by line(Execute it one by one): 2. Open the terminal and paste the command highlighted below:
`pip install speechRecognistion` `pip install -r requirements.txt `
`pip install pyttsx3`
`pip install pywhatkit`
`pip install wikipedia`
`pip install pyjokes`
_Install this if necessary (Only when the code gives error)_ _Install this if necessary (Only when the code gives error)_
`pip install pyaudio` `pip install pyaudio`
3. Copy the code given in main.py (in this git) & you will have the code up & running on your pc. 3. Copy the code given in main.py (in this git) & you will have the code up & running on your pc.
4. If you want to learn how this code actually works the go [watch my YouTube video]() for a better understanding. _(Note: Creating two different files for weather & main you will have to import weather.py in the main.py file by using the `import weather` code in the main.py, therefore please make sure that the code for it is there or an error will be produced while running the weather command in the assistant.)_
4. If you want to learn how this code actually works the go [watch my YouTube video](https://www.youtube.com/channel/UCz6SDxk2KQqJAD6Ra_YPm6A) for a better understanding.
### For Linux/MacOs users: ### For Linux/MacOs users:
1. Learn all the above commands on terminal. 1. Learn all the above commands on terminal.
2. Make sure to use pip3, because in linux pip refers for python2 and pip3 refers to python3. 2. Make sure to use pip3, because in linux pip refers for python2 and pip3 refers to python3.
3. Install these too - `pip3 install pyAudio`. 3. Install this too - `pip3 install pyAudio`.
## Feature List: ## Feature List (v2.0):
1. Play videos on YouTube. 1. Play videos on YouTube.
2. Search wikipedia with your queries. 2. Search google with your queries.
3. Search google with your queries. 3. Listen to jokes.
4. Listen to jokes. 4. Ask for the weather (Anywhere in the world).
5. Ask for the weather (only New Delhi, India available right now). 5. It can solve complex math problems for you.
6. Ask it for today's date & time.
7. Say "thanks" or "thank you" and the assistant will appreciate you.
8. One command requirements install.

40
requirements.txt Normal file
View File

@@ -0,0 +1,40 @@
astroid @ file:///C:/ci/astroid_1639044403229/work
beautifulsoup4==4.9.3
certifi==2021.10.8
chardet==4.0.0
colorama @ file:///tmp/build/80754af9/colorama_1607707115595/work
comtypes==1.1.8
idna==2.10
isort @ file:///tmp/build/80754af9/isort_1628603791788/work
jaraco.context==4.0.0
lazy-object-proxy @ file:///C:/ci/lazy-object-proxy_1616529307648/work
mccabe==0.6.1
more-itertools==8.7.0
MouseInfo==0.1.3
Pillow==8.1.2
platformdirs @ file:///tmp/build/80754af9/platformdirs_1638968569495/work
PyAudio==0.2.11
PyAutoGUI==0.9.52
PyGetWindow==0.0.9
pyjokes==0.6.0
pylint @ file:///C:/ci/pylint_1639650750934/work
PyMsgBox==1.0.9
pyperclip==1.8.2
pypiwin32==223
PyRect==0.1.4
PyScreeze==0.1.26
pyttsx3==2.90
PyTweening==1.0.3
pywhatkit==3.9
pywin32==300
requests==2.25.1
six @ file:///tmp/build/80754af9/six_1623709665295/work
soupsieve==2.2
SpeechRecognition==3.8.1
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing-extensions @ file:///tmp/build/80754af9/typing_extensions_1631814937681/work
urllib3==1.26.3
wincertstore==0.2
wolframalpha==5.0.0
wrapt @ file:///C:/ci/wrapt_1638434029846/work
xmltodict==0.12.0

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2020 PSMForums. All rights reserved. # Copyright (c) 2021 PSMForums. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
@@ -9,52 +9,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# importing requests and json # API Key
import requests, json api_key = "a4212b9586f6bf848e1c47839ebfc5e9" #Your API Key here
# base URL # Base URL
BASE_URL = "https://api.openweathermap.org/data/2.5/weather?" weather_url = "http://api.openweathermap.org/data/2.5/weather?"
# City Name
CITY = "New Delhi"
# API key
API_KEY = "a4212b9586f6bf848e1c47839ebfc5e9"
# Updating the URL
URL = BASE_URL + "q=" + CITY + "&appid=" + API_KEY
# HTTP request
response = requests.get(URL)
# checking the status code of the request
if response.status_code == 200:
# getting data in the json format
data = response.json()
# getting the main dict block
main = data['main']
# getting temperature
temperature = main['temp']
# getting the humidity
humidity = main['humidity']
# getting the pressure
pressure = main['pressure']
# weather report
report = data['weather']
weather_city = f"{CITY:-^30}"
weather_temperature = f"Temperature: {temperature}"
weather_humidity = f"Humidity: {humidity}"
weather_pressure = f"Pressure: {pressure}"
weather_report = f"Weather Report: {report[0]['description']}"
else:
# showing the error message
weather_error = "Error in the HTTP request please try again"