Skip to content

Woodg11 patch 3 #3

Open
wants to merge 8 commits into
base: woodg11-patch-2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions George-New-Code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
def Sports():
favSport = input("Which sport would you like to talk about? ")
favSport = favSport.upper()
footie = ["FOOTBALL", "FOOTIE", "FOOTY", "FUTBAL", "FOOTBAL", "FOOTBOLL"]
tennis = ["TENNIS", "TENIS", "TENNISS"]
Yes = ["yes", "YES", "yeah", "ye", "yea", "yus"]
No = ["no", "nah", "noo", "nu", "nope"]
footballLeagues = {"BUNDESLIGA" : "BL1", "PREMIER LEAGUE" : "PL", "WORLD CUP" : "WC", "CHAMPIONS LEAGUE" : "CL", "LIGUE 1" : "FL1", "SERIE A" : "SA", "LA LIGA" : "PD", "PRIMERA DIVISION" : "PD"}
if favSport in footie:
favLeagueInput = input("Which football league is your favourite? My personal favourite is the premier league: ")
favLeagueInput = favLeagueInput.upper()
if favLeagueInput in footballLeagues.keys():
c = footballLeagues.get(favLeagueInput)
sportConnection = http.client.HTTPConnection('api.football-data.org')
sportHeaders = { 'X-Auth-Token': "3bb5ce52167545eba1be7e267522a063" }
sportConnection.request('GET','/v2/competitions/' + c + '/teams', None, sportHeaders)
sportResponse = json.loads(sportConnection.getresponse().read().decode())
favLeague = sportResponse["competition"]["name"]
# print(sportResponse)
print("Your favourite league is " + favLeague)
favLeagueID = sportResponse["competition"]["id"]
print("Your favourite league's ID is " + str(favLeagueID))
favLeagueCountry = sportResponse["competition"]["area"]["name"]
print("Your favourite league is in " + favLeagueCountry)
leagueLen = len(sportResponse["teams"])
userChoice = input("Would you like to know all the teams in the league you have chosen? ")
if userChoice in Yes:
for i in range(leagueLen):
print(sportResponse["teams"][i]["name"])
favTeam = input("Do you have a favourite team in this league? My favourite is Crystal Palace: ")
if favTeam in :
print(sportResponse["teams"][favTeam])
else:
print("WRONG")

elif userChoice in No:
input("Would you like to view anything else about sports? ")
if userChoice in Yes:
Sports()
elif userChoice in No:
intialInput()
else:
Sports()

elif favSport in tennis:
#tennisAPI = "https://api.sportradar.com/tennis-t2/en/schedules/" + year + "-" + month + "-" + day "/schedule.json?api_key=" + apiTennisKey
dateOfInput = input("Input date: ")
apiTennisKey = "hgp4xaq52zbqtvr5k73hx8j3"
tennisConnection = http.client.HTTPConnection('api.sportradar.com')
tennisHeaaders = {'api_key': "hgp4xaq52zbqtvr5k73hx8j3"}
tennisConnection.request('GET', '/tennis-t2/en/schedules/' + dateOfInput + "/schedule.json?api_key=" + apiTennisKey, None)
tennisResponse = json.loads(tennisConnection.getresponse().read().decode())
#print(tennisResponse)
for o in range(100):
tennisFavPlayer = tennisResponse["sport_events"][o]["season"]
print(tennisFavPlayer)
else:
print("Whoops, don't know anything about that sport, can we interest you in another sport?")
9 changes: 3 additions & 6 deletions chat-bot-master.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,9 @@ def Sports():
print("Your favourite league's ID is " + str(favLeagueID))
favLeagueCountry = sportResponse["competition"]["area"]["name"]
print("Your favourite league is in " + favLeagueCountry)
changeLeague = input("What would you like to know about this league? Or would you prefer to talk about another league/competition? ")
changeTheLeague = ["change", "something"]
changeNewLeague = changeLeague.split()
for changeNewLeague in changeTheLeague:
print("ok")
break

for i in range(20):
print(sportResponse["teams"][i]["name"])
elif favSport in bball:
print("Placeholder bball")
else:
Expand Down
181 changes: 181 additions & 0 deletions chat-bot-merged.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
import random
import getpass
import json
import http.client
import requests
import sys
#import thegamesdb
#from thegamesdb import api
listOfTopics = ["SPORTS", "VIDEO GAMES", "NEWS", "BOOKS", "MOVIES", "WEATHER"]

def userLogin():
name = ["KANYE", "GEORGE", "BOB", "DAVE", "POGO"]
userFirstInput = input("Please enter your username: ")
userFirstInput = userFirstInput.upper()
if userFirstInput in name:
print("Welcome " + userFirstInput)
userPasswordInput = getpass.getpass("Please enter password: ")
# userPasswordInput = input("Please enter password: ")
if userFirstInput == "KANYE":
if userPasswordInput == "kanyeyeast":
print("You are now able to use the chat bot.")
else:
print("You are not allowed here, goodbye.")
exit()
elif userFirstInput == "GEORGE":
if userPasswordInput == "george123":
print("You are now able to use the chat bot.")
else:
print("You are not allowed here, goodbye.")
exit()
elif userFirstInput == "BOB":
if userPasswordInput == "bob123":
print("You are now able to use the chat bot.")
else:
print("You are not allowed here, goodbye.")
exit()
elif userFirstInput == ("POGO"):
if userPasswordInput == "pogo123":
print("You are now able to use the chat bot.")
else:
print("You are not allowed here, goodbye.")
exit()
elif userFirstInput == ("DAVE"):
if userPasswordInput == ("123savage"):
print("21 21 21")
else:
print("I'm disappointed.")
exit()
else:
print("You aren't a valid user.")
exit()

def Sports():
favSport = input("Which sport would you like to talk about? ")
favSport = favSport.upper()
footie = ["FOOTBALL", "FOOTIE", "FOOTY", "FUTBAL", "FOOTBAL", "FOOTBOLL"]
bball = ["BASKETBALL", "BASKETBAL", "BBALL", "BSKETBALL"]
Yes = ["yes", "YES", "yeah", "ye", "yea", "yus"]
No = ["no", "nah", "noo", "nu", "nope"]
footballLeagues = {"BUNDESLIGA" : "BL1", "PREMIER LEAGUE" : "PL"}
if favSport in footie:
favLeagueInput = input("Which football league is your favourite? My personal favourite is the premier league: ")
favLeagueInput = favLeagueInput.upper()
if favLeagueInput in footballLeagues.keys():
c = footballLeagues.get(favLeagueInput)
sportConnection = http.client.HTTPConnection('api.football-data.org')
sportHeaders = { 'X-Auth-Token': "3bb5ce52167545eba1be7e267522a063" }
sportConnection.request('GET','/v2/competitions/' + favLeagueInput + '/teams', None, sportHeaders)
sportResponse = json.loads(sportConnection.getresponse().read().decode())
favLeague = sportResponse[c]["name"]
# print(sportResponse)
print("Your favourite league is " + favLeague)
favLeagueID = sportResponse[c]["id"]
print("Your favourite league's ID is " + str(favLeagueID))
favLeagueCountry = sportResponse["competition"]["area"]["name"]
print("Your favourite league is in " + favLeagueCountry)
userChoice = input("Would you like to know all the teams in the league you have chosen? ")
if userChoice in Yes:
for i in range(20):
print(sportResponse["teams"][i]["name"])
elif userChoice in No:
input("Would you like to view anything else about sports? ")
if userChoice in Yes:
Sports()
elif userChoice in No:
intialInput()
elif favSport in bball:
print("Placeholder bball")
else:
print("Whoops, don't know anything about that sport, can we interest you in another sport?")

def News():
print("placeholder news")

def videoGames():
gamesdb_api = API()
atari_games_list = gamesdb_api.get_platform_games('22') # Atari 2600 Platform id
for game in atari_games_list:
print(game.id, "-", game.title, "-", game.release_date)
if UserInput in ['PS4 future games', 'PS4 future releases']:
print("Here are some upcoming PS4 releases:")
print((PS4FutureRelease))

def WeatherA():
message = input()
x = message
x = x.lower()
##x_list = x.split()
weather = ['weather','rainy','sunny','sun','clouds','rain']
good = ['good','fine','great']
bad = ['fuck','shut up','bitch']
not_well = ['not' ,'rough','hard time']
while x in not_well:
print('Oh I\'m sorry.. i\'ll just wait for you to be okay then')
message = input()
x = message
x = x.lower()
x_list = x.split()
while x in bad:
print('Stop cursing please..')
message = input()
x = message
x = x.lower()
x_list = x.split()
while x in good:
print('Alright, now what else do you want to discuss?,(if you need to stop just type stop)')
answer = input()
answer = answer.lower()
answer_list = answer.split()
if message in weather:
api_adress = 'http://api.openweathermap.org/data/2.5/weather?appid=ca46285711e4bdc2f488e0089eac4758&q='
city = input('Please enter the name of the city that you want to know the weather')
city = city.capitalize()
url = api_adress + city
json_data = requests.get(url).json()
formatted_data = json_data['weather'][0]['description']
formatted2_Data = json_data['main']['temp'] - 272.15
print('It\'s' , round(formatted2_Data),'Celsius Degrees','and there are',formatted_data,'in',city)
elif answer == 'sports':
print('Sorry not available feature but it will be added soon!')
elif answer == 'news':
print('Sorry not available feature but it will be added soon!')
elif answer == 'video games' or answer == 'games':
print('Sorry not available feature but it will be added soon!')
elif answer == 'stop':
print('Thanks for Chatting , Bye :)')
sys.exit(1)
else:
print('Not available feature but i will pop a suggestion to my programmer :)')

def booksMovies():
print("placeholder books and movies")

userLogin()
intialInput = input("What would you like to talk about? ")
intialInput = intialInput.upper()

if intialInput in listOfTopics:
if intialInput == "SPORTS":
Sports()
elif intialInput == "NEWS":
News()
elif intialInput == "VIDEO GAMES":
videoGames()
elif intialInput == "WEATHER":
WeatherA()
elif intialInput == "BOOKS" or "MOVIES" or "BOOKS MOVIES":
booksMovies()
else:
randomNum = randint(1,5)
if randomNum == 1:
randomTopic = "Sports"
elif randomNum == 2:
randomTopic = "News"
elif randomNum == 3:
randomTopic = "Video Games"
elif randomNum == 4:
randomTopic = "Weather"
elif randomNum == 5:
randomTopic = "Books and Movies"
print("We don't know much about that, maybe I can interest you in something we do know about, like: " + randomTopic)
34 changes: 34 additions & 0 deletions chatbot
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import random
import thegamesdb
from thegamesdb import api
gamesdb_api = API()

atari_games_list = gamesdb_api.get_platform_games('22') # Atari 2600 Platform id
for game in atari_games_list:
print(game.id, "-", game.title, "-", game.release_date)























if UserInput in ['PS4 future games', 'PS4 future releases']:
print("Here are some upcoming PS4 releases:")
print((PS4FutureRelease))
89 changes: 89 additions & 0 deletions thegreek.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
CHAT BOT 1!!
import requests
import sys
def chatbot():
name = input("Welcome to python's chatbot, Please type your name")
name = name.capitalize()
print('Hello' , name , 'how are you today?')
message = input()
x = message
x = x.lower()
##x_list = x.split()
weather = ['weather','rainy','sunny','sun','clouds','rain']
good = ['good','fine','great']
bad = ['fuck','shut up','bitch']
not_well = ['not' ,'rough','hard time']
while x in not_well:
##while True:
##for s in not_well:
##for item in x_list:
##if item in s:
print('Oh I\'m sorry.. i\'ll just wait for you to be okay then')
message = input()
x = message
x = x.lower()
x_list = x.split()
##continue
while x in bad:
##while True:
##x_list = x.split()
##for s in bad:
##for item in x_list:
##if item in s:
print('Stop cursing please..')
message = input()
x = message
x = x.lower()
x_list = x.split()
##continue
while x in good:

##while True:
##x_list=x.split()
##for s in good:
##for item in x_list:
##if item in s:
print('Alright, now what else do you want to discuss?,(if you need to stop just type stop)')
answer = input()
answer = answer.lower()
answer_list = answer.split()
if answer in weather:
##for s in weather:
##for item in answer_list:
##if item in s:
api_adress = 'http://api.openweathermap.org/data/2.5/weather?appid=ca46285711e4bdc2f488e0089eac4758&q='
city = input('Please enter the name of the city that you want to know the weather')
city = city.capitalize()
url = api_adress + city
json_data = requests.get(url).json()
formatted_data = json_data['weather'][0]['description']
formatted2_Data = json_data['main']['temp'] - 272.15
print('It\'s' , round(formatted2_Data),'Celsius Degrees','and there are',formatted_data,'in',city)
elif answer == 'sports':
print('Sorry not available feature but it will be added soon!')
elif answer == 'news':
print('Sorry not available feature but it will be added soon!')
elif answer == 'video games' or answer == 'games':
print('Sorry not available feature but it will be added soon!')
elif answer == 'stop':
print('Thanks for Chatting , Bye :)')
sys.exit(1)
else:
print('Not available feature but i will pop a suggestion to my programmer :)')
chatbot()
CHAT BOT 2!!
import sys
from chatterbot.trainers import ListTrainer
from chatterbot import ChatBot
bot = ChatBot('Test')
conv = open('final.txt', 'r').readlines()
##bot.set_trainer(ListTrainer)
##bot.train(conv)
while True:
request = input ('User :')
request = request.lower()
response = bot.get_response(request)
print('Bot :' , response)
if request == 'stop' or request == 'end' or request == 'please stop' or request == 'please make this stop':
print('Bot :', 'Thanks for Chatting Bye :)')
sys.exit(1)