From 6a4a7919879038bfd6f18f2ef406614db3d8c0e8 Mon Sep 17 00:00:00 2001 From: "Anastasios Panayi (panayia)" Date: Mon, 5 Nov 2018 16:12:09 +0000 Subject: [PATCH 1/7] Create anastasios --- anastasios | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 anastasios diff --git a/anastasios b/anastasios new file mode 100644 index 0000000..b60453e --- /dev/null +++ b/anastasios @@ -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) From 2505fcaeacdf8ba2ae466a18811d14142b3fa6b1 Mon Sep 17 00:00:00 2001 From: "Anastasios Panayi (panayia)" Date: Mon, 5 Nov 2018 16:13:05 +0000 Subject: [PATCH 2/7] Create thegreek.py --- thegreek.py | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 thegreek.py diff --git a/thegreek.py b/thegreek.py new file mode 100644 index 0000000..b60453e --- /dev/null +++ b/thegreek.py @@ -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) From b3613d7f9a1da9f2c3aefd82aa2ac9981d30bc93 Mon Sep 17 00:00:00 2001 From: "George Wood (woodg11)" Date: Mon, 5 Nov 2018 16:13:37 +0000 Subject: [PATCH 3/7] Delete anastasios --- anastasios | 89 ------------------------------------------------------ 1 file changed, 89 deletions(-) delete mode 100644 anastasios diff --git a/anastasios b/anastasios deleted file mode 100644 index b60453e..0000000 --- a/anastasios +++ /dev/null @@ -1,89 +0,0 @@ -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) From 3365746559c5659db962799dd5ce7fbac64b8e24 Mon Sep 17 00:00:00 2001 From: "William Smith (smithw9)" Date: Mon, 5 Nov 2018 16:14:04 +0000 Subject: [PATCH 4/7] Add files via upload --- chatbot | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 chatbot diff --git a/chatbot b/chatbot new file mode 100644 index 0000000..3d9bd56 --- /dev/null +++ b/chatbot @@ -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)) \ No newline at end of file From a8a00e633854fcbf6f22832b4f85c3ce1eb2fc9e Mon Sep 17 00:00:00 2001 From: "George Wood (woodg11)" Date: Mon, 5 Nov 2018 16:25:17 +0000 Subject: [PATCH 5/7] Update chat-bot-master.py --- chat-bot-master.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/chat-bot-master.py b/chat-bot-master.py index 741506a..f66c6c1 100644 --- a/chat-bot-master.py +++ b/chat-bot-master.py @@ -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: From 99a36d3269569c4c466e4db8597fe0d3031c9d43 Mon Sep 17 00:00:00 2001 From: "George Wood (woodg11)" Date: Mon, 12 Nov 2018 09:02:46 +0000 Subject: [PATCH 6/7] merged-chat-bot --- chat-bot-merged.py | 181 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 chat-bot-merged.py diff --git a/chat-bot-merged.py b/chat-bot-merged.py new file mode 100644 index 0000000..0de7435 --- /dev/null +++ b/chat-bot-merged.py @@ -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) From 3925c9fd2ffeb5ea980e06957c9f05cddf546804 Mon Sep 17 00:00:00 2001 From: "George Wood (woodg11)" Date: Mon, 19 Nov 2018 09:20:12 +0000 Subject: [PATCH 7/7] Create George-New-Code.py --- George-New-Code.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 George-New-Code.py diff --git a/George-New-Code.py b/George-New-Code.py new file mode 100644 index 0000000..3af6f75 --- /dev/null +++ b/George-New-Code.py @@ -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?")